public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: fdmanana@kernel.org
To: linux-btrfs@vger.kernel.org
Subject: [PATCH 19/20] btrfs: volumes: remove unnecessary calls to btrfs_mark_buffer_dirty()
Date: Wed, 18 Dec 2024 17:06:46 +0000	[thread overview]
Message-ID: <932b0c07f2d8a7ea4e7dd52eb71545490346ad2b.1734527445.git.fdmanana@suse.com> (raw)
In-Reply-To: <cover.1734527445.git.fdmanana@suse.com>

From: Filipe Manana <fdmanana@suse.com>

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.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
 fs/btrfs/volumes.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index d32913c51d69..7975d0d1236c 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -2046,7 +2046,6 @@ static int btrfs_add_dev_item(struct btrfs_trans_handle *trans,
 	ptr = btrfs_device_fsid(dev_item);
 	write_extent_buffer(leaf, trans->fs_info->fs_devices->metadata_uuid,
 			    ptr, BTRFS_FSID_SIZE);
-	btrfs_mark_buffer_dirty(trans, leaf);
 
 	ret = 0;
 out:
@@ -2742,11 +2741,9 @@ static int btrfs_finish_sprout(struct btrfs_trans_handle *trans)
 		device = btrfs_find_device(fs_info->fs_devices, &args);
 		BUG_ON(!device); /* Logic error */
 
-		if (device->fs_devices->seeding) {
+		if (device->fs_devices->seeding)
 			btrfs_set_device_generation(leaf, dev_item,
 						    device->generation);
-			btrfs_mark_buffer_dirty(trans, leaf);
-		}
 
 		path->slots[0]++;
 		goto next_slot;
@@ -3039,8 +3036,6 @@ static noinline int btrfs_update_device(struct btrfs_trans_handle *trans,
 				     btrfs_device_get_disk_total_bytes(device));
 	btrfs_set_device_bytes_used(leaf, dev_item,
 				    btrfs_device_get_bytes_used(device));
-	btrfs_mark_buffer_dirty(trans, leaf);
-
 out:
 	btrfs_free_path(path);
 	return ret;
@@ -3749,10 +3744,7 @@ static int insert_balance_item(struct btrfs_fs_info *fs_info,
 	btrfs_set_balance_meta(leaf, item, &disk_bargs);
 	btrfs_cpu_balance_args_to_disk(&disk_bargs, &bctl->sys);
 	btrfs_set_balance_sys(leaf, item, &disk_bargs);
-
 	btrfs_set_balance_flags(leaf, item, bctl->flags);
-
-	btrfs_mark_buffer_dirty(trans, leaf);
 out:
 	btrfs_free_path(path);
 	err = btrfs_commit_transaction(trans);
@@ -7746,8 +7738,6 @@ static int update_dev_stat_item(struct btrfs_trans_handle *trans,
 	for (i = 0; i < BTRFS_DEV_STAT_VALUES_MAX; i++)
 		btrfs_set_dev_stats_value(eb, ptr, i,
 					  btrfs_dev_stat_read(device, i));
-	btrfs_mark_buffer_dirty(trans, eb);
-
 out:
 	btrfs_free_path(path);
 	return ret;
-- 
2.45.2


  parent reply	other threads:[~2024-12-18 17:07 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-18 17:06 [PATCH 00/20] btrfs: remove plenty of redundant btrfs_mark_buffer_dirty() calls fdmanana
2024-12-18 17:06 ` [PATCH 01/20] btrfs: tree-log: remove unnecessary calls to btrfs_mark_buffer_dirty() fdmanana
2024-12-18 17:06 ` [PATCH 02/20] btrfs: free-space-tree: " fdmanana
2024-12-18 17:06 ` [PATCH 03/20] btrfs: extent-tree: " fdmanana
2024-12-18 17:06 ` [PATCH 04/20] btrfs: block-group: " fdmanana
2024-12-18 17:06 ` [PATCH 05/20] btrfs: delayed-inode: remove unnecessary call " fdmanana
2024-12-18 17:06 ` [PATCH 06/20] btrfs: dev-replace: " fdmanana
2024-12-18 17:06 ` [PATCH 07/20] btrfs: dir-item: remove unnecessary calls " fdmanana
2024-12-18 17:06 ` [PATCH 08/20] btrfs: file: " fdmanana
2024-12-18 17:06 ` [PATCH 09/20] btrfs: file-item: " fdmanana
2024-12-18 17:06 ` [PATCH 10/20] btrfs: free-space-cache: " fdmanana
2024-12-18 17:06 ` [PATCH 11/20] btrfs: inode: " fdmanana
2024-12-18 17:06 ` [PATCH 12/20] btrfs: inode-item: " fdmanana
2024-12-18 17:06 ` [PATCH 13/20] btrfs: ioctl: remove unnecessary call " fdmanana
2024-12-18 17:06 ` [PATCH 14/20] btrfs: qgroup: remove unnecessary calls " fdmanana
2024-12-18 17:06 ` [PATCH 15/20] btrfs: raid-stripe-tree: remove unnecessary call " fdmanana
2024-12-18 17:06 ` [PATCH 16/20] btrfs: relocation: remove unnecessary calls " fdmanana
2024-12-18 17:06 ` [PATCH 17/20] btrfs: root-tree: " fdmanana
2024-12-18 17:06 ` [PATCH 18/20] btrfs: uuid-tree: remove unnecessary call " fdmanana
2024-12-18 17:06 ` fdmanana [this message]
2024-12-18 17:06 ` [PATCH 20/20] btrfs: xattr: " fdmanana
2024-12-19  7:43 ` [PATCH 00/20] btrfs: remove plenty of redundant btrfs_mark_buffer_dirty() calls Johannes Thumshirn
2024-12-23 20:08 ` David Sterba
2025-01-06 10:54   ` Filipe Manana
2025-01-06 14:19     ` David Sterba
2025-01-06 15:43       ` Filipe Manana

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=932b0c07f2d8a7ea4e7dd52eb71545490346ad2b.1734527445.git.fdmanana@suse.com \
    --to=fdmanana@kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox