SCSI: Add SG_GET_SG_MAX_SEGMENT_SIZE ioctl to sg device
Subsystems (2)
PATCH 1/1 SCSI: Add SG_GET_SG_MAX_SEGMENT_SIZE ioctl to sg device
Add a new ioctl cmd to get the max segment size. It's useful in virtualization environment for guest to know the queue limits, so that the guest kicks off legal scsi command to a sg device.
--- drivers/scsi/sg.c | 2 ++ include/scsi/sg.h | 3 +++ 2 files changed, 5 insertions(+), 0 deletions(-)
drivers/scsi/sg.c +2 -0
@@ -913,6 +913,8 @@ sg_ioctl(struct file *filp, unsigned int cmd_in, unsigned long arg)return put_user (val, ip);case SG_GET_SG_TABLESIZE :return put_user (sdp->sg_tablesize, ip); +case SG_GET_SG_MAX_SEGMENT_SIZE : +return put_user (queue_max_segment_size (sdp->device->request_queue), ip);case SG_SET_RESERVED_SIZE : result =get_user (val, ip);if (result)
include/scsi/sg.h +3 -0
@@ -200,6 +200,9 @@ typedef struct sg_req_info { /* used by SG_GET_REQUEST_TABLE ioctl() *//* Yields max scatter gather tablesize allowed by current host adapter */ #define SG_GET_SG_TABLESIZE 0x227F/* 0 implies can't do scatter gather */ +/* Yidld max size of scatter gather element by current host adapter */ +#define SG_GET_SG_MAX_SEGMENT_SIZE 0x2280 +#define SG_GET_VERSION_NUM 0x2282/* Example: version 2.1.34 yields 20134 */ /* Returns -EBUSY if occupied. 3rd argument pointer to int (see next) */
Signature · 1 line
1.7.7.6
James Bottomley
maintainerQuoted 3 lines · Cong Meng
Add a new ioctl cmd to get the max segment size. It's useful in virtualization environment for guest to know the queue limits, so that the guest kicks off legal scsi command to a sg device.
What's wrong with simply looking in the /sys for this? Plus, if you can come up with a justifiable reason, this needs to be in block as well so we can send it to all SCSI devices regardless of what ULD people use.
James
Quoted 6 lines · James Bottomley
Quoted 3 lines · Cong Meng
Add a new ioctl cmd to get the max segment size. It's useful in virtualization environment for guest to know the queue limits, so that the guest kicks off legal scsi command to a sg device.
What's wrong with simply looking in the /sys for this? Plus, if you can
Adding this ioctl is a big convenience for the programs, qemu in my case, to which parameter that likes '/dev/sgX' is given. With this ioctl, those programs only need to issue an ioctl to get the queue limit. Otherwise, 'dev/sgX' is needed to convert to /sys path, then open and read it.
In addition, the potential variation and exceptional situation of sys FS, EX mount path, are needed to consider as well. Is my justification acceptable?
Quoted 2 lines
come up with a justifiable reason, this needs to be in block as well so we can send it to all SCSI devices regardless of what ULD people use.
I can do it.
Thanks.
Cong.
Quoted 4 lines
James
James Bottomley
maintainerQuoted 6 lines · Cong Meng
Quoted 5 lines · James Bottomley
Quoted 3 lines · Cong Meng
Add a new ioctl cmd to get the max segment size. It's useful in virtualization environment for guest to know the queue limits, so that the guest kicks off legal scsi command to a sg device.
Quoted 6 lines
Quoted 1 line
What's wrong with simply looking in the /sys for this? Plus, if you can
Adding this ioctl is a big convenience for the programs, qemu in my case, to which parameter that likes '
/dev/sgX' is given. With this ioctl, those programs only need to issue an ioctl to get the queue limit.
I don't need to know why you need the information, I accept that it's useful
Quoted 2 lines
Otherwise, 'dev/sgX' is needed to convert
to /sys path, then open and read it.
Well, yes, what's the problem?
Quoted 3 lines
In addition, the potential variation and exceptional situation of sys FS, EX mount path, are needed to consider as well. Is my justification acceptable?
No. I need to know why you can't get it out of sysfs. We put a whole lot of stuff into sysfs to avoid the need to add extra ioctls. There need to be a really good reason why /sys doesn't work.
James
Quoted 16 lines
Quoted 2 lines
come up with a justifiable reason, this needs to be in block as well so we can send it to all SCSI devices regardless of what ULD people use.
I can do it.
Thanks.
Cong.Quoted 4 lines
James
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html