Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: mlin@kernel.org (Ming Lin)
Subject: [PATCH v2 2/4] block: add offset in blk_add_request_payload()
Date: Tue, 22 Mar 2016 00:24:44 -0700	[thread overview]
Message-ID: <1458631486-14120-3-git-send-email-mlin@kernel.org> (raw)
In-Reply-To: <1458631486-14120-1-git-send-email-mlin@kernel.org>

From: Ming Lin <ming.l@ssi.samsung.com>

We could kmalloc() the payload, so need the offset in page.

Signed-off-by: Ming Lin <ming.l at ssi.samsung.com>
---
 block/blk-core.c         | 5 +++--
 drivers/block/skd_main.c | 2 +-
 drivers/scsi/sd.c        | 2 +-
 include/linux/blkdev.h   | 2 +-
 4 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/block/blk-core.c b/block/blk-core.c
index 47e9f27..f320c38 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -1523,6 +1523,7 @@ EXPORT_SYMBOL(blk_put_request);
  * blk_add_request_payload - add a payload to a request
  * @rq: request to update
  * @page: page backing the payload
+ * @offset: offset in page
  * @len: length of the payload.
  *
  * This allows to later add a payload to an already submitted request by
@@ -1533,12 +1534,12 @@ EXPORT_SYMBOL(blk_put_request);
  * discard requests should ever use it.
  */
 void blk_add_request_payload(struct request *rq, struct page *page,
-		unsigned int len)
+		int offset, unsigned int len)
 {
 	struct bio *bio = rq->bio;
 
 	bio->bi_io_vec->bv_page = page;
-	bio->bi_io_vec->bv_offset = 0;
+	bio->bi_io_vec->bv_offset = offset;
 	bio->bi_io_vec->bv_len = len;
 
 	bio->bi_iter.bi_size = len;
diff --git a/drivers/block/skd_main.c b/drivers/block/skd_main.c
index 586f916..9a9ec21 100644
--- a/drivers/block/skd_main.c
+++ b/drivers/block/skd_main.c
@@ -562,7 +562,7 @@ skd_prep_discard_cdb(struct skd_scsi_request *scsi_req,
 	put_unaligned_be32(count, &buf[16]);
 
 	req = skreq->req;
-	blk_add_request_payload(req, page, len);
+	blk_add_request_payload(req, page, 0, len);
 }
 
 static void skd_request_fn_not_online(struct request_queue *q);
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index d749da7..a4b927c2 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -779,7 +779,7 @@ static int sd_setup_discard_cmnd(struct scsi_cmnd *cmd)
 	 * discarded on disk. This allows us to report completion on the full
 	 * amount of blocks described by the request.
 	 */
-	blk_add_request_payload(rq, page, len);
+	blk_add_request_payload(rq, page, 0, len);
 	ret = scsi_init_io(cmd);
 	rq->__data_len = nr_bytes;
 
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 413c84f..121eebc 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -778,7 +778,7 @@ extern struct request *blk_make_request(struct request_queue *, struct bio *,
 extern void blk_rq_set_block_pc(struct request *);
 extern void blk_requeue_request(struct request_queue *, struct request *);
 extern void blk_add_request_payload(struct request *rq, struct page *page,
-		unsigned int len);
+		int offset, unsigned int len);
 extern int blk_lld_busy(struct request_queue *q);
 extern int blk_rq_prep_clone(struct request *rq, struct request *rq_src,
 			     struct bio_set *bs, gfp_t gfp_mask,
-- 
1.9.1

  parent reply	other threads:[~2016-03-22  7:24 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-22  7:24 [PATCH v2 0/4] rewrites discard support Ming Lin
2016-03-22  7:24 ` [PATCH v2 1/4] nvme: add helper nvme_map_len() Ming Lin
2016-03-22  7:31   ` Christoph Hellwig
2016-03-22  7:24 ` Ming Lin [this message]
2016-03-22  7:31   ` [PATCH v2 2/4] block: add offset in blk_add_request_payload() Christoph Hellwig
2016-03-22  7:24 ` [PATCH v2 3/4] nvme: rewrite discard support Ming Lin
2016-03-22  7:37   ` Christoph Hellwig
2016-03-22  7:24 ` [PATCH v2 4/4] nvme: add helper nvme_setup_cmd() Ming Lin
2016-03-22  7:38   ` Christoph Hellwig
2016-03-22 20:40 ` [PATCH v2 0/4] rewrites discard support Keith Busch
2016-03-22 20:50 ` 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=1458631486-14120-3-git-send-email-mlin@kernel.org \
    --to=mlin@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox