linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 39/54] fs/mpage: convert to bio_for_each_segment_all_sp()
       [not found] <1482854706-14128-1-git-send-email-tom.leiming@gmail.com>
@ 2016-12-27 16:04 ` Ming Lei
  2016-12-27 16:04 ` [PATCH v1 40/54] fs/direct-io: " Ming Lei
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: Ming Lei @ 2016-12-27 16:04 UTC (permalink / raw)
  To: Jens Axboe, linux-kernel
  Cc: linux-block, Christoph Hellwig, Ming Lei, Alexander Viro,
	open list:FILESYSTEMS (VFS and infrastructure)

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
---
 fs/mpage.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/mpage.c b/fs/mpage.c
index 28af984a3d96..bd94b3dbf27e 100644
--- a/fs/mpage.c
+++ b/fs/mpage.c
@@ -46,9 +46,10 @@
 static void mpage_end_io(struct bio *bio)
 {
 	struct bio_vec *bv;
+	struct bvec_iter_all bia;
 	int i;
 
-	bio_for_each_segment_all(bv, bio, i) {
+	bio_for_each_segment_all_sp(bv, bio, i, bia) {
 		struct page *page = bv->bv_page;
 		page_endio(page, op_is_write(bio_op(bio)), bio->bi_error);
 	}
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v1 40/54] fs/direct-io: convert to bio_for_each_segment_all_sp()
       [not found] <1482854706-14128-1-git-send-email-tom.leiming@gmail.com>
  2016-12-27 16:04 ` [PATCH v1 39/54] fs/mpage: convert to bio_for_each_segment_all_sp() Ming Lei
@ 2016-12-27 16:04 ` Ming Lei
  2016-12-27 16:04 ` [PATCH v1 46/54] fs: crypto: " Ming Lei
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: Ming Lei @ 2016-12-27 16:04 UTC (permalink / raw)
  To: Jens Axboe, linux-kernel
  Cc: linux-block, Christoph Hellwig, Ming Lei, Alexander Viro,
	open list:FILESYSTEMS (VFS and infrastructure)

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
---
 fs/direct-io.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/direct-io.c b/fs/direct-io.c
index aeae8c063451..e2ecd9fbbffb 100644
--- a/fs/direct-io.c
+++ b/fs/direct-io.c
@@ -487,7 +487,9 @@ static int dio_bio_complete(struct dio *dio, struct bio *bio)
 		err = bio->bi_error;
 		bio_check_pages_dirty(bio);	/* transfers ownership */
 	} else {
-		bio_for_each_segment_all(bvec, bio, i) {
+		struct bvec_iter_all bia;
+
+		bio_for_each_segment_all_sp(bvec, bio, i, bia) {
 			struct page *page = bvec->bv_page;
 
 			if (dio->op == REQ_OP_READ && !PageCompound(page) &&
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v1 46/54] fs: crypto: convert to bio_for_each_segment_all_sp()
       [not found] <1482854706-14128-1-git-send-email-tom.leiming@gmail.com>
  2016-12-27 16:04 ` [PATCH v1 39/54] fs/mpage: convert to bio_for_each_segment_all_sp() Ming Lei
  2016-12-27 16:04 ` [PATCH v1 40/54] fs/direct-io: " Ming Lei
@ 2016-12-27 16:04 ` Ming Lei
  2016-12-27 16:04 ` [PATCH v1 48/54] fs/block_dev.c: " Ming Lei
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: Ming Lei @ 2016-12-27 16:04 UTC (permalink / raw)
  To: Jens Axboe, linux-kernel
  Cc: linux-block, Christoph Hellwig, Ming Lei, Theodore Y. Ts'o,
	Jaegeuk Kim,
	open list:FS-CRYPTO: FILE SYSTEM LEVEL ENCRYPTION SUPPORT

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
---
 fs/crypto/crypto.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/crypto/crypto.c b/fs/crypto/crypto.c
index ac8e4f6a3773..4bb1d7eff6f4 100644
--- a/fs/crypto/crypto.c
+++ b/fs/crypto/crypto.c
@@ -453,8 +453,9 @@ static void completion_pages(struct work_struct *work)
 	struct bio *bio = ctx->r.bio;
 	struct bio_vec *bv;
 	int i;
+	struct bvec_iter_all bia;
 
-	bio_for_each_segment_all(bv, bio, i) {
+	bio_for_each_segment_all_sp(bv, bio, i, bia) {
 		struct page *page = bv->bv_page;
 		int ret = fscrypt_decrypt_page(page->mapping->host, page,
 				PAGE_SIZE, 0, page->index);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v1 48/54] fs/block_dev.c: convert to bio_for_each_segment_all_sp()
       [not found] <1482854706-14128-1-git-send-email-tom.leiming@gmail.com>
                   ` (2 preceding siblings ...)
  2016-12-27 16:04 ` [PATCH v1 46/54] fs: crypto: " Ming Lei
@ 2016-12-27 16:04 ` Ming Lei
  2016-12-27 16:04 ` [PATCH v1 49/54] fs/iomap.c: " Ming Lei
  2016-12-27 16:04 ` [PATCH v1 50/54] fs/buffer.c: use bvec iterator to truncate the bio Ming Lei
  5 siblings, 0 replies; 6+ messages in thread
From: Ming Lei @ 2016-12-27 16:04 UTC (permalink / raw)
  To: Jens Axboe, linux-kernel
  Cc: linux-block, Christoph Hellwig, Ming Lei, Alexander Viro,
	open list:FILESYSTEMS (VFS and infrastructure)

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
---
 fs/block_dev.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/block_dev.c b/fs/block_dev.c
index 6254cee8f8f3..644b94460348 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -209,6 +209,7 @@ __blkdev_direct_IO_simple(struct kiocb *iocb, struct iov_iter *iter,
 	ssize_t ret;
 	blk_qc_t qc;
 	int i;
+	struct bvec_iter_all bia;
 
 	if ((pos | iov_iter_alignment(iter)) &
 	    (bdev_logical_block_size(bdev) - 1))
@@ -253,7 +254,7 @@ __blkdev_direct_IO_simple(struct kiocb *iocb, struct iov_iter *iter,
 	}
 	__set_current_state(TASK_RUNNING);
 
-	bio_for_each_segment_all(bvec, &bio, i) {
+	bio_for_each_segment_all_sp(bvec, &bio, i, bia) {
 		if (should_dirty && !PageCompound(bvec->bv_page))
 			set_page_dirty_lock(bvec->bv_page);
 		put_page(bvec->bv_page);
@@ -315,8 +316,9 @@ static void blkdev_bio_end_io(struct bio *bio)
 	} else {
 		struct bio_vec *bvec;
 		int i;
+		struct bvec_iter_all bia;
 
-		bio_for_each_segment_all(bvec, bio, i)
+		bio_for_each_segment_all_sp(bvec, bio, i, bia)
 			put_page(bvec->bv_page);
 		bio_put(bio);
 	}
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v1 49/54] fs/iomap.c: convert to bio_for_each_segment_all_sp()
       [not found] <1482854706-14128-1-git-send-email-tom.leiming@gmail.com>
                   ` (3 preceding siblings ...)
  2016-12-27 16:04 ` [PATCH v1 48/54] fs/block_dev.c: " Ming Lei
@ 2016-12-27 16:04 ` Ming Lei
  2016-12-27 16:04 ` [PATCH v1 50/54] fs/buffer.c: use bvec iterator to truncate the bio Ming Lei
  5 siblings, 0 replies; 6+ messages in thread
From: Ming Lei @ 2016-12-27 16:04 UTC (permalink / raw)
  To: Jens Axboe, linux-kernel
  Cc: linux-block, Christoph Hellwig, Ming Lei, Alexander Viro,
	open list:FILESYSTEMS (VFS and infrastructure)

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
---
 fs/iomap.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/iomap.c b/fs/iomap.c
index 354a123f170e..11da77b24599 100644
--- a/fs/iomap.c
+++ b/fs/iomap.c
@@ -698,8 +698,9 @@ static void iomap_dio_bio_end_io(struct bio *bio)
 	} else {
 		struct bio_vec *bvec;
 		int i;
+		struct bvec_iter_all bia;
 
-		bio_for_each_segment_all(bvec, bio, i)
+		bio_for_each_segment_all_sp(bvec, bio, i, bia)
 			put_page(bvec->bv_page);
 		bio_put(bio);
 	}
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v1 50/54] fs/buffer.c: use bvec iterator to truncate the bio
       [not found] <1482854706-14128-1-git-send-email-tom.leiming@gmail.com>
                   ` (4 preceding siblings ...)
  2016-12-27 16:04 ` [PATCH v1 49/54] fs/iomap.c: " Ming Lei
@ 2016-12-27 16:04 ` Ming Lei
  5 siblings, 0 replies; 6+ messages in thread
From: Ming Lei @ 2016-12-27 16:04 UTC (permalink / raw)
  To: Jens Axboe, linux-kernel
  Cc: linux-block, Christoph Hellwig, Ming Lei, Alexander Viro,
	open list:FILESYSTEMS (VFS and infrastructure)

For making multipage bvec working well.

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
---
 fs/buffer.c | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/fs/buffer.c b/fs/buffer.c
index 63d2f40c21fd..014892593f57 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -3063,8 +3063,7 @@ void guard_bio_eod(int op, struct bio *bio)
 	unsigned truncated_bytes;
 	/*
 	 * It is safe to truncate the last bvec in the following way
-	 * even though multipage bvec is supported, but we need to
-	 * fix the parameters passed to zero_user().
+	 * even though multipage bvec is supported.
 	 */
 	struct bio_vec *bvec = &bio->bi_io_vec[bio->bi_vcnt - 1];
 
@@ -3087,15 +3086,21 @@ void guard_bio_eod(int op, struct bio *bio)
 	/* Uhhuh. We've got a bio that straddles the device size! */
 	truncated_bytes = bio->bi_iter.bi_size - (maxsector << 9);
 
-	/* Truncate the bio.. */
-	bio->bi_iter.bi_size -= truncated_bytes;
-	bvec->bv_len -= truncated_bytes;
-
 	/* ..and clear the end of the buffer for reads */
 	if (op == REQ_OP_READ) {
-		zero_user(bvec->bv_page, bvec->bv_offset + bvec->bv_len,
-				truncated_bytes);
+		struct bvec_iter start = BVEC_ITER_ALL_INIT;
+		struct bvec_iter iter;
+		struct bio_vec bv;
+
+		start.bi_bvec_done = bvec->bv_len - truncated_bytes;
+
+		__bvec_for_each_sp_bvec(bv, bvec, iter, start)
+			zero_user(bv.bv_page, bv.bv_offset, bv.bv_len);
 	}
+
+	/* Truncate the bio.. */
+	bio->bi_iter.bi_size -= truncated_bytes;
+	bvec->bv_len -= truncated_bytes;
 }
 
 static int submit_bh_wbc(int op, int op_flags, struct buffer_head *bh,
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-12-27 16:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1482854706-14128-1-git-send-email-tom.leiming@gmail.com>
2016-12-27 16:04 ` [PATCH v1 39/54] fs/mpage: convert to bio_for_each_segment_all_sp() Ming Lei
2016-12-27 16:04 ` [PATCH v1 40/54] fs/direct-io: " Ming Lei
2016-12-27 16:04 ` [PATCH v1 46/54] fs: crypto: " Ming Lei
2016-12-27 16:04 ` [PATCH v1 48/54] fs/block_dev.c: " Ming Lei
2016-12-27 16:04 ` [PATCH v1 49/54] fs/iomap.c: " Ming Lei
2016-12-27 16:04 ` [PATCH v1 50/54] fs/buffer.c: use bvec iterator to truncate the bio Ming Lei

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).