All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boaz Harrosh <bharrosh@panasas.com>
To: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>,
	linux-scsi <linux-scsi@vger.kernel.org>,
	open-osd mailing-list <osd-dev@open-osd.org>
Subject: support of sg_iovec in bsg's struct sg_io_v4
Date: Wed, 14 Jan 2009 20:01:07 +0200	[thread overview]
Message-ID: <496E2863.40103@panasas.com> (raw)

Is below just missing or is there something I do not understand?

It looks like the conversion from struct sg_io_hdr to struct sg_io_v4 the use
of sg_iovec was dropped. Even though all the members and code comments
say it is the same.

This adds the support in bsg and struct sg_io_v4 exactly in the same way
it was done in sg with struct sg_io_hdr.

BTW why is the ioctl SG_IO defined exactly the same for sg.c and bsg.c
even though they have none compatible API/ABI? Is that because we have the
protection of the first __s32 member that is 'Q' for bsg and 'S' or 0 for
sg? Is that usually done with ioctl's?

Not-signed-or-tested: Boaz Harrosh <bharrosh@panasas.com>
---
git diff --stat -p block/bsg.c
 block/bsg.c |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/block/bsg.c b/block/bsg.c
index d414bb5..1489458 100644
--- a/block/bsg.c
+++ b/block/bsg.c
@@ -285,8 +285,13 @@ bsg_map_hdr(struct bsg_device *bd, struct sg_io_v4 *hdr, fmode_t has_write_perm)
 		next_rq->cmd_type = rq->cmd_type;
 
 		dxferp = (void*)(unsigned long)hdr->din_xferp;
-		ret =  blk_rq_map_user(q, next_rq, NULL, dxferp,
-				       hdr->din_xfer_len, GFP_KERNEL);
+		if (hdr->din_iovec_count)
+			ret = blk_rq_map_user_iov(q, next_rq, NULL, dxferp,
+						  hdr->din_iovec_count,
+						  hdr->din_xfer_len, GFP_KERNEL);
+		else
+			ret =  blk_rq_map_user(q, next_rq, NULL, dxferp,
+					       hdr->din_xfer_len, GFP_KERNEL);
 		if (ret)
 			goto out;
 	}
@@ -301,8 +306,13 @@ bsg_map_hdr(struct bsg_device *bd, struct sg_io_v4 *hdr, fmode_t has_write_perm)
 		dxfer_len = 0;
 
 	if (dxfer_len) {
-		ret = blk_rq_map_user(q, rq, NULL, dxferp, dxfer_len,
-				      GFP_KERNEL);
+		if (hdr->dout_iovec_count)
+			ret = blk_rq_map_user_iov(q, rq, NULL, dxferp,
+						  hdr->dout_iovec_count,
+						  dxfer_len, GFP_KERNEL);
+		else
+			ret = blk_rq_map_user(q, rq, NULL, dxferp, dxfer_len,
+					      GFP_KERNEL);
 		if (ret)
 			goto out;
 	}

             reply	other threads:[~2009-01-14 18:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-14 18:01 Boaz Harrosh [this message]
2009-01-15  5:58 ` support of sg_iovec in bsg's struct sg_io_v4 FUJITA Tomonori

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=496E2863.40103@panasas.com \
    --to=bharrosh@panasas.com \
    --cc=fujita.tomonori@lab.ntt.co.jp \
    --cc=linux-scsi@vger.kernel.org \
    --cc=osd-dev@open-osd.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.