Matthew Wilcox wrote: > Use the noop elevator by default for drives that do not spin > <snip> > I've brazenly stolen sd_vpd_inquiry from mkp's patch here: > > http://marc.info/?l=linux-scsi&m=121264354724277&w=2 > > No need to have two copies of that ... but this will conflict with his code. > <snip> > I think there's an opportunity to improve sd_vpd_inquiry() to remove > some of the duplicate code between sd_set_elevator() and sd_block_limits, > but it's not terribly important. > <snip> > Not-signed-off-by: Matthew Wilcox <willy@xxxxxxxxxxxxxxx> > > diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c > index 01cefbb..1c5a296 100644 > --- a/drivers/scsi/sd.c > +++ b/drivers/scsi/sd.c > @@ -1534,6 +1534,79 @@ defaults: > sdkp->DPOFUA = 0; > } > > +static int sd_vpd_inquiry(struct scsi_disk *sdkp, unsigned char *buffer, u8 page, u8 len) > +{ > + int result; > + unsigned char cmd[16]; > + struct scsi_sense_hdr sshdr; > + > + memset(cmd, 0, 16); > + cmd[0] = INQUIRY; > + cmd[1] = 1; /* EVPD */ > + cmd[2] = page; /* VPD page */ > + cmd[3] = len; > + > + result = scsi_execute_req(sdkp->device, cmd, DMA_FROM_DEVICE, buffer, > + len, &sshdr, SD_TIMEOUT, SD_MAX_RETRIES); > + > + if (media_not_present(sdkp, &sshdr)) > + return -EIO; > + > + if (result) { > + sd_printk(KERN_ERR, sdkp, "EVPD Inquiry failed\n"); > + return -EIO; > + } > + > + if (buffer[1] != page) { > + sd_printk(KERN_ERR, sdkp, "Page code not %2x (%2x)\n", page, > + buffer[1]); > + return -EIO; > + } > + > + return buffer[3]; > +} I was just copy/pasting the same code into my ULD. Perhaps the low level of above could be made into a scsi_vpd_inquiry(...). From a quick search it looks like there are 3 more places that issue _vpd_inquiry in the tree today. <snip> Some of the more interesting device information are in vpd's. we should have a generic user-mode way to inquire them. sysfs structure, ioctl, I'm not sure, something good for udev. There are tones of such little knobs that could be tuned according to vpd information. Thanks for doing this, I will investigate if current iscsi-targets will immediately benefit from this too. From my testing I found that it is usually better to let the target side elevator do the work, and set the Initiator elevator to noop. Do you know what the standard say about the default value should be, in the case the page is not present. I would assume it means "No spinning media" too, right? Boaz -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html