diff mbox series

[1/5] btrfs: Re-arrange statements in setup_items_for_insert

Message ID 20200901144001.4265-2-nborisov@suse.com
State New, archived
Headers show
Series Improve setup_items_for_insert | expand

Commit Message

Nikolay Borisov Sept. 1, 2020, 2:39 p.m. UTC
Rearrange statements calculating the offset of the newly added items so
that the calculation has to be done only once. No functional change.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
 fs/btrfs/ctree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Josef Bacik Sept. 1, 2020, 7:13 p.m. UTC | #1
On 9/1/20 10:39 AM, Nikolay Borisov wrote:
> Rearrange statements calculating the offset of the newly added items so
> that the calculation has to be done only once. No functional change.
> 
> Signed-off-by: Nikolay Borisov <nborisov@suse.com>

Reviewed-by: Josef Bacik <josef@toxicpanda.com>

Thanks,

Josef
diff mbox series

Patch

diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index 31e356240fce..0f325aaa5c1c 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -4823,8 +4823,8 @@  void setup_items_for_insert(struct btrfs_root *root, struct btrfs_path *path,
 		btrfs_cpu_key_to_disk(&disk_key, cpu_key + i);
 		btrfs_set_item_key(leaf, &disk_key, slot + i);
 		item = btrfs_item_nr(slot + i);
-		btrfs_set_token_item_offset(&token, item, data_end - data_size[i]);
 		data_end -= data_size[i];
+		btrfs_set_token_item_offset(&token, item, data_end);
 		btrfs_set_token_item_size(&token, item, data_size[i]);
 	}