btrfs: tree-log: remove unnecessary calls to btrfs_mark_buffer_dirty()
authorFilipe Manana <fdmanana@suse.com>
Wed, 18 Dec 2024 12:02:16 +0000 (12:02 +0000)
committerDavid Sterba <dsterba@suse.com>
Mon, 13 Jan 2025 13:53:18 +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/tree-log.c

index c8d6587688b3dde966c0b0f354576ee60a8dac93..955d1677e8653f33bb28b65ef9f6900df7b087fc 100644 (file)
@@ -590,7 +590,6 @@ insert:
                }
        }
 no_copy:
-       btrfs_mark_buffer_dirty(trans, path->nodes[0]);
        btrfs_release_path(path);
        return 0;
 }
@@ -3588,7 +3587,6 @@ static noinline int insert_dir_log_key(struct btrfs_trans_handle *trans,
                last_offset = max(last_offset, curr_end);
        }
        btrfs_set_dir_log_end(path->nodes[0], item, last_offset);
-       btrfs_mark_buffer_dirty(trans, path->nodes[0]);
        btrfs_release_path(path);
        return 0;
 }
@@ -4566,7 +4564,6 @@ copy_item:
                dst_index++;
        }
 
-       btrfs_mark_buffer_dirty(trans, dst_path->nodes[0]);
        btrfs_release_path(dst_path);
 out:
        kfree(ins_data);
@@ -4776,7 +4773,6 @@ static int log_one_extent(struct btrfs_trans_handle *trans,
        write_extent_buffer(leaf, &fi,
                            btrfs_item_ptr_offset(leaf, path->slots[0]),
                            sizeof(fi));
-       btrfs_mark_buffer_dirty(trans, leaf);
 
        btrfs_release_path(path);