]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
btrfs: inode: remove unnecessary calls to btrfs_mark_buffer_dirty()
authorFilipe Manana <fdmanana@suse.com>
Wed, 18 Dec 2024 12:46:03 +0000 (12:46 +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/inode.c

index a7a3d879f2f2aae711e57efe0a80ba49db1721b2..1546f341f9a4f2d5478c7b64936b4132a4740db3 100644 (file)
@@ -564,7 +564,6 @@ static int insert_inline_extent(struct btrfs_trans_handle *trans,
                kunmap_local(kaddr);
                folio_put(folio);
        }
-       btrfs_mark_buffer_dirty(trans, leaf);
        btrfs_release_path(path);
 
        /*
@@ -2918,7 +2917,6 @@ static int insert_reserved_file_extent(struct btrfs_trans_handle *trans,
                        btrfs_item_ptr_offset(leaf, path->slots[0]),
                        sizeof(struct btrfs_file_extent_item));
 
-       btrfs_mark_buffer_dirty(trans, leaf);
        btrfs_release_path(path);
 
        /*
@@ -4082,7 +4080,6 @@ static noinline int btrfs_update_inode_item(struct btrfs_trans_handle *trans,
                                    struct btrfs_inode_item);
 
        fill_inode_item(trans, leaf, inode_item, &inode->vfs_inode);
-       btrfs_mark_buffer_dirty(trans, leaf);
        btrfs_set_inode_last_trans(trans, inode);
        ret = 0;
 failed:
@@ -6377,7 +6374,6 @@ int btrfs_create_new_inode(struct btrfs_trans_handle *trans,
                }
        }
 
-       btrfs_mark_buffer_dirty(trans, path->nodes[0]);
        /*
         * We don't need the path anymore, plus inheriting properties, adding
         * ACLs, security xattrs, orphan item or adding the link, will result in
@@ -8679,7 +8675,6 @@ static int btrfs_symlink(struct mnt_idmap *idmap, struct inode *dir,
 
        ptr = btrfs_file_extent_inline_start(ei);
        write_extent_buffer(leaf, symname, ptr, name_len);
-       btrfs_mark_buffer_dirty(trans, leaf);
        btrfs_free_path(path);
 
        d_instantiate_new(dentry, inode);