mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 10:41:38 -04:00
block: move the BIO_NO_PAGE_REF check into bio_release_pages
Move the BIO_NO_PAGE_REF check into bio_release_pages instead of duplicating it in both callers. Also make the function available outside of bio.c so that we can reuse it in other direct I/O implementations. Reviewed-by: Minwoo Im <[email protected]> Reviewed-by: Johannes Thumshirn <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
This commit is contained in:
parent
5f2ab0c1c8
commit
b2d0d99135
2 changed files with 7 additions and 5 deletions
11
block/bio.c
11
block/bio.c
|
|
@ -845,11 +845,14 @@ static void bio_get_pages(struct bio *bio)
|
|||
get_page(bvec->bv_page);
|
||||
}
|
||||
|
||||
static void bio_release_pages(struct bio *bio)
|
||||
void bio_release_pages(struct bio *bio)
|
||||
{
|
||||
struct bvec_iter_all iter_all;
|
||||
struct bio_vec *bvec;
|
||||
|
||||
if (bio_flagged(bio, BIO_NO_PAGE_REF))
|
||||
return;
|
||||
|
||||
bio_for_each_segment_all(bvec, bio, iter_all)
|
||||
put_page(bvec->bv_page);
|
||||
}
|
||||
|
|
@ -1681,8 +1684,7 @@ static void bio_dirty_fn(struct work_struct *work)
|
|||
next = bio->bi_private;
|
||||
|
||||
bio_set_pages_dirty(bio);
|
||||
if (!bio_flagged(bio, BIO_NO_PAGE_REF))
|
||||
bio_release_pages(bio);
|
||||
bio_release_pages(bio);
|
||||
bio_put(bio);
|
||||
}
|
||||
}
|
||||
|
|
@ -1698,8 +1700,7 @@ void bio_check_pages_dirty(struct bio *bio)
|
|||
goto defer;
|
||||
}
|
||||
|
||||
if (!bio_flagged(bio, BIO_NO_PAGE_REF))
|
||||
bio_release_pages(bio);
|
||||
bio_release_pages(bio);
|
||||
bio_put(bio);
|
||||
return;
|
||||
defer:
|
||||
|
|
|
|||
Loading…
Reference in a new issue