Message ID | 20190502233332.28720-3-hch@lst.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [1/8] block: move the BIO_NO_PAGE_REF check into bio_release_pages | expand |
On 3.05.19 г. 2:33 ч., Christoph Hellwig wrote: > Use bio_release_pages and bio_set_pages_dirty instead of open coding > them. > > Signed-off-by: Christoph Hellwig <hch@lst.de> > --- > block/bio.c | 22 +++------------------- > 1 file changed, 3 insertions(+), 19 deletions(-) > > diff --git a/block/bio.c b/block/bio.c > index 96ddffa49881..a6862b954350 100644 > --- a/block/bio.c > +++ b/block/bio.c > @@ -1445,24 +1445,6 @@ struct bio *bio_map_user_iov(struct request_queue *q, > return ERR_PTR(ret); > } > > -static void __bio_unmap_user(struct bio *bio) > -{ > - struct bio_vec *bvec; > - struct bvec_iter_all iter_all; > - > - /* > - * make sure we dirty pages we wrote to > - */ > - bio_for_each_segment_all(bvec, bio, iter_all) { > - if (bio_data_dir(bio) == READ) > - set_page_dirty_lock(bvec->bv_page); > - > - put_page(bvec->bv_page); > - } > - > - bio_put(bio); > -} > - > /** > * bio_unmap_user - unmap a bio > * @bio: the bio being unmapped > @@ -1474,7 +1456,9 @@ static void __bio_unmap_user(struct bio *bio) > */ > void bio_unmap_user(struct bio *bio) > { > - __bio_unmap_user(bio); > + bio_set_pages_dirty(bio); Doesn't this need to be : if (bio_data_dir(bio) == READ) bio_set_pages_dirty() > + bio_release_pages(bio); > + bio_put(bio); > bio_put(bio); > } > >
On Fri, May 03, 2019 at 09:50:08AM +0300, Nikolay Borisov wrote: > > @@ -1474,7 +1456,9 @@ static void __bio_unmap_user(struct bio *bio) > > */ > > void bio_unmap_user(struct bio *bio) > > { > > - __bio_unmap_user(bio); > > + bio_set_pages_dirty(bio); > > Doesn't this need to be : > > if (bio_data_dir(bio) == READ) > bio_set_pages_dirty() Yes, indeed.
diff --git a/block/bio.c b/block/bio.c index 96ddffa49881..a6862b954350 100644 --- a/block/bio.c +++ b/block/bio.c @@ -1445,24 +1445,6 @@ struct bio *bio_map_user_iov(struct request_queue *q, return ERR_PTR(ret); } -static void __bio_unmap_user(struct bio *bio) -{ - struct bio_vec *bvec; - struct bvec_iter_all iter_all; - - /* - * make sure we dirty pages we wrote to - */ - bio_for_each_segment_all(bvec, bio, iter_all) { - if (bio_data_dir(bio) == READ) - set_page_dirty_lock(bvec->bv_page); - - put_page(bvec->bv_page); - } - - bio_put(bio); -} - /** * bio_unmap_user - unmap a bio * @bio: the bio being unmapped @@ -1474,7 +1456,9 @@ static void __bio_unmap_user(struct bio *bio) */ void bio_unmap_user(struct bio *bio) { - __bio_unmap_user(bio); + bio_set_pages_dirty(bio); + bio_release_pages(bio); + bio_put(bio); bio_put(bio); }
Use bio_release_pages and bio_set_pages_dirty instead of open coding them. Signed-off-by: Christoph Hellwig <hch@lst.de> --- block/bio.c | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-)