Btrfs: fix max dir item size calculation
authorFilipe David Borba Manana <fdmanana@gmail.com>
Wed, 27 Nov 2013 16:06:16 +0000 (16:06 +0000)
committerChris Mason <clm@fb.com>
Tue, 28 Jan 2014 21:19:49 +0000 (13:19 -0800)
We were accounting for sizeof(struct btrfs_item) twice, once
in the data_size variable and another time in the if statement
below.

Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
Signed-off-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Chris Mason <clm@fb.com>
fs/btrfs/dir-item.c

index c031ea3fd70f70d64452a3529d3ef99c830a57bf..9a89ceb25e83147baab73cf209885a02505befb2 100644 (file)
@@ -261,7 +261,7 @@ int btrfs_check_dir_item_collision(struct btrfs_root *root, u64 dir,
         * see if there is room in the item to insert this
         * name
         */
-       data_size = sizeof(*di) + name_len + sizeof(struct btrfs_item);
+       data_size = sizeof(*di) + name_len;
        leaf = path->nodes[0];
        slot = path->slots[0];
        if (data_size + btrfs_item_size_nr(leaf, slot) +