* support of sg_iovec in bsg's struct sg_io_v4
@ 2009-01-14 18:01 Boaz Harrosh
2009-01-15 5:58 ` FUJITA Tomonori
0 siblings, 1 reply; 2+ messages in thread
From: Boaz Harrosh @ 2009-01-14 18:01 UTC (permalink / raw)
To: FUJITA Tomonori, linux-scsi, open-osd mailing-list
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;
}
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: support of sg_iovec in bsg's struct sg_io_v4
2009-01-14 18:01 support of sg_iovec in bsg's struct sg_io_v4 Boaz Harrosh
@ 2009-01-15 5:58 ` FUJITA Tomonori
0 siblings, 0 replies; 2+ messages in thread
From: FUJITA Tomonori @ 2009-01-15 5:58 UTC (permalink / raw)
To: bharrosh; +Cc: fujita.tomonori, linux-scsi, osd-dev
On Wed, 14 Jan 2009 20:01:07 +0200
Boaz Harrosh <bharrosh@panasas.com> wrote:
> 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.
It's intentional. It has been discussed several times on linux-scsi.
> 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.
sg_io_v4 will not support sg_iovec.
> 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?
I don't know if it's common or not. But we did the same thing with sg
v2 and sg v3's read/write interface.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-01-15 5:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-14 18:01 support of sg_iovec in bsg's struct sg_io_v4 Boaz Harrosh
2009-01-15 5:58 ` FUJITA Tomonori
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).