forked from Mirrors/btrfs-progs
groundwork for subvolume and snapshot roots
parent
8accdae27a
commit
86c2d78728
11
ctree.h
11
ctree.h
|
@ -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
1
mkfs.c
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue