[Sheepdog] Sheepdog inodes & volumes

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Sun Dec 5 19:18:26 CET 2010


At Fri, 26 Nov 2010 14:47:09 +0530,
Narendra Prasad Madanapalli wrote:
> 
> Hi,
> 
> I am trying to understand how sheepdog volumes are strored and what
> data structures are used for storage.
> 
> Sheepdog inode is declared in include/sheepdog_proto.h
> 

Here is the explanation of fields of this structure.

> struct sheepdog_inode {
> 	char name[SD_MAX_VDI_LEN];

name of this vdi

> 	char tag[SD_MAX_VDI_TAG_LEN];

snapshot tag

If this vdi is not snapshot, tag should be filled with zero.

> 	uint64_t ctime;

time this vdi is created

> 	uint64_t snap_ctime;

time this vdi is snapshotted

If this vdi is not snapshot, snap_ctime should be zero.

> 	uint64_t vm_clock_nsec;

vm clock relative to boot

This is used to store live snapshot information.

> 	uint64_t vdi_size;

size of this vdi

> 	uint64_t vm_state_size;

vm state info size

This is used to store live snapshot information.

> 	uint16_t copy_policy;

policy to replicate objects

This is reserved for future use.

> 	uint8_t  nr_copies;

the number of redundancy

> 	uint8_t  block_size_shift;

number to calculate data object size

The size of the data object is (1 << block_size_shift).

> 	uint32_t snap_id;

snapshot id of this vdi

> 	uint32_t vdi_id;

vdi id of this vdi

> 	uint32_t parent_vdi_id;
vdi id of the parent vdi
> 	uint32_t child_vdi_id[MAX_CHILDREN];
vdi ids of the children vdis

You can see a snapshot tree with 'collie vdi tree'.

> 	uint32_t data_vdi_id[MAX_DATA_OBJS];

list of vdi id which is used to calculate data object id

> };
> 
> And the function create_vdi_obj() (in sheep/vdi.c) creates vdi object.
> This function defines three static variables new, base, cur of type
> 'struct sheepdog_inode'
> 
> Can anyone point to me the documentation on the above structure and variables?

'new', 'base', and 'cur' variables store the vdi info of the following:

new:  vdi which is created in the function
base: base vdi (used when cloning volumes)
cur:  current vdi (this vdi will become the snapshot vdi)


> Where super object is stored and the other inodes are linked with super object?

We don't use a super object now.  Sheepdog gathers vdi info from all
nodes when it starts, so there is no object to store all vdis info.


Thanks,

Kazutaka



More information about the sheepdog mailing list