btrfs: dir-item: remove unnecessary calls to btrfs_mark_buffer_dirty()
authorFilipe Manana <fdmanana@suse.com>
Wed, 18 Dec 2024 12:36:21 +0000 (12:36 +0000)
committerDavid Sterba <dsterba@suse.com>
Mon, 13 Jan 2025 13:53:19 +0000 (14:53 +0100)
We have several places explicitly calling btrfs_mark_buffer_dirty() but
that is not necessarily since the target leaf came from a path that was
obtained for a btree search function that modifies the btree, something
like btrfs_insert_empty_item() or anything else that ends up calling
btrfs_search_slot() with a value of 1 for its 'cow' argument.

These just make the code more verbose, confusing and add a little extra
overhead and well as increase the module's text size, so remove them.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/dir-item.c

index 1ea5d8fcfbf7e343d88452b63e8587e54b25317c..ccf91de29f802ebdb3a43aee917e667b9ee680ea 100644 (file)
@@ -92,7 +92,6 @@ int btrfs_insert_xattr_item(struct btrfs_trans_handle *trans,
 
        write_extent_buffer(leaf, name, name_ptr, name_len);
        write_extent_buffer(leaf, data, data_ptr, data_len);
-       btrfs_mark_buffer_dirty(trans, path->nodes[0]);
 
        return ret;
 }
@@ -152,7 +151,6 @@ int btrfs_insert_dir_item(struct btrfs_trans_handle *trans,
        name_ptr = (unsigned long)(dir_item + 1);
 
        write_extent_buffer(leaf, name->name, name_ptr, name->len);
-       btrfs_mark_buffer_dirty(trans, leaf);
 
 second_insert:
        /* FIXME, use some real flag for selecting the extra index */