From: Massimiliano Pellizzer <mpellizzer.dev@gmail.com>
To: clm@fb.com, dsterba@suse.com
Cc: linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org,
Massimiliano Pellizzer <mpellizzer.dev@gmail.com>
Subject: [PATCH v2] btrfs: remove dead assignment in prepare_one_folio()
Date: Thu, 4 Dec 2025 22:09:59 +0100 [thread overview]
Message-ID: <20251204210959.9672-1-mpellizzer.dev@gmail.com> (raw)
In prepare_one_folio(), ret is initialized to 0 at declaration,
and in an error path we assign ret = 0 before jumping to the
again label to retry the operation. However, ret is immediately
overwritten by ret = set_folio_extent_mapped(folio) after the
again label.
Both assignments are never observed by any code path,
therefore they can be safely removed.
No functional change.
Signed-off-by: Massimiliano Pellizzer <mpellizzer.dev@gmail.com>
---
v2: Remove also the initial ret = 0 assignment for consistency
fs/btrfs/file.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 7a501e73d880..9e2c2f2cd03f 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -859,7 +859,7 @@ static noinline int prepare_one_folio(struct inode *inode, struct folio **folio_
fgf_t fgp_flags = (nowait ? FGP_WRITEBEGIN | FGP_NOWAIT : FGP_WRITEBEGIN) |
fgf_set_order(write_bytes);
struct folio *folio;
- int ret = 0;
+ int ret;
again:
folio = __filemap_get_folio(inode->i_mapping, index, fgp_flags, mask);
@@ -877,7 +877,6 @@ static noinline int prepare_one_folio(struct inode *inode, struct folio **folio_
/* The folio is already unlocked. */
folio_put(folio);
if (!nowait && ret == -EAGAIN) {
- ret = 0;
goto again;
}
return ret;
--
2.51.0
next reply other threads:[~2025-12-04 21:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-04 21:09 Massimiliano Pellizzer [this message]
2025-12-12 3:26 ` [PATCH v2] btrfs: remove dead assignment in prepare_one_folio() 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=20251204210959.9672-1-mpellizzer.dev@gmail.com \
--to=mpellizzer.dev@gmail.com \
--cc=clm@fb.com \
--cc=dsterba@suse.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@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