* [PATCH] bsg: add large command support
@ 2008-04-30 4:16 FUJITA Tomonori
2008-04-30 13:40 ` Jens Axboe
0 siblings, 1 reply; 2+ messages in thread
From: FUJITA Tomonori @ 2008-04-30 4:16 UTC (permalink / raw)
To: linux-scsi; +Cc: James.Bottomley, bharrosh, pw, jens.axboe
This is against Linus' tree since this depends on the large command
support of the block layer, which was merged few hours ago.
This can be applied now since it doesn't depend on Boaz's variable
length CDB support though this is useful only for the variable length
CDB.
=
From: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Subject: [PATCH] bsg: add large command support
This enables bsg to handle the request length larger than BLK_MAX_CDB
(mainly for the variable length CDB format).
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Boaz Harrosh <bharrosh@panasas.com>
Cc: Pete Wyckoff <pw@osc.edu>
Cc: Jens Axboe <jens.axboe@oracle.com>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
---
block/bsg.c | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/block/bsg.c b/block/bsg.c
index 23ea4fd..d8b889d 100644
--- a/block/bsg.c
+++ b/block/bsg.c
@@ -174,7 +174,11 @@ unlock:
static int blk_fill_sgv4_hdr_rq(struct request_queue *q, struct request *rq,
struct sg_io_v4 *hdr, int has_write_perm)
{
- memset(rq->cmd, 0, BLK_MAX_CDB); /* ATAPI hates garbage after CDB */
+ if (hdr->request_len > BLK_MAX_CDB) {
+ rq->cmd = kzalloc(hdr->request_len, GFP_KERNEL);
+ if (!rq->cmd)
+ return -ENOMEM;
+ }
if (copy_from_user(rq->cmd, (void *)(unsigned long)hdr->request,
hdr->request_len))
@@ -211,8 +215,6 @@ bsg_validate_sgv4_hdr(struct request_queue *q, struct sg_io_v4 *hdr, int *rw)
if (hdr->guard != 'Q')
return -EINVAL;
- if (hdr->request_len > BLK_MAX_CDB)
- return -EINVAL;
if (hdr->dout_xfer_len > (q->max_sectors << 9) ||
hdr->din_xfer_len > (q->max_sectors << 9))
return -EIO;
@@ -302,6 +304,8 @@ bsg_map_hdr(struct bsg_device *bd, struct sg_io_v4 *hdr)
}
return rq;
out:
+ if (rq->cmd != rq->__cmd)
+ kfree(rq->cmd);
blk_put_request(rq);
if (next_rq) {
blk_rq_unmap_user(next_rq->bio);
@@ -455,6 +459,8 @@ static int blk_complete_sgv4_hdr_rq(struct request *rq, struct sg_io_v4 *hdr,
ret = rq->errors;
blk_rq_unmap_user(bio);
+ if (rq->cmd != rq->__cmd)
+ kfree(rq->cmd);
blk_put_request(rq);
return ret;
--
1.5.4.2
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] bsg: add large command support
2008-04-30 4:16 [PATCH] bsg: add large command support FUJITA Tomonori
@ 2008-04-30 13:40 ` Jens Axboe
0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2008-04-30 13:40 UTC (permalink / raw)
To: FUJITA Tomonori; +Cc: linux-scsi, James.Bottomley, bharrosh, pw
On Wed, Apr 30 2008, FUJITA Tomonori wrote:
> This is against Linus' tree since this depends on the large command
> support of the block layer, which was merged few hours ago.
>
> This can be applied now since it doesn't depend on Boaz's variable
> length CDB support though this is useful only for the variable length
> CDB.
>
> =
> From: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
> Subject: [PATCH] bsg: add large command support
>
> This enables bsg to handle the request length larger than BLK_MAX_CDB
> (mainly for the variable length CDB format).
>
> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
> Cc: Boaz Harrosh <bharrosh@panasas.com>
> Cc: Pete Wyckoff <pw@osc.edu>
> Cc: Jens Axboe <jens.axboe@oracle.com>
> Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
> ---
> block/bsg.c | 12 +++++++++---
> 1 files changed, 9 insertions(+), 3 deletions(-)
Acked-by: Jens Axboe <jens.axboe@oracle.com>
--
Jens Axboe
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-04-30 13:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-30 4:16 [PATCH] bsg: add large command support FUJITA Tomonori
2008-04-30 13:40 ` Jens Axboe
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.