From 7cb1cf754229062ea412aa651a0f750ce42c113d Mon Sep 17 00:00:00 2001 From: Miao Xie Date: Sat, 1 Sep 2012 16:45:30 +0800 Subject: Btrfs-progs: fix wrong way to check if the root item contains otime and uuid Now we check if the root item contains otime and uuid or not by comparing ->generation_v2 and ->generation of the btrfs_root_item structure, it is wrong because it is possbile that ->generation may equal to the first variant of the next item. We fix this problem by check the size of btrfs_root_item, if it is larger than the original one, the new btrfs_root_item contains otime and uuid. we needn't worry the case that the new filesystem is mounted on the old kernel. because the otime and uuid are not changed on the old kernel, we can get the correct result even on the kernel. Signed-off-by: Miao Xie --- ctree.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'ctree.h') diff --git a/ctree.h b/ctree.h index 7f552291..c55d0338 100644 --- a/ctree.h +++ b/ctree.h @@ -637,6 +637,21 @@ struct btrfs_dir_item { u8 type; } __attribute__ ((__packed__)); +struct btrfs_root_item_v0 { + struct btrfs_inode_item inode; + __le64 generation; + __le64 root_dirid; + __le64 bytenr; + __le64 byte_limit; + __le64 bytes_used; + __le64 last_snapshot; + __le64 flags; + __le32 refs; + struct btrfs_disk_key drop_progress; + u8 drop_level; + u8 level; +} __attribute__ ((__packed__)); + struct btrfs_root_item { struct btrfs_inode_item inode; __le64 generation; -- cgit v1.2.3