mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-02-17 21:50:44 -05:00
btrfs: relocation: remove unnecessary calls to btrfs_mark_buffer_dirty()
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>
This commit is contained in:
committed by
David Sterba
parent
bdf1660b22
commit
5a8293a1cc
@@ -856,7 +856,6 @@ int replace_file_extents(struct btrfs_trans_handle *trans,
|
||||
u32 i;
|
||||
int ret = 0;
|
||||
int first = 1;
|
||||
int dirty = 0;
|
||||
|
||||
if (rc->stage != UPDATE_DATA_PTRS)
|
||||
return 0;
|
||||
@@ -936,7 +935,6 @@ int replace_file_extents(struct btrfs_trans_handle *trans,
|
||||
}
|
||||
|
||||
btrfs_set_file_extent_disk_bytenr(leaf, fi, new_bytenr);
|
||||
dirty = 1;
|
||||
|
||||
key.offset -= btrfs_file_extent_offset(leaf, fi);
|
||||
ref.action = BTRFS_ADD_DELAYED_REF;
|
||||
@@ -967,8 +965,6 @@ int replace_file_extents(struct btrfs_trans_handle *trans,
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (dirty)
|
||||
btrfs_mark_buffer_dirty(trans, leaf);
|
||||
if (inode)
|
||||
btrfs_add_delayed_iput(inode);
|
||||
return ret;
|
||||
@@ -1161,13 +1157,11 @@ int replace_path(struct btrfs_trans_handle *trans, struct reloc_control *rc,
|
||||
*/
|
||||
btrfs_set_node_blockptr(parent, slot, new_bytenr);
|
||||
btrfs_set_node_ptr_generation(parent, slot, new_ptr_gen);
|
||||
btrfs_mark_buffer_dirty(trans, parent);
|
||||
|
||||
btrfs_set_node_blockptr(path->nodes[level],
|
||||
path->slots[level], old_bytenr);
|
||||
btrfs_set_node_ptr_generation(path->nodes[level],
|
||||
path->slots[level], old_ptr_gen);
|
||||
btrfs_mark_buffer_dirty(trans, path->nodes[level]);
|
||||
|
||||
ref.action = BTRFS_ADD_DELAYED_REF;
|
||||
ref.bytenr = old_bytenr;
|
||||
@@ -3728,7 +3722,6 @@ static int __insert_orphan_inode(struct btrfs_trans_handle *trans,
|
||||
btrfs_set_inode_mode(leaf, item, S_IFREG | 0600);
|
||||
btrfs_set_inode_flags(leaf, item, BTRFS_INODE_NOCOMPRESS |
|
||||
BTRFS_INODE_PREALLOC);
|
||||
btrfs_mark_buffer_dirty(trans, leaf);
|
||||
out:
|
||||
btrfs_free_path(path);
|
||||
return ret;
|
||||
|
||||
Reference in New Issue
Block a user