All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs: Remove unnecessary call to btrfs_mark_buffer_dirty()
@ 2025-11-12  6:48 Zhen Ni
  0 siblings, 0 replies; only message in thread
From: Zhen Ni @ 2025-11-12  6:48 UTC (permalink / raw)
  To: clm, dsterba; +Cc: linux-btrfs, Zhen Ni

When btrfs_insert_empty_item() succeeds, the leaf has already been
marked dirty automatically through two mechanisms:

1) COW operations: btrfs_search_slot(cow=1)

2) setup_items_for_insert() → btrfs_mark_buffer_dirty(trans, leaf)

Therefore the explicit call in btrfs_insert_item() is redundant and can
be safely removed. This removes unnecessary code verbosity, reduces
overhead, and aligns with the cleanup done in commit 1ca4e15f41f2e
("btrfs: volumes: remove unnecessary calls to btrfs_mark_buffer_dirty()").

Signed-off-by: Zhen Ni <zhen.ni@easystack.cn>
---
 fs/btrfs/ctree.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index 561658aca018..719eb5127f3a 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -4324,7 +4324,6 @@ int btrfs_insert_item(struct btrfs_trans_handle *trans, struct btrfs_root *root,
 		leaf = path->nodes[0];
 		ptr = btrfs_item_ptr_offset(leaf, path->slots[0]);
 		write_extent_buffer(leaf, data, ptr, data_size);
-		btrfs_mark_buffer_dirty(trans, leaf);
 	}
 	return ret;
 }
-- 
2.20.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2025-11-12  6:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-12  6:48 [PATCH] btrfs: Remove unnecessary call to btrfs_mark_buffer_dirty() Zhen Ni

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.