diff options
-rw-r--r-- | ctree.h | 11 | ||||
-rw-r--r-- | mkfs.c | 1 |
2 files changed, 12 insertions, 0 deletions
@@ -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); @@ -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); |