All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org
Subject: [PATCH 2/8] block: use bio_release_pages in bio_unmap_user
Date: Thu,  2 May 2019 19:33:26 -0400	[thread overview]
Message-ID: <20190502233332.28720-3-hch@lst.de> (raw)
In-Reply-To: <20190502233332.28720-1-hch@lst.de>

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);
+	bio_release_pages(bio);
+	bio_put(bio);
 	bio_put(bio);
 }
 
-- 
2.20.1


  parent reply	other threads:[~2019-05-02 23:34 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-02 23:33 cleanup bio page releasing and fix a page leak Christoph Hellwig
2019-05-02 23:33 ` [PATCH 1/8] block: move the BIO_NO_PAGE_REF check into bio_release_pages Christoph Hellwig
2019-05-04 12:28   ` Johannes Thumshirn
2019-05-02 23:33 ` Christoph Hellwig [this message]
2019-05-03  6:50   ` [PATCH 2/8] block: use bio_release_pages in bio_unmap_user Nikolay Borisov
2019-05-03  7:20     ` Christoph Hellwig
2019-05-02 23:33 ` [PATCH 3/8] block: use bio_release_pages in bio_map_user_iov Christoph Hellwig
2019-05-04 12:31   ` Johannes Thumshirn
2019-05-02 23:33 ` [PATCH 4/8] iomap: use bio_release_pages in iomap_dio_bio_end_io Christoph Hellwig
2019-05-04 12:33   ` Johannes Thumshirn
2019-05-04 12:35     ` Johannes Thumshirn
2019-05-02 23:33 ` [PATCH 5/8] block_dev: use bio_release_pages in blkdev_bio_end_io Christoph Hellwig
2019-05-04 12:35   ` Johannes Thumshirn
2019-05-02 23:33 ` [PATCH 6/8] block_dev: use bio_release_pages in __blkdev_direct_IO_simple Christoph Hellwig
2019-05-04 17:38   ` Johannes Thumshirn
2019-05-02 23:33 ` [PATCH 7/8] direct-io: use bio_release_pages in dio_bio_complete Christoph Hellwig
2019-05-04 17:39   ` Johannes Thumshirn
2019-05-02 23:33 ` [PATCH 8/8] block: never take page references for ITER_BVEC Christoph Hellwig
2019-05-04 17:41   ` Johannes Thumshirn
2019-05-06  8:19   ` Ming Lei
2019-05-06 13:30     ` Christoph Hellwig
2019-05-07  6:09       ` Christoph Hellwig
2019-05-03 17:52 ` cleanup bio page releasing and fix a page leak Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190502233332.28720-3-hch@lst.de \
    --to=hch@lst.de \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.