groundwork for subvolume and snapshot roots

This commit is contained in:
Chris Mason 2007-04-09 10:42:55 -04:00 committed by David Woodhouse
parent 8accdae27a
commit 86c2d78728
2 changed files with 12 additions and 0 deletions

11
ctree.h
View File

@ -740,6 +740,17 @@ static inline void btrfs_set_super_blocknr(struct btrfs_super_block *s, u64 val)
s->blocknr = cpu_to_le64(val);
}
static inline u64 btrfs_super_generation(struct btrfs_super_block *s)
{
return le64_to_cpu(s->generation);
}
static inline void btrfs_set_super_generation(struct btrfs_super_block *s,
u64 val)
{
s->generation = cpu_to_le64(val);
}
static inline u64 btrfs_super_root(struct btrfs_super_block *s)
{
return le64_to_cpu(s->root);

1
mkfs.c
View File

@ -120,6 +120,7 @@ int mkfs(int fd, u64 num_blocks, u32 blocksize)
u32 itemoff;
u32 start_block = BTRFS_SUPER_INFO_OFFSET / blocksize;
btrfs_set_super_generation(&super, 1);
btrfs_set_super_blocknr(&super, start_block);
btrfs_set_super_root(&super, start_block + 1);
strcpy((char *)(&super.magic), BTRFS_MAGIC);