Skip to contentSkip to conversation

i2o subsystem minor bugfixes to work with 2.6.3 kernel

PATCH In review Markus Lidel 3 participants 5 messages Mar 2, 2004 – Mar 3, 2004

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i2o subsystem minor bugfixes to work with 2.6.3 kernel

Hello,

here is the patch against 2.6.3 kernel to fix the I2O subsystem for the 2.6 kernel.

If someone found a bug, please feel free to contact me.

Best regards,

Markus Lidel
------------------------------------------
Markus Lidel (Senior IT Consultant)

Shadow Connect GmbH
Carl-Reisch-Weg 12
D-86381 Krumbach
Germany

Phone:  +49 82 82/99 51-0
Fax:    +49 82 82/99 51-11
E-Mail: [email protected]
URL:    http://www.shadowconnect.com
drivers/message/i2o/i2o_block.c +32 -46
diff -ur a/drivers/message/i2o/i2o_block.c b/drivers/message/i2o/i2o_block.c
@@ -50,9 +50,11 @@
  *		Properly attach/detach I2O gendisk structure from the system
  *		gendisk list. The I2O block devices now appear in 
  * 		/proc/partitions.
+ *	Markus Lidel <[email protected]>:
+ *		Minor bugfixes for 2.6.
  *
- *	To do:
- *		Serial number scanning to find duplicates for FC multipathing
+ * To do:
+ *	Serial number scanning to find duplicates for FC multipathing
  */
 
 #include <linux/major.h>
@@ -109,25 +109,6 @@
 				 I2O_EVT_IND_BSA_SCSI_SMART )
 
 
-/*
- * I2O Block Error Codes - should be in a header file really...
- */
-#define I2O_BSA_DSC_SUCCESS             0x0000
-#define I2O_BSA_DSC_MEDIA_ERROR         0x0001
-#define I2O_BSA_DSC_ACCESS_ERROR        0x0002
-#define I2O_BSA_DSC_DEVICE_FAILURE      0x0003
-#define I2O_BSA_DSC_DEVICE_NOT_READY    0x0004
-#define I2O_BSA_DSC_MEDIA_NOT_PRESENT   0x0005
-#define I2O_BSA_DSC_MEDIA_LOCKED        0x0006
-#define I2O_BSA_DSC_MEDIA_FAILURE       0x0007
-#define I2O_BSA_DSC_PROTOCOL_FAILURE    0x0008
-#define I2O_BSA_DSC_BUS_FAILURE         0x0009
-#define I2O_BSA_DSC_ACCESS_VIOLATION    0x000A
-#define I2O_BSA_DSC_WRITE_PROTECTED     0x000B
-#define I2O_BSA_DSC_DEVICE_RESET        0x000C
-#define I2O_BSA_DSC_VOLUME_CHANGED      0x000D
-#define I2O_BSA_DSC_TIMEOUT             0x000E
-
 #define I2O_LOCK(unit)	(i2ob_dev[(unit)].req_queue->queue_lock)
 
 /*
@@ -1089,6 +1070,28 @@
 	 */
 	printk(KERN_INFO "i2ob: Installing tid %d device at unit %d\n", 
 			d->lct_data.tid, unit);	
+	
+	/* 
+	 * If this is the first I2O block device found on this IOP,
+	 * we need to initialize all the queue data structures
+	 * before any I/O can be performed. If it fails, this
+	 * device is useless.
+	 */
+	if(!i2ob_queues[unit]) {
+		if(i2ob_init_iop(unit))
+			return 1;
+	}
+
+	/* 
+	 * This will save one level of lookup/indirection in critical 
+	 * code so that we can directly get the queue ptr from the
+	 * device instead of having to go the IOP data structure.
+	 */
+	dev->req_queue = i2ob_queues[unit]->req_queue;
+
+	/* initialize gendik structure */
+	i2ob_disk[unit>>4]->private_data = dev;
+	i2ob_disk[unit>>4]->queue = dev->req_queue;
 
 	/*
 	 *	Ask for the current media data. If that isn't supported
@@ -1148,6 +1151,7 @@
 	}
 
 	strcpy(d->dev_name, i2ob_disk[unit>>4]->disk_name);
+	strcpy(i2ob_disk[unit>>4]->devfs_name, i2ob_disk[unit>>4]->disk_name);
 
 	printk(KERN_INFO "%s: Max segments %d, queue depth %d, byte limit %d.\n",
 		 d->dev_name, i2ob_dev[unit].max_segments, i2ob_dev[unit].depth, i2ob_max_sectors[unit]<<9);
@@ -1193,28 +1197,6 @@
 	printk(KERN_INFO "%s: Maximum sectors/read set to %d.\n", 
 		d->dev_name, i2ob_max_sectors[unit]);
 
-	/* 
-	 * If this is the first I2O block device found on this IOP,
-	 * we need to initialize all the queue data structures
-	 * before any I/O can be performed. If it fails, this
-	 * device is useless.
-	 */
-	if(!i2ob_queues[c->unit]) {
-		if(i2ob_init_iop(c->unit))
-			return 1;
-	}
-
-	/* 
-	 * This will save one level of lookup/indirection in critical 
-	 * code so that we can directly get the queue ptr from the
-	 * device instead of having to go the IOP data structure.
-	 */
-	dev->req_queue = i2ob_queues[c->unit]->req_queue;
-
-	/* Register a size before we register for events - otherwise we
-	   might miss and overwrite an event */
-	set_capacity(i2ob_disk[unit>>4], size>>9);
-
 	/*
 	 * Register for the events we're interested in and that the
 	 * device actually supports.
@@ -1251,6 +1235,7 @@
 	i2ob_queues[unit]->i2ob_qhead = &i2ob_queues[unit]->request_queue[0];
 	atomic_set(&i2ob_queues[unit]->queue_depth, 0);
 
+	i2ob_queues[unit]->lock = SPIN_LOCK_UNLOCKED;
 	i2ob_queues[unit]->req_queue = blk_init_queue(i2ob_request, &i2ob_queues[unit]->lock);
 	if (!i2ob_queues[unit]->req_queue) {
 		kfree(i2ob_queues[unit]);
@@ -1336,6 +1318,8 @@
 				continue;
 			}
 
+			i2o_release_device(d, &i2o_block_handler);
+
 			if(scan_unit<MAX_I2OB<<4)
 			{
  				/*
@@ -1365,7 +1349,6 @@
 				if(!warned++)
 					printk(KERN_WARNING "i2o_block: too many device, registering only %d.\n", scan_unit>>4);
 			}
-			i2o_release_device(d, &i2o_block_handler);
 		}
 		i2o_unlock_controller(c);
 	}
@@ -1699,9 +1682,9 @@
 	
 	if(evt_running) {
 		printk(KERN_INFO "Killing I2O block threads...");
-		i = kill_proc(evt_pid, SIGTERM, 1);
+		i = kill_proc(evt_pid, SIGKILL, 1);
 		if(!i) {
-			printk("waiting...");
+			printk("waiting...\n");
 		}
 		/* Be sure it died */
 		wait_for_completion(&i2ob_thread_dead);
drivers/message/i2o/i2o_core.c +34 -32

150 lines not on this page · raw message

drivers/message/i2o/i2o_scsi.c +39 -27

169 lines not on this page · raw message

include/linux/i2o-dev.h +1 -1
diff -ur a/include/linux/i2o-dev.h b/include/linux/i2o-dev.h
@@ -182,7 +182,7 @@
 {
 	u32	adapter_id;
 	u32	parent_tid:12;
-	u32 	tate:4;
+	u32 	state:4;
 	u32	bus_num:8;
 	u32	bus_type:8;
 	union
include/linux/i2o.h +19 -0
diff -ur a/include/linux/i2o.h b/include/linux/i2o.h
@@ -544,6 +544,25 @@
 #define I2O_DSC_DEVICE_BUSY                    0x001B
 #define I2O_DSC_DEVICE_NOT_AVAILABLE           0x001C
 
+/* DetailedStatusCode defines for Block Storage Operation: Table 6-7 Detailed
+   Status Codes.*/
+
+#define I2O_BSA_DSC_SUCCESS               0x0000
+#define I2O_BSA_DSC_MEDIA_ERROR           0x0001
+#define I2O_BSA_DSC_ACCESS_ERROR          0x0002
+#define I2O_BSA_DSC_DEVICE_FAILURE        0x0003
+#define I2O_BSA_DSC_DEVICE_NOT_READY      0x0004
+#define I2O_BSA_DSC_MEDIA_NOT_PRESENT     0x0005
+#define I2O_BSA_DSC_MEDIA_LOCKED          0x0006
+#define I2O_BSA_DSC_MEDIA_FAILURE         0x0007
+#define I2O_BSA_DSC_PROTOCOL_FAILURE      0x0008
+#define I2O_BSA_DSC_BUS_FAILURE           0x0009
+#define I2O_BSA_DSC_ACCESS_VIOLATION      0x000A
+#define I2O_BSA_DSC_WRITE_PROTECTED       0x000B
+#define I2O_BSA_DSC_DEVICE_RESET          0x000C
+#define I2O_BSA_DSC_VOLUME_CHANGED        0x000D
+#define I2O_BSA_DSC_TIMEOUT               0x000E
+
 /* FailureStatusCodes, Table 3-3 Message Failure Codes */
 
 #define I2O_FSC_TRANSPORT_SERVICE_SUSPENDED             0x81
drivers/message/i2o/Kconfig +6 -2
diff -ur a/drivers/message/i2o/Kconfig b/drivers/message/i2o/Kconfig
@@ -39,7 +39,10 @@
 	depends on I2O
 	help
 	  Include support for the I2O Block OSM. The Block OSM presents disk
-	  and other structured block devices to the operating system.
+	  and other structured block devices to the operating system. If you
+	  are using an RAID controller, you could access the array only by
+	  the Block OSM driver. But it is possible to access the single disks
+	  by the SCSI OSM driver, for example to monitor the disks.
 
 	  To compile this support as a module, choose M here: the
 	  module will be called i2o_block.
@@ -50,7 +53,8 @@
 	help
 	  Allows direct SCSI access to SCSI devices on a SCSI or FibreChannel
 	  I2O controller. You can use both the SCSI and Block OSM together if
-	  you wish.
+	  you wish. To access a RAID array, you must use the Block OSM driver.
+	  But you could use the SCSI OSM driver to monitor the single disks.
 
 	  To compile this support as a module, choose M here: the
 	  module will be called i2o_scsi.
#1 lore raw
Quoted 3 lines · Markus Lidel

here is the patch against 2.6.3 kernel to fix the I2O subsystem for the 2.6 kernel.

Could you please describe the changes you have made? ie: what the bugs are, and how you fixed them?

Thanks.

#2 lore raw

Hello,

Quoted 5 lines · Andrew Morton
Quoted 2 lines

here is the patch against 2.6.3 kernel to fix the I2O subsystem for the 2.6 kernel.

Could you please describe the changes you have made? ie: what the bugs are, and how you fixed them?

Oh sorry, totally forgot.

drivers/message/i2o/i2o_block.c:
--------------------------------
- corrected the initialization sequence of the request queues.
- added initialization to queue spinlocks.
- release device in i2o_scan because else the device could not be queried.

- i2o_block event threads wait on signal KILL but signal TERM was sent.

drivers/message/i2o/i2o_core.c:
-------------------------------
- set the HRT length to 0 at initialization, to avoid calling free on unallocated memory.
- i2o_core event threads wait on signal KILL but signal TERM was sent.
- added a limit of 3 tries to get the HRT from the controller.
- removed the dpt parameter, which was used to force DPT controllers get handled by the i2o driver. Now all available i2o controllers will be handled by this driver.

drivers/message/i2o/i2o_scsi.c:
-------------------------------
- beautifying of printk calls.
- added scsi_unregister to properly clean up on module unload.

drivers/message/i2o/Kconfig:
----------------------------
- added help for i2o_block and i2o_scsi to describe the differences between the two drivers.

include/linux/i2o-dev.h:
------------------------
- cleaned typo "tate" into "state".

include/linux/i2o.h:
--------------------
- removed defines from i2o_block and insert it here.

Hope it is okey this way.

Best regards,

Markus Lidel
------------------------------------------
Markus Lidel (Senior IT Consultant)

Shadow Connect GmbH
Carl-Reisch-Weg 12
D-86381 Krumbach
Germany

Phone:  +49 82 82/99 51-0
Fax:    +49 82 82/99 51-11
E-Mail: [email protected]
URL:    http://www.shadowconnect.com
#3 lore raw

I'm happy someone is touching I2O subsystem again...

What devices are you testing your changes with?

Jeff

#4 lore raw

Hello,

Quoted 2 lines · Jeff Garzik

I'm happy someone is touching I2O subsystem again... What devices are you testing your changes with?

currently i only have tested them with a RAID array. That's the main usage of I2O controllers i think. But a tape drive would be important too in my opinion. If you have some other devices (e. g. scanners) which does or doesn't work it would be nice, if you could give me some feedback, so i could fix it (hopefully).

Best regards,

Markus Lidel
------------------------------------------
Markus Lidel (Senior IT Consultant)

Shadow Connect GmbH
Carl-Reisch-Weg 12
D-86381 Krumbach
Germany

Phone:  +49 82 82/99 51-0
Fax:    +49 82 82/99 51-11
E-Mail: [email protected]
URL:    http://www.shadowconnect.com