linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* cciss updates for 2.6 [9 of 11]
@ 2004-02-05  0:18 mikem
  2004-02-05  5:24 ` Andrew Morton
  0 siblings, 1 reply; 2+ messages in thread
From: mikem @ 2004-02-05  0:18 UTC (permalink / raw)
  To: akpm, axboe; +Cc: linux-kernel

Patch 9 of 11. Please apply in order.
This patch changes the way we fill out the /proc files we create. It now has
human readable volume sizes, RAID levels, etc. Also removes some fields that
were orginally for debug purposes.
This is in the 2.4 tree.
--------------------------------------------------------------------------------------
diff -burN lx261-p008/drivers/block/cciss.c lx261/drivers/block/cciss.c
--- lx261-p008/drivers/block/cciss.c	2004-01-23 13:16:48.000000000 -0600
+++ lx261/drivers/block/cciss.c	2004-01-23 15:37:47.000000000 -0600
@@ -156,6 +156,11 @@
 /*
  * Report information about this controller.
  */
+#define ENG_GIG 1048576000
+#define ENG_GIG_FACTOR (ENG_GIG/512)
+#define RAID_UNKNOWN 6
+static const char *raid_label[] = {"0","4","1(0+1)","5","5+1","ADG",
+	                                   "UNKNOWN"};
 #ifdef CONFIG_PROC_FS

 static struct proc_dir_entry *proc_cciss;
@@ -168,28 +173,40 @@
         int size, i, ctlr;
         ctlr_info_t *h = (ctlr_info_t*)data;
         drive_info_struct *drv;
+	unsigned long flags;
+	unsigned int vol_sz, vol_sz_frac;

         ctlr = h->ctlr;
-        size = sprintf(buffer, "%s:  Compaq %s Controller\n"
-                "       Board ID: 0x%08lx\n"
-		"       Firmware Version: %c%c%c%c\n"
-                "       Memory Address: 0x%08lx\n"
-                "       IRQ: %d\n"
-                "       Logical drives: %d\n"
-		"       Highest Logical Volume ID: %d\n"
-                "       Current Q depth: %d\n"
-                "       Max Q depth since init: %d\n"
-		"       Max # commands on controller since init: %d\n"
-		"       Max SG entries since init: %d\n\n",
+
+	/* prevent displaying bogus info during configuration
+	 * or deconfiguration of a logical volume
+	 */
+	spin_lock_irqsave(CCISS_LOCK(ctlr), flags);
+	if (h->busy_configuring) {
+		spin_unlock_irqrestore(CCISS_LOCK(ctlr), flags);
+	return -EBUSY;
+	}
+	h->busy_configuring = 1;
+	spin_unlock_irqrestore(CCISS_LOCK(ctlr), flags);
+
+        size = sprintf(buffer, "%s: HP %s Controller\n"
+		"Board ID: 0x%08lx\n"
+		"Firmware Version: %c%c%c%c\n"
+		"IRQ: %d\n"
+		"Logical drives: %d\n"
+		"Current Q depth: %d\n"
+		"Current # commands on controller: %d\n"
+		"Max Q depth since init: %d\n"
+		"Max # commands on controller since init: %d\n"
+		"Max SG entries since init: %d\n\n",
                 h->devname,
                 h->product_name,
                 (unsigned long)h->board_id,
 		h->firm_ver[0], h->firm_ver[1], h->firm_ver[2], h->firm_ver[3],
-                (unsigned long)h->vaddr,
                 (unsigned int)h->intr,
                 h->num_luns,
-                h->highest_lun,
-                h->Qdepth, h->maxQsinceinit, h->max_outstanding, h->maxSG);
+		h->Qdepth, h->commands_outstanding,
+		h->maxQsinceinit, h->max_outstanding, h->maxSG);

         pos += size; len += size;
 	cciss_proc_tape_report(ctlr, buffer, &pos, &len);
@@ -197,20 +214,23 @@
                 drv = &h->drv[i];
 		if (drv->block_size == 0)
 			continue;
-                size = sprintf(buffer+len, "cciss/c%dd%d: blksz=%d nr_blocks=%llu\n",
-                                ctlr, i, drv->block_size, (unsigned long long)drv->nr_blocks);
+		vol_sz = drv->nr_blocks/ENG_GIG_FACTOR;
+		vol_sz_frac = (drv->nr_blocks%ENG_GIG_FACTOR)*100/ENG_GIG_FACTOR;
+		if (drv->raid_level > 5)
+			drv->raid_level = RAID_UNKNOWN;
+		size = sprintf(buffer+len, "cciss/c%dd%d:"
+				"\t%4d.%02dGB\tRAID %s\n",
+				ctlr, i, vol_sz,vol_sz_frac,
+				raid_label[drv->raid_level]);
                 pos += size; len += size;
         }

-	size = sprintf(buffer+len, "nr_allocs = %d\nnr_frees = %d\n",
-                        h->nr_allocs, h->nr_frees);
-        pos += size; len += size;
-
         *eof = 1;
         *start = buffer+offset;
         len -= offset;
         if (len>length)
                 len = length;
+	h->busy_configuring = 0;
         return len;
 }

@@ -2158,10 +2178,10 @@
 	for(i=0; i<DEVICE_COUNT_RESOURCE; i++)
 	{
 		/* is this an IO range */
-		if( pdev_resource_flags(pdev, i) & 0x01 ) {
-			c->io_mem_addr = pdev_resource_start(pdev, i);
-			c->io_mem_length = pdev_resource_end(pdev, i) -
-				pdev_resource_start(pdev, i) +1;
+		if( pci_resource_flags(pdev, i) & 0x01 ) {
+			c->io_mem_addr = pci_resource_start(pdev, i);
+			c->io_mem_length = pci_resource_end(pdev, i) -
+				pci_resource_start(pdev, i) +1;
 #ifdef CCISS_DEBUG
 			printk("IO value found base_addr[%d] %lx %lx\n", i,
 				c->io_mem_addr, c->io_mem_length);
diff -burN lx261-p008/drivers/block/cciss.h lx261/drivers/block/cciss.h
--- lx261-p008/drivers/block/cciss.h	2004-01-21 16:59:34.000000000 -0600
+++ lx261/drivers/block/cciss.h	2004-01-23 14:47:19.000000000 -0600
@@ -32,6 +32,7 @@
 	int 	heads;
 	int	sectors;
 	int 	cylinders;
+	int	raid_level;
 } drive_info_struct;

 struct ctlr_info
@@ -78,6 +79,7 @@
         unsigned long  		*cmd_pool_bits;
 	int			nr_allocs;
 	int			nr_frees;
+	int			busy_configuring;

 	// Disk structures we need to pass back
 	struct gendisk   *gendisk[NWD];

Thanks,
mikem
mike.miller@hp.com


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

* Re: cciss updates for 2.6 [9 of 11]
  2004-02-05  0:18 cciss updates for 2.6 [9 of 11] mikem
@ 2004-02-05  5:24 ` Andrew Morton
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2004-02-05  5:24 UTC (permalink / raw)
  To: mikem; +Cc: axboe, linux-kernel

mikem@beardog.cca.cpqcorp.net wrote:
>
> +		vol_sz = drv->nr_blocks/ENG_GIG_FACTOR;
> +		vol_sz_frac = (drv->nr_blocks%ENG_GIG_FACTOR)*100/ENG_GIG_FACTOR;

This causes problems with CONFIG_LBD=y on ia32.

drivers/built-in.o: In function `cciss_proc_get_info':
/tmp/distcc_1108/drivers/block/cciss.c:217: undefined reference to `__udivdi3'
/tmp/distcc_1108/drivers/block/cciss.c:218: undefined reference to `__umoddi3'
/tmp/distcc_1108/drivers/block/cciss.c:218: undefined reference to `__udivdi3'

I'll include the below fix - could you please test it?  With both
CONFIG_LBD=y and CONFIG_LBD=n?

Thanks.


diff -puN drivers/block/cciss.c~cciss-64-bit-divide-fix drivers/block/cciss.c
--- 25/drivers/block/cciss.c~cciss-64-bit-divide-fix	2004-02-04 21:15:48.000000000 -0800
+++ 25-akpm/drivers/block/cciss.c	2004-02-04 21:15:48.000000000 -0800
@@ -211,11 +211,27 @@ static int cciss_proc_get_info(char *buf
         pos += size; len += size;
 	cciss_proc_tape_report(ctlr, buffer, &pos, &len);
 	for(i=0; i<h->highest_lun; i++) {
+		sector_t tmp;
+
                 drv = &h->drv[i];
 		if (drv->block_size == 0)
 			continue;
-		vol_sz = drv->nr_blocks/ENG_GIG_FACTOR;
-		vol_sz_frac = (drv->nr_blocks%ENG_GIG_FACTOR)*100/ENG_GIG_FACTOR;
+		vol_sz = drv->nr_blocks;
+		sector_div(vol_sz, ENG_GIG_FACTOR);
+
+		/*
+		 * Awkwardly do this:
+		 * vol_sz_frac =
+		 *     (drv->nr_blocks%ENG_GIG_FACTOR)*100/ENG_GIG_FACTOR;
+		 */
+		tmp = drv->nr_blocks;
+		vol_sz_frac = sector_div(tmp, ENG_GIG_FACTOR);
+
+		/* Now, vol_sz_frac = (drv->nr_blocks%ENG_GIG_FACTOR) */
+
+		vol_sz_frac *= 100;
+		sector_div(vol_sz_frac, ENG_GIG_FACTOR);
+
 		if (drv->raid_level > 5)
 			drv->raid_level = RAID_UNKNOWN;
 		size = sprintf(buffer+len, "cciss/c%dd%d:"

_


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

end of thread, other threads:[~2004-02-05  5:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-05  0:18 cciss updates for 2.6 [9 of 11] mikem
2004-02-05  5:24 ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).