public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1 of 1] cciss: add procfs interface to rescan logical volumes
@ 2008-10-07 16:24 Mike Miller
  2008-10-07 16:35 ` Arjan van de Ven
  0 siblings, 1 reply; 3+ messages in thread
From: Mike Miller @ 2008-10-07 16:24 UTC (permalink / raw)
  To: Andrew Morton, JensAxboejens.axboe; +Cc: LKML, LKML-scsi

Patch 1 of 1

This patch adds a procfs interface so users can force a rescan of the
logical volumes attached to the controller. A new product uses Target Based
Management (TBM) out-of-band for configuration purposes. With this method
the driver has no way of knowing that something has changed, i.e., new
logical volume(s) added or existing volumes deleted.
This interface allows the user to echo "rescan volumes" >
/proc/driver/cciss/ccissN to force the driver to rebuild our table of
logical volumes. 
Please consider this patch for inclusion.

Thanks,
mikem

Signed-off-by: Mike Miller <mike.miller@hp.com>

diff --git a/Documentation/cciss.txt b/Documentation/cciss.txt
index 8244c64..afda23d 100644
--- a/Documentation/cciss.txt
+++ b/Documentation/cciss.txt
@@ -166,3 +166,17 @@ is issued which positions the tape to a known position.  Typically you
 must rewind the tape (by issuing "mt -f /dev/st0 rewind" for example)
 before i/o can proceed again to a tape drive which was reset.
 
+Rescanning for changes in configuration
+---------------------------------------
+
+Some new products use Target Based Management (TBM) for configuration
+purposes. These products cannot inform the driver that a new logical volume
+has been added, an existing volume deleted, or of change in the size of a
+logical volume. 
+A procfs interface has been added to facilitate a rescan of the devices
+attached to the controller. If a change is made the user may then issue:
+
+	# echo "rescan volumes" > /proc/driver/cciss/ccissN
+
+where N is the controller number. This will force the driver to update the
+configuration.
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index b73116e..76b5b33 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -249,6 +249,7 @@ static inline CommandList_struct *removeQ(CommandList_struct **Qptr,
 #define ENG_GIG 1000000000
 #define ENG_GIG_FACTOR (ENG_GIG/512)
 #define ENGAGE_SCSI	"engage scsi"
+#define RESCAN_VOLUMES	"rescan volumes"
 static const char *raid_label[] = { "0", "4", "1(1+0)", "5", "5+1", "ADG",
 	"UNKNOWN"
 };
@@ -379,7 +380,9 @@ static ssize_t
 cciss_proc_write(struct file *file, const char __user *buf,
 		 size_t length, loff_t *ppos)
 {
-	int err;
+	struct seq_file *seq = file->private_data;
+	ctlr_info_t *h = seq->private;
+	int err, rc;
 	char *buffer;
 
 #ifndef CONFIG_CISS_SCSI_TAPE
@@ -398,12 +401,26 @@ cciss_proc_write(struct file *file, const char __user *buf,
 		goto out;
 	buffer[length] = '\0';
 
+	/* For the MSA2000 the firmware cannot tell the driver to
+	 * rescan when new logical volumes are created. We provide
+	 * this interface so users can `echo "rescan volumes" >
+	 * /proc/driver/cciss/ccissN` to accomplish that task. It's not
+	 * the best solution because it must be done on every server
+	 * that connected to the storage.
+	 */
+
+	if (strncmp(RESCAN_VOLUMES, buffer, sizeof RESCAN_VOLUMES - 1) == 0) {
+		/* rebuild_lun_table returns -1 on success to tell ACU
+		* to quit calling it. In this case we just ignore any
+		* return code.
+		*/
+		(void) rebuild_lun_table(h, NULL);
+		err = length;
+		goto out;
+	}
+
 #ifdef CONFIG_CISS_SCSI_TAPE
 	if (strncmp(ENGAGE_SCSI, buffer, sizeof ENGAGE_SCSI - 1) == 0) {
-		struct seq_file *seq = file->private_data;
-		ctlr_info_t *h = seq->private;
-		int rc;
-
 		rc = cciss_engage_scsi(h->ctlr);
 		if (rc != 0)
 			err = -rc;

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1 of 1] cciss: add procfs interface to rescan logical volumes
  2008-10-07 16:24 [PATCH 1 of 1] cciss: add procfs interface to rescan logical volumes Mike Miller
@ 2008-10-07 16:35 ` Arjan van de Ven
  2008-10-07 17:33   ` Miller, Mike (OS Dev)
  0 siblings, 1 reply; 3+ messages in thread
From: Arjan van de Ven @ 2008-10-07 16:35 UTC (permalink / raw)
  To: Mike Miller; +Cc: Andrew Morton, JensAxboejens.axboe, LKML, LKML-scsi

On Tue, 7 Oct 2008 11:24:54 -0500
Mike Miller <mike.miller@hp.com> wrote:

> Patch 1 of 1
> 
> This patch adds a procfs interface so users can force a rescan of the
> logical volumes attached to the controller. A new product uses Target
> Based Management (TBM) out-of-band for configuration purposes. With
> this method the driver has no way of knowing that something has
> changed, i.e., new logical volume(s) added or existing volumes
> deleted. This interface allows the user to echo "rescan volumes" >
> /proc/driver/cciss/ccissN to force the driver to rebuild our table of
> logical volumes. 
> Please consider this patch for inclusion.


I'll ask the obvious question (since you didn't address this)...
why is this a proc thing and not just a sysfs attribute of the device?


-- 
Arjan van de Ven 	Intel Open Source Technology Centre
For development, discussion and tips for power savings, 
visit http://www.lesswatts.org

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH 1 of 1] cciss: add procfs interface to rescan logical volumes
  2008-10-07 16:35 ` Arjan van de Ven
@ 2008-10-07 17:33   ` Miller, Mike (OS Dev)
  0 siblings, 0 replies; 3+ messages in thread
From: Miller, Mike (OS Dev) @ 2008-10-07 17:33 UTC (permalink / raw)
  To: Arjan van de Ven
  Cc: Andrew Morton, JensAxboejens.axboe@oracle.com, LKML, LKML-scsi



> -----Original Message-----
> From: Arjan van de Ven [mailto:arjan@infradead.org]
> Sent: Tuesday, October 07, 2008 11:36 AM
> To: Miller, Mike (OS Dev)
> Cc: Andrew Morton; JensAxboejens.axboe@oracle.com; LKML; LKML-scsi
> Subject: Re: [PATCH 1 of 1] cciss: add procfs interface to
> rescan logical volumes
>
> On Tue, 7 Oct 2008 11:24:54 -0500
> Mike Miller <mike.miller@hp.com> wrote:
>
> > Patch 1 of 1
> >
> > This patch adds a procfs interface so users can force a
> rescan of the
> > logical volumes attached to the controller. A new product
> uses Target
> > Based Management (TBM) out-of-band for configuration purposes. With
> > this method the driver has no way of knowing that something has
> > changed, i.e., new logical volume(s) added or existing volumes
> > deleted. This interface allows the user to echo "rescan volumes" >
> > /proc/driver/cciss/ccissN to force the driver to rebuild
> our table of
> > logical volumes.
> > Please consider this patch for inclusion.
>
>
> I'll ask the obvious question (since you didn't address this)...
> why is this a proc thing and not just a sysfs attribute of the device?
>

Because I'm pretty sysfs stupid. :(

An attribute in sysfs is the ultimate goal but I did this for expediency. Any pointers to sysfs documentation that's either not very outdated or doesn't contradict itself?

Thanks,
mikem

>
> --
> Arjan van de Ven        Intel Open Source Technology Centre
> For development, discussion and tips for power savings, visit
> http://www.lesswatts.org
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-10-07 17:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-07 16:24 [PATCH 1 of 1] cciss: add procfs interface to rescan logical volumes Mike Miller
2008-10-07 16:35 ` Arjan van de Ven
2008-10-07 17:33   ` Miller, Mike (OS Dev)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox