]> git.hungrycats.org Git - linux/commitdiff
Btrfs: fix wrong max inline data size limit
authorWang Shilong <wangsl.fnst@cn.fujitsu.com>
Thu, 17 Jul 2014 03:44:12 +0000 (11:44 +0800)
committerZygo Blaxell <zblaxell@serenity.furryterror.org>
Wed, 3 Dec 2014 15:16:20 +0000 (10:16 -0500)
inline data is stored from offset of @disk_bytenr in
struct btrfs_file_extent_item. So substracting total
size of struct btrfs_file_extent_item is wrong, fix it.

Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
Reviewed-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <clm@fb.com>
(cherry picked from commit c01a5c074c0f6f85a3b02e39432b9e5576ab51de)

fs/btrfs/ctree.h

index 165e426208f48af3793026a39852b9ae447a7b04..511d11032569cdf61d11e564419a567ceb41a9c9 100644 (file)
@@ -394,7 +394,7 @@ struct btrfs_header {
 #define BTRFS_LEAF_DATA_SIZE(r) (__BTRFS_LEAF_DATA_SIZE(r->nodesize))
 #define BTRFS_MAX_INLINE_DATA_SIZE(r) (BTRFS_LEAF_DATA_SIZE(r) - \
                                        sizeof(struct btrfs_item) - \
-                                       sizeof(struct btrfs_file_extent_item))
+                                       offsetof(struct btrfs_file_extent_item, disk_bytenr))
 #define BTRFS_MAX_XATTR_SIZE(r)        (BTRFS_LEAF_DATA_SIZE(r) - \
                                 sizeof(struct btrfs_item) -\
                                 sizeof(struct btrfs_dir_item))