All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anand Jain <anand.jain@oracle.com>
To: linux-btrfs@vger.kernel.org
Cc: Anand Jain <anand.jain@oracle.com>, Josef Bacik <josef@toxicpanda.com>
Subject: [PATCH v2 02/11] btrfs: btrfs_write_marked_extents rename werr and err to ret
Date: Thu, 18 Apr 2024 15:08:34 +0800	[thread overview]
Message-ID: <5ad8b149fbf1f24b3610fc129b24b85196213ec4.1713370756.git.anand.jain@oracle.com> (raw)
In-Reply-To: <cover.1713370756.git.anand.jain@oracle.com>

Rename the function's local variable werr and err to ret.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
---
v2:  On top of the patch
      [PATCH v2] btrfs: report filemap_fdata<write|wait>_range error
     Just one variable 'ret' for the return error code.

 fs/btrfs/transaction.c | 23 ++++++++++-------------
 1 file changed, 10 insertions(+), 13 deletions(-)

diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index 8c3b3cda1390..defdb0979d68 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -1118,8 +1118,7 @@ int btrfs_end_transaction_throttle(struct btrfs_trans_handle *trans)
 int btrfs_write_marked_extents(struct btrfs_fs_info *fs_info,
 			       struct extent_io_tree *dirty_pages, int mark)
 {
-	int err = 0;
-	int werr = 0;
+	int ret = 0;
 	struct address_space *mapping = fs_info->btree_inode->i_mapping;
 	struct extent_state *cached_state = NULL;
 	u64 start = 0;
@@ -1129,7 +1128,7 @@ int btrfs_write_marked_extents(struct btrfs_fs_info *fs_info,
 				     mark, &cached_state)) {
 		bool wait_writeback = false;
 
-		err = convert_extent_bit(dirty_pages, start, end,
+		ret = convert_extent_bit(dirty_pages, start, end,
 					 EXTENT_NEED_WAIT,
 					 mark, &cached_state);
 		/*
@@ -1145,24 +1144,22 @@ int btrfs_write_marked_extents(struct btrfs_fs_info *fs_info,
 		 * We cleanup any entries left in the io tree when committing
 		 * the transaction (through extent_io_tree_release()).
 		 */
-		if (err == -ENOMEM) {
-			err = 0;
+		if (ret == -ENOMEM) {
+			ret = 0;
 			wait_writeback = true;
 		}
-		if (!err)
-			err = filemap_fdatawrite_range(mapping, start, end);
-		if (err)
-			werr = err;
-		else if (wait_writeback)
-			werr = filemap_fdatawait_range(mapping, start, end);
+		if (!ret)
+			ret = filemap_fdatawrite_range(mapping, start, end);
+		if (!ret && wait_writeback)
+			ret = filemap_fdatawait_range(mapping, start, end);
 		free_extent_state(cached_state);
-		if (werr)
+		if (ret)
 			break;
 		cached_state = NULL;
 		cond_resched();
 		start = end + 1;
 	}
-	return werr;
+	return ret;
 }
 
 /*
-- 
2.41.0


  parent reply	other threads:[~2024-04-18  7:09 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-18  7:08 [PATCH v2 00/11] part2 trivial adjustments for return variable coding style Anand Jain
2024-04-18  7:08 ` [PATCH v2 01/11] btrfs: btrfs_cleanup_fs_roots handle ret variable Anand Jain
2024-04-19 16:51   ` David Sterba
2024-04-18  7:08 ` Anand Jain [this message]
2024-04-18  7:08 ` [PATCH v2 03/11] btrfs: __btrfs_wait_marked_extents rename werr and err to ret Anand Jain
2024-04-18  7:08 ` [PATCH v2 04/11] btrfs: build_backref_tree rename err and ret " Anand Jain
2024-04-18  7:08 ` [PATCH v2 05/11] btrfs: relocate_tree_blocks reuse ret instead of err Anand Jain
2024-04-18  7:08 ` [PATCH v2 06/11] btrfs: btrfs_recover_relocation rename ret to ret2 and err to ret Anand Jain
2024-04-19 17:12   ` David Sterba
2024-04-18  7:08 ` [PATCH v2 07/11] btrfs: quick_update_accounting drop variable err Anand Jain
2024-04-18  7:08 ` [PATCH v2 08/11] btrfs: btrfs_qgroup_rescan_worker rename ret to ret2 and err to ret Anand Jain
2024-04-18  7:08 ` [PATCH v2 09/11] btrfs: lookup_extent_data_ref code optimize return Anand Jain
2024-04-18  7:08 ` [PATCH v2 10/11] btrfs: btrfs_drop_snapshot optimize return variable Anand Jain
2024-04-19 17:23   ` David Sterba
2024-04-18  7:08 ` [PATCH v2 11/11] btrfs: btrfs_drop_subtree " Anand Jain
2024-04-19 17:25 ` [PATCH v2 00/11] part2 trivial adjustments for return variable coding style David Sterba

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=5ad8b149fbf1f24b3610fc129b24b85196213ec4.1713370756.git.anand.jain@oracle.com \
    --to=anand.jain@oracle.com \
    --cc=josef@toxicpanda.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.