mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
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/20230411122920.30134-4-p.raghav@samsung.com Signed-off-by: Pankaj Raghav <p.raghav@samsung.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Cc: Alexander Viro <viro@zeniv.linux.org.uk> Cc: Christian Brauner <brauner@kernel.org> Cc: Jens Axboe <axboe@kernel.dk> Cc: Luis Chamberlain <mcgrof@kernel.org> Cc: Martin Brandenburg <martin@omnibond.com> Cc: Matthew Wilcox (Oracle) <willy@infradead.org> Cc: Mike Marshall <hubcap@omnibond.com> Cc: Minchan Kim <minchan@kernel.org> Cc: Sergey Senozhatsky <senozhatsky@chromium.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
f0d6ca46d6
commit
09a607c9cd
1 changed files with 18 additions and 10 deletions
28
fs/mpage.c
28
fs/mpage.c
|
@ -45,24 +45,32 @@
|
||||||
*/
|
*/
|
||||||
static void mpage_read_end_io(struct bio *bio)
|
static void mpage_read_end_io(struct bio *bio)
|
||||||
{
|
{
|
||||||
struct bio_vec *bv;
|
struct folio_iter fi;
|
||||||
struct bvec_iter_all iter_all;
|
int err = blk_status_to_errno(bio->bi_status);
|
||||||
|
|
||||||
bio_for_each_segment_all(bv, bio, iter_all)
|
bio_for_each_folio_all(fi, bio) {
|
||||||
page_endio(bv->bv_page, REQ_OP_READ,
|
if (err)
|
||||||
blk_status_to_errno(bio->bi_status));
|
folio_set_error(fi.folio);
|
||||||
|
else
|
||||||
|
folio_mark_uptodate(fi.folio);
|
||||||
|
folio_unlock(fi.folio);
|
||||||
|
}
|
||||||
|
|
||||||
bio_put(bio);
|
bio_put(bio);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mpage_write_end_io(struct bio *bio)
|
static void mpage_write_end_io(struct bio *bio)
|
||||||
{
|
{
|
||||||
struct bio_vec *bv;
|
struct folio_iter fi;
|
||||||
struct bvec_iter_all iter_all;
|
int err = blk_status_to_errno(bio->bi_status);
|
||||||
|
|
||||||
bio_for_each_segment_all(bv, bio, iter_all)
|
bio_for_each_folio_all(fi, bio) {
|
||||||
page_endio(bv->bv_page, REQ_OP_WRITE,
|
if (err) {
|
||||||
blk_status_to_errno(bio->bi_status));
|
folio_set_error(fi.folio);
|
||||||
|
mapping_set_error(fi.folio->mapping, err);
|
||||||
|
}
|
||||||
|
folio_end_writeback(fi.folio);
|
||||||
|
}
|
||||||
|
|
||||||
bio_put(bio);
|
bio_put(bio);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue