summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-06-22 09:02:11 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-06-22 09:02:11 -0400
commitb22d823033d4b75108a50d710677d8b97cc4aa15 (patch)
treebecc34b39128233b6e57e7b5c5a701a0a20061c2
parentc25d76bec84288b62e6f5484e9955f3201b7922b (diff)
bcachefs: fs-io.c: dio write path: use bio_release_pages()
bio_release_pages() handles the BIO_NO_PAGE_REF check. Also, iterating over/releasing _folios_ was incorrect, we need to match how bio_iov_iter_get_pages() got the refs - single pages or folios. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r--fs/bcachefs/fs-io.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/fs/bcachefs/fs-io.c b/fs/bcachefs/fs-io.c
index f1588c4c03bc..181bdee46941 100644
--- a/fs/bcachefs/fs-io.c
+++ b/fs/bcachefs/fs-io.c
@@ -2497,12 +2497,7 @@ static __always_inline void bch2_dio_write_end(struct dio_write *dio)
mutex_unlock(&inode->ei_quota_lock);
}
- if (likely(!bio_flagged(bio, BIO_NO_PAGE_REF))) {
- struct folio_iter fi;
-
- bio_for_each_folio_all(fi, bio)
- folio_put(fi.folio);
- }
+ bio_release_pages(bio, false);
if (unlikely(dio->op.error))
set_bit(EI_INODE_ERROR, &inode->ei_flags);
@@ -2621,12 +2616,7 @@ out:
err:
dio->op.error = ret;
- if (!bio_flagged(bio, BIO_NO_PAGE_REF)) {
- struct folio_iter fi;
-
- bio_for_each_folio_all(fi, bio)
- folio_put(fi.folio);
- }
+ bio_release_pages(bio, false);
bch2_quota_reservation_put(c, inode, &dio->quota_res);
goto out;