aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPankaj Raghav <[email protected]>2023-04-11 14:29:20 +0200
committerAndrew Morton <[email protected]>2023-04-18 16:30:02 -0700
commit09a607c9cd23d9521e7be3ab5eb94f217d7a37f5 (patch)
tree9eff2836a10703bb6afdc811a278bc530e5caf1c
parentf0d6ca46d68670d04a43116fe07309643bac596e (diff)
mpage: use folios in bio end_io handler
Use folios in the bio end_io handler. This conversion does the appropriate handling on the folios in the respective end_io callback and removes the call to page_endio(), which is soon to be removed. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Pankaj Raghav <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Cc: Alexander Viro <[email protected]> Cc: Christian Brauner <[email protected]> Cc: Jens Axboe <[email protected]> Cc: Luis Chamberlain <[email protected]> Cc: Martin Brandenburg <[email protected]> Cc: Matthew Wilcox (Oracle) <[email protected]> Cc: Mike Marshall <[email protected]> Cc: Minchan Kim <[email protected]> Cc: Sergey Senozhatsky <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
-rw-r--r--fs/mpage.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/fs/mpage.c b/fs/mpage.c
index d9540c1b7427..242e213ee064 100644
--- a/fs/mpage.c
+++ b/fs/mpage.c
@@ -45,24 +45,32 @@
*/
static void mpage_read_end_io(struct bio *bio)
{
- struct bio_vec *bv;
- struct bvec_iter_all iter_all;
-
- bio_for_each_segment_all(bv, bio, iter_all)
- page_endio(bv->bv_page, REQ_OP_READ,
- blk_status_to_errno(bio->bi_status));
+ struct folio_iter fi;
+ int err = blk_status_to_errno(bio->bi_status);
+
+ bio_for_each_folio_all(fi, bio) {
+ if (err)
+ folio_set_error(fi.folio);
+ else
+ folio_mark_uptodate(fi.folio);
+ folio_unlock(fi.folio);
+ }
bio_put(bio);
}
static void mpage_write_end_io(struct bio *bio)
{
- struct bio_vec *bv;
- struct bvec_iter_all iter_all;
+ struct folio_iter fi;
+ int err = blk_status_to_errno(bio->bi_status);
- bio_for_each_segment_all(bv, bio, iter_all)
- page_endio(bv->bv_page, REQ_OP_WRITE,
- blk_status_to_errno(bio->bi_status));
+ bio_for_each_folio_all(fi, bio) {
+ if (err) {
+ folio_set_error(fi.folio);
+ mapping_set_error(fi.folio->mapping, err);
+ }
+ folio_end_writeback(fi.folio);
+ }
bio_put(bio);
}