Commit e3a8d586 authored by Stephen M. Cameron's avatar Stephen M. Cameron Committed by james toy

Allow device rescan to be triggered via sysfs.

Signed-off-by: default avatarStephen M. Cameron <scameron@beardog.cce.hp.com>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Cc: Mike Miller <mikem@beardog.cce.hp.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 011771ec
...@@ -147,10 +147,13 @@ static ssize_t lunid_show(struct device *dev, ...@@ -147,10 +147,13 @@ static ssize_t lunid_show(struct device *dev,
static ssize_t unique_id_show(struct device *dev, static ssize_t unique_id_show(struct device *dev,
struct device_attribute *attr, char *buf); struct device_attribute *attr, char *buf);
static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno); static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno);
static ssize_t host_store_rescan(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count);
DEVICE_ATTR(raid_level, S_IRUGO, raid_level_show, NULL); DEVICE_ATTR(raid_level, S_IRUGO, raid_level_show, NULL);
DEVICE_ATTR(lunid, S_IRUGO, lunid_show, NULL); DEVICE_ATTR(lunid, S_IRUGO, lunid_show, NULL);
DEVICE_ATTR(unique_id, S_IRUGO, unique_id_show, NULL); DEVICE_ATTR(unique_id, S_IRUGO, unique_id_show, NULL);
DEVICE_ATTR(rescan, S_IWUSR, NULL, host_store_rescan);
struct device_attribute *hpsa_sdev_attrs[] = { struct device_attribute *hpsa_sdev_attrs[] = {
&dev_attr_raid_level, &dev_attr_raid_level,
...@@ -159,6 +162,11 @@ struct device_attribute *hpsa_sdev_attrs[] = { ...@@ -159,6 +162,11 @@ struct device_attribute *hpsa_sdev_attrs[] = {
NULL, NULL,
}; };
static struct device_attribute *hpsa_shost_attrs[] = {
&dev_attr_rescan,
NULL,
};
static struct scsi_host_template hpsa_driver_template = { static struct scsi_host_template hpsa_driver_template = {
.module = THIS_MODULE, .module = THIS_MODULE,
.name = "hpsa", .name = "hpsa",
...@@ -177,6 +185,7 @@ static struct scsi_host_template hpsa_driver_template = { ...@@ -177,6 +185,7 @@ static struct scsi_host_template hpsa_driver_template = {
.compat_ioctl = hpsa_compat_ioctl, .compat_ioctl = hpsa_compat_ioctl,
#endif #endif
.sdev_attrs = hpsa_sdev_attrs, .sdev_attrs = hpsa_sdev_attrs,
.shost_attrs = hpsa_shost_attrs,
}; };
static inline struct ctlr_info *sdev_to_hba(struct scsi_device *sdev) static inline struct ctlr_info *sdev_to_hba(struct scsi_device *sdev)
...@@ -308,6 +317,21 @@ static int scan_thread(__attribute__((unused)) void *data) ...@@ -308,6 +317,21 @@ static int scan_thread(__attribute__((unused)) void *data)
return 0; return 0;
} }
static ssize_t host_store_rescan(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
struct ctlr_info *h;
struct Scsi_Host *shost = class_to_shost(dev);
unsigned long *priv = shost_priv(shost);
h = (struct ctlr_info *) *priv;
if (add_to_scan_list(h)) {
wake_up_process(hpsa_scan_thread);
wait_for_completion_interruptible(&h->scan_wait);
}
return count;
}
/* Enqueuing and dequeuing functions for cmdlists. */ /* Enqueuing and dequeuing functions for cmdlists. */
static inline void addQ(struct hlist_head *list, struct CommandList *c) static inline void addQ(struct hlist_head *list, struct CommandList *c)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment