Skip to content

Commit 98c7277

Browse files
m-pellizzerkdave
authored andcommitted
btrfs: remove dead assignment in prepare_one_folio()
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>
1 parent 09f5d92 commit 98c7277

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

fs/btrfs/file.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -859,7 +859,7 @@ static noinline int prepare_one_folio(struct inode *inode, struct folio **folio_
859859
fgf_t fgp_flags = (nowait ? FGP_WRITEBEGIN | FGP_NOWAIT : FGP_WRITEBEGIN) |
860860
fgf_set_order(write_bytes);
861861
struct folio *folio;
862-
int ret = 0;
862+
int ret;
863863

864864
again:
865865
folio = __filemap_get_folio(inode->i_mapping, index, fgp_flags, mask);
@@ -876,10 +876,8 @@ static noinline int prepare_one_folio(struct inode *inode, struct folio **folio_
876876
if (ret) {
877877
/* The folio is already unlocked. */
878878
folio_put(folio);
879-
if (!nowait && ret == -EAGAIN) {
880-
ret = 0;
879+
if (!nowait && ret == -EAGAIN)
881880
goto again;
882-
}
883881
return ret;
884882
}
885883
*folio_ret = folio;

0 commit comments

Comments
 (0)