@@ -882,10 +882,12 @@ static int lookup_inline_extent_backref(struct btrfs_trans_handle *trans,
key.offset = num_bytes;
want = extent_ref_type(parent, owner);
- if (insert)
+ if (insert) {
extra_size = btrfs_extent_inline_ref_size(want);
- else
+ path->search_for_extension = 1;
+ } else {
extra_size = -1;
+ }
if (owner < BTRFS_FIRST_FREE_OBJECTID && skinny_metadata) {
key.type = BTRFS_METADATA_ITEM_KEY;
@@ -1023,6 +1025,8 @@ again:
}
*ref_ret = (struct btrfs_extent_inline_ref *)ptr;
out:
+ if (insert)
+ path->search_for_extension = 0;
return err;
}
@@ -268,8 +268,10 @@ int btrfs_csum_file_block(struct btrfs_trans_handle *trans,
* enough yet to put our csum in. Grow it
*/
btrfs_release_path(path);
+ path->search_for_extension = 1;
ret = btrfs_search_slot(trans, root, &file_key, path,
csum_size, 1);
+ path->search_for_extension = 0;
if (ret < 0)
goto fail;
if (ret == 0) {
This flag is used by the kernel btrfs_search_slot to make sure that leaf splitting decision doesn't subtract the size of an item. This is for inline extent items and csum items where we know we're going to find the item we want, and we're only going to want to extend it. Currently this flag doesn't do anything, but when we sync ctree.c we'll stop making the right decision WRT the leaf space, so add the flag usage in the places we need it so we can sync ctree.c easily. Signed-off-by: Josef Bacik <josef@toxicpanda.com> --- kernel-shared/extent-tree.c | 8 ++++++-- kernel-shared/file-item.c | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-)