]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
btrfs: remove dead assignment in prepare_one_folio()
authorMassimiliano Pellizzer <mpellizzer.dev@gmail.com>
Thu, 4 Dec 2025 21:09:59 +0000 (22:09 +0100)
committerDavid Sterba <dsterba@suse.com>
Tue, 3 Feb 2026 05:38:33 +0000 (06:38 +0100)
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.

Signed-off-by: Massimiliano Pellizzer <mpellizzer.dev@gmail.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/file.c

index 1abc7ed2990e0e956dc0550cba8b0cfc90109e65..87425a2430402fa9ff28e0761494467947d3f67a 100644 (file)
@@ -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);
@@ -876,10 +876,8 @@ again:
        if (ret) {
                /* The folio is already unlocked. */
                folio_put(folio);
-               if (!nowait && ret == -EAGAIN) {
-                       ret = 0;
+               if (!nowait && ret == -EAGAIN)
                        goto again;
-               }
                return ret;
        }
        *folio_ret = folio;