Skip to content

Commit 0f2bc22

Browse files
fdmananakdave
authored andcommitted
btrfs: simplify error return logic when getting folio at prepare_one_folio()
There's no need to have special logic to return -EAGAIN in case the call to __filemap_get_folio() fails, because when FGP_NOWAIT is passed to __filemap_get_folio() it returns ERR_PTR(-EAGAIN) if it needs to do something that would imply blocking. The reason we have this logic is from the days before we migrated to the folio interface, when we called pagecache_get_page() which would return NULL instead of an error pointer. So remove this special casing and always return the error that the call to __filemap_get_folio() returned. Reviewed-by: Johannes Thumshirn <[email protected]> Reviewed-by: Qu Wenruo <[email protected]> Signed-off-by: Filipe Manana <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 443e4d0 commit 0f2bc22

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

fs/btrfs/file.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -866,13 +866,9 @@ static noinline int prepare_one_folio(struct inode *inode, struct folio **folio_
866866

867867
again:
868868
folio = __filemap_get_folio(inode->i_mapping, index, fgp_flags, mask);
869-
if (IS_ERR(folio)) {
870-
if (nowait)
871-
ret = -EAGAIN;
872-
else
873-
ret = PTR_ERR(folio);
874-
return ret;
875-
}
869+
if (IS_ERR(folio))
870+
return PTR_ERR(folio);
871+
876872
ret = set_folio_extent_mapped(folio);
877873
if (ret < 0) {
878874
folio_unlock(folio);

0 commit comments

Comments
 (0)