* [PATCH] update ipr to use the change_queue_depth API
@ 2004-12-23 21:19 James Bottomley
2004-12-28 16:54 ` Brian King
0 siblings, 1 reply; 2+ messages in thread
From: James Bottomley @ 2004-12-23 21:19 UTC (permalink / raw)
To: Brian King; +Cc: SCSI Mailing List
Instead of doing an attribute override.
James
===== drivers/scsi/ipr.c 1.31 vs edited =====
--- 1.31/drivers/scsi/ipr.c 2004-12-14 17:06:35 -06:00
+++ edited/drivers/scsi/ipr.c 2004-12-23 15:15:01 -06:00
@@ -2610,23 +2610,19 @@
#endif
/**
- * ipr_store_queue_depth - Change the device's queue depth
- * @dev: device struct
- * @buf: buffer
+ * ipr_change_queue_depth - Change the device's queue depth
+ * @dsev: scsi device struct
+ * @qdepth: depth to set
*
* Return value:
- * number of bytes printed to buffer
+ * actual depth set
**/
-static ssize_t ipr_store_queue_depth(struct device *dev,
- const char *buf, size_t count)
+static int ipr_change_queue_depth(struct scsi_device *sdev, int qdepth)
{
- struct scsi_device *sdev = to_scsi_device(dev);
struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)sdev->host->hostdata;
struct ipr_resource_entry *res;
- int qdepth = simple_strtoul(buf, NULL, 10);
int tagged = 0;
unsigned long lock_flags = 0;
- ssize_t len = -ENXIO;
spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
res = (struct ipr_resource_entry *)sdev->hostdata;
@@ -2635,23 +2631,13 @@
if (ipr_is_gscsi(res) && res->tcq_active)
tagged = MSG_ORDERED_TAG;
-
- len = strlen(buf);
}
spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
scsi_adjust_queue_depth(sdev, tagged, qdepth);
- return len;
+ return qdepth;
}
-static struct device_attribute ipr_queue_depth_attr = {
- .attr = {
- .name = "queue_depth",
- .mode = S_IRUSR | S_IWUSR,
- },
- .store = ipr_store_queue_depth
-};
-
/**
* ipr_show_tcq_enable - Show if the device is enabled for tcqing
* @dev: device struct
@@ -2760,7 +2746,6 @@
};
static struct device_attribute *ipr_dev_attrs[] = {
- &ipr_queue_depth_attr,
&ipr_tcqing_attr,
&ipr_adapter_handle_attr,
NULL,
@@ -3961,6 +3946,7 @@
.slave_alloc = ipr_slave_alloc,
.slave_configure = ipr_slave_configure,
.slave_destroy = ipr_slave_destroy,
+ .change_queue_depth = ipr_change_queue_depth,
.bios_param = ipr_biosparam,
.can_queue = IPR_MAX_COMMANDS,
.this_id = -1,
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] update ipr to use the change_queue_depth API
2004-12-23 21:19 [PATCH] update ipr to use the change_queue_depth API James Bottomley
@ 2004-12-28 16:54 ` Brian King
0 siblings, 0 replies; 2+ messages in thread
From: Brian King @ 2004-12-28 16:54 UTC (permalink / raw)
To: James Bottomley; +Cc: SCSI Mailing List
James Bottomley wrote:
> Instead of doing an attribute override.
>
> James
>
> ===== drivers/scsi/ipr.c 1.31 vs edited =====
> --- 1.31/drivers/scsi/ipr.c 2004-12-14 17:06:35 -06:00
> +++ edited/drivers/scsi/ipr.c 2004-12-23 15:15:01 -06:00
> @@ -2610,23 +2610,19 @@
> #endif
>
> /**
> - * ipr_store_queue_depth - Change the device's queue depth
> - * @dev: device struct
> - * @buf: buffer
> + * ipr_change_queue_depth - Change the device's queue depth
> + * @dsev: scsi device struct
^^^^
Should be sdev. Otherwise the patch looks good.
> + * @qdepth: depth to set
> *
> * Return value:
> - * number of bytes printed to buffer
> + * actual depth set
> **/
> -static ssize_t ipr_store_queue_depth(struct device *dev,
> - const char *buf, size_t count)
> +static int ipr_change_queue_depth(struct scsi_device *sdev, int qdepth)
> {
> - struct scsi_device *sdev = to_scsi_device(dev);
> struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)sdev->host->hostdata;
> struct ipr_resource_entry *res;
> - int qdepth = simple_strtoul(buf, NULL, 10);
> int tagged = 0;
> unsigned long lock_flags = 0;
> - ssize_t len = -ENXIO;
>
> spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
> res = (struct ipr_resource_entry *)sdev->hostdata;
> @@ -2635,23 +2631,13 @@
>
> if (ipr_is_gscsi(res) && res->tcq_active)
> tagged = MSG_ORDERED_TAG;
> -
> - len = strlen(buf);
> }
>
> spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
> scsi_adjust_queue_depth(sdev, tagged, qdepth);
> - return len;
> + return qdepth;
> }
>
> -static struct device_attribute ipr_queue_depth_attr = {
> - .attr = {
> - .name = "queue_depth",
> - .mode = S_IRUSR | S_IWUSR,
> - },
> - .store = ipr_store_queue_depth
> -};
> -
> /**
> * ipr_show_tcq_enable - Show if the device is enabled for tcqing
> * @dev: device struct
> @@ -2760,7 +2746,6 @@
> };
>
> static struct device_attribute *ipr_dev_attrs[] = {
> - &ipr_queue_depth_attr,
> &ipr_tcqing_attr,
> &ipr_adapter_handle_attr,
> NULL,
> @@ -3961,6 +3946,7 @@
> .slave_alloc = ipr_slave_alloc,
> .slave_configure = ipr_slave_configure,
> .slave_destroy = ipr_slave_destroy,
> + .change_queue_depth = ipr_change_queue_depth,
> .bios_param = ipr_biosparam,
> .can_queue = IPR_MAX_COMMANDS,
> .this_id = -1,
>
>
>
--
Brian King
eServer Storage I/O
IBM Linux Technology Center
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-12-28 16:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-12-23 21:19 [PATCH] update ipr to use the change_queue_depth API James Bottomley
2004-12-28 16:54 ` Brian King
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox