All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zhen Ni <zhen.ni@easystack.cn>
To: clm@fb.com, dsterba@suse.com
Cc: linux-btrfs@vger.kernel.org, Zhen Ni <zhen.ni@easystack.cn>
Subject: [PATCH] btrfs: Remove unnecessary call to btrfs_mark_buffer_dirty()
Date: Wed, 12 Nov 2025 14:48:53 +0800	[thread overview]
Message-ID: <20251112064853.1822908-1-zhen.ni@easystack.cn> (raw)

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


                 reply	other threads:[~2025-11-12  6:49 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251112064853.1822908-1-zhen.ni@easystack.cn \
    --to=zhen.ni@easystack.cn \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.