diff options
author | Andrew Patterson <andrew.patterson@hp.com> | 2009-09-17 14:47:03 -0400 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2009-10-01 15:15:41 -0400 |
commit | d6f4965d7d2e718eb9b223cb06db5f6a53b73507 (patch) | |
tree | bcabba04fa36448b928f61be0eae2863651c5a68 /drivers/block | |
parent | b368c9dd65984d1860b97bff77644c0e3e46df96 (diff) |
cciss: Allow triggering of rescan of logical drive topology via sysfs entry
Added /sys/bus/pci/devices/<dev>/ccissX/rescan sysfs entry used
to kick off a rescan that discovers logical drive topology changes.
Signed-off-by: Andrew Patterson <andrew.patterson@hp.com>
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Acked-by: Mike Miller <mike.miller@hp.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/cciss.c | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index 4fb63b898798..a45268554e07 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
@@ -195,6 +195,7 @@ static int sendcmd_withirq_core(ctlr_info_t *h, CommandList_struct *c, | |||
195 | static int process_sendcmd_error(ctlr_info_t *h, CommandList_struct *c); | 195 | static int process_sendcmd_error(ctlr_info_t *h, CommandList_struct *c); |
196 | 196 | ||
197 | static void fail_all_cmds(unsigned long ctlr); | 197 | static void fail_all_cmds(unsigned long ctlr); |
198 | static int add_to_scan_list(struct ctlr_info *h); | ||
198 | static int scan_thread(void *data); | 199 | static int scan_thread(void *data); |
199 | static int check_for_unit_attention(ctlr_info_t *h, CommandList_struct *c); | 200 | static int check_for_unit_attention(ctlr_info_t *h, CommandList_struct *c); |
200 | 201 | ||
@@ -460,9 +461,19 @@ static void __devinit cciss_procinit(int i) | |||
460 | #define to_hba(n) container_of(n, struct ctlr_info, dev) | 461 | #define to_hba(n) container_of(n, struct ctlr_info, dev) |
461 | #define to_drv(n) container_of(n, drive_info_struct, dev) | 462 | #define to_drv(n) container_of(n, drive_info_struct, dev) |
462 | 463 | ||
463 | static struct device_type cciss_host_type = { | 464 | static ssize_t host_store_rescan(struct device *dev, |
464 | .name = "cciss_host", | 465 | struct device_attribute *attr, |
465 | }; | 466 | const char *buf, size_t count) |
467 | { | ||
468 | struct ctlr_info *h = to_hba(dev); | ||
469 | |||
470 | add_to_scan_list(h); | ||
471 | wake_up_process(cciss_scan_thread); | ||
472 | wait_for_completion_interruptible(&h->scan_wait); | ||
473 | |||
474 | return count; | ||
475 | } | ||
476 | DEVICE_ATTR(rescan, S_IWUSR, NULL, host_store_rescan); | ||
466 | 477 | ||
467 | static ssize_t dev_show_unique_id(struct device *dev, | 478 | static ssize_t dev_show_unique_id(struct device *dev, |
468 | struct device_attribute *attr, | 479 | struct device_attribute *attr, |
@@ -566,6 +577,25 @@ static ssize_t dev_show_rev(struct device *dev, | |||
566 | } | 577 | } |
567 | DEVICE_ATTR(rev, S_IRUGO, dev_show_rev, NULL); | 578 | DEVICE_ATTR(rev, S_IRUGO, dev_show_rev, NULL); |
568 | 579 | ||
580 | static struct attribute *cciss_host_attrs[] = { | ||
581 | &dev_attr_rescan.attr, | ||
582 | NULL | ||
583 | }; | ||
584 | |||
585 | static struct attribute_group cciss_host_attr_group = { | ||
586 | .attrs = cciss_host_attrs, | ||
587 | }; | ||
588 | |||
589 | static struct attribute_group *cciss_host_attr_groups[] = { | ||
590 | &cciss_host_attr_group, | ||
591 | NULL | ||
592 | }; | ||
593 | |||
594 | static struct device_type cciss_host_type = { | ||
595 | .name = "cciss_host", | ||
596 | .groups = cciss_host_attr_groups, | ||
597 | }; | ||
598 | |||
569 | static struct attribute *cciss_dev_attrs[] = { | 599 | static struct attribute *cciss_dev_attrs[] = { |
570 | &dev_attr_unique_id.attr, | 600 | &dev_attr_unique_id.attr, |
571 | &dev_attr_model.attr, | 601 | &dev_attr_model.attr, |