Skip to contentSkip to conversation

s390 (3/7): dasd driver.

PATCH New Martin Schwidefsky 1 participant 1 message Oct 6, 2003

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 s390 (3/7): dasd driver.

- Remove dynamic allocation of major numbers. Just use static major 94.
- Use bus_id instead of device number where possible.
- Don't check open_count in dasd_generic_set_offline.

diffstat:

 drivers/s390/block/dasd.c        |   52 +-----
 drivers/s390/block/dasd_devmap.c |  304 +++++++++++++++++++--------------------
 drivers/s390/block/dasd_genhd.c  |  121 +--------------
 drivers/s390/block/dasd_int.h    |    8 -
 drivers/s390/block/dasd_proc.c   |    4 
 5 files changed, 181 insertions(+), 308 deletions(-)
drivers/s390/block/dasd.c +8 -44
diff -urN linux-2.6/drivers/s390/block/dasd.c linux-2.6-s390/drivers/s390/block/dasd.c
@@ -7,7 +7,7 @@
  * Bugreports.to..: <[email protected]>
  * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999-2001
  *
- * $Revision: 1.110 $
+ * $Revision: 1.114 $
  */
 
 #include <linux/config.h>
@@ -1142,8 +1142,8 @@
 		req = elv_next_request(queue);
 		if (device->ro_flag && rq_data_dir(req) == WRITE) {
 			DBF_EVENT(DBF_ERR,
-				  "(%04x) Rejecting write request %p",
-				  _ccw_device_get_device_number(device->cdev),
+				  "(%s) Rejecting write request %p",
+				  device->cdev->dev.bus_id,
 				  req);
 			blkdev_dequeue_request(req);
 			dasd_end_request(req, 0);
@@ -1154,8 +1154,8 @@
 			if (PTR_ERR(cqr) == -ENOMEM)
 				break;	/* terminate request queue loop */
 			DBF_EVENT(DBF_ERR,
-				  "(%04x) CCW creation failed on request %p",
-				  _ccw_device_get_device_number(device->cdev),
+				  "(%s) CCW creation failed on request %p",
+				  device->cdev->dev.bus_id,
 				  req);
 			blkdev_dequeue_request(req);
 			dasd_end_request(req, 0);
@@ -1728,12 +1728,10 @@
 dasd_generic_probe (struct ccw_device *cdev,
 		    struct dasd_discipline *discipline)
 {
-	int devno;
 	int ret = 0;
 
-	devno = _ccw_device_get_device_number(cdev);
-	if (dasd_autodetect
-	    && (ret = dasd_add_range(devno, devno, DASD_FEATURE_DEFAULT))) {
+	if (dasd_autodetect &&
+	    (ret = dasd_add_busid(cdev->dev.bus_id, DASD_FEATURE_DEFAULT))) {
 		printk (KERN_WARNING
 			"dasd_generic_probe: cannot autodetect %s\n",
 			cdev->dev.bus_id);
@@ -1830,12 +1828,6 @@
 	struct dasd_device *device;
 
 	device = cdev->dev.driver_data;
-	if (atomic_read(&device->open_count) > 0) {
-		printk (KERN_WARNING "Can't offline dasd device with open"
-			" count = %i.\n",
-			atomic_read(&device->open_count));
-		return -EBUSY;
-	}
 	dasd_set_target_state(device, DASD_STATE_NEW);
 	dasd_delete_device(device);
 	
@@ -1854,7 +1846,6 @@
 	struct device_driver *drv;
 	struct device *d, *dev;
 	struct ccw_device *cdev;
-	int devno;
 
 	drv = get_driver(&dasd_discipline_driver->driver);
 	down_read(&drv->bus->subsys.rwsem);
@@ -1864,8 +1855,7 @@
 		if (!dev)
 			continue;
 		cdev = to_ccwdev(dev);
-		devno = _ccw_device_get_device_number(cdev);
-		if (dasd_autodetect || dasd_devno_in_range(devno) == 0)
+		if (dasd_autodetect || dasd_busid_known(cdev->dev.bus_id) == 0)
 			ccw_device_set_online(cdev);
 		put_device(dev);
 	}
@@ -1934,31 +1924,6 @@
 static
 DEVICE_ATTR(use_diag, 0644, dasd_use_diag_show, dasd_use_diag_store);
 
-#if 0
-/* this file shows the same information as /proc/dasd/devices using
- * an inaccaptable interface */
-/* TODO: Split this up into smaller files! */
-static ssize_t
-dasd_devices_show(struct device *dev, char *buf)
-{
-	
-	struct dasd_device *device;
-	dasd_devmap_t *devmap;
-
-	devmap = NULL;
-	device = dev->driver_data;
-	if (device)
-		devmap = dasd_devmap_from_devno(device->devno);
-
-	if (!devmap)
-		return sprintf(buf, "unused\n");
-
-	return min ((size_t) dasd_devices_print(devmap, buf), PAGE_SIZE);
-}
-
-static DEVICE_ATTR(dasd, 0444, dasd_devices_show, 0);
-#endif
-
 static ssize_t
 dasd_discipline_show(struct device *dev, char *buf)
 {
@@ -1973,7 +1938,6 @@
 static DEVICE_ATTR(discipline, 0444, dasd_discipline_show, NULL);
 
 static struct attribute * dasd_attrs[] = {
-	//&dev_attr_dasd.attr,
 	&dev_attr_readonly.attr,
 	&dev_attr_discipline.attr,
 	&dev_attr_use_diag.attr,
drivers/s390/block/dasd_devmap.c +154 -150

434 lines not on this page · raw message

drivers/s390/block/dasd_genhd.c +13 -108

169 lines not on this page · raw message

drivers/s390/block/dasd_int.h +4 -4
diff -urN linux-2.6/drivers/s390/block/dasd_int.h linux-2.6-s390/drivers/s390/block/dasd_int.h
@@ -6,7 +6,7 @@
  * Bugreports.to..: <[email protected]>
  * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000
  *
- * $Revision: 1.45 $
+ * $Revision: 1.48 $
  */
 
 #ifndef DASD_INT_H
@@ -15,7 +15,7 @@
 #ifdef __KERNEL__
 
 /* we keep old device allocation scheme; IOW, minors are still in 0..255 */
-#define DASD_PER_MAJOR ( 1U<<(8-DASD_PARTN_BITS))
+#define DASD_PER_MAJOR (1U << (MINORBITS - DASD_PARTN_BITS))
 #define DASD_PARTN_MASK ((1 << DASD_PARTN_BITS) - 1)
 
 /*
@@ -477,8 +477,8 @@
 struct dasd_device *dasd_device_from_devindex(int);
 
 int dasd_parse(void);
-int dasd_add_range(int, int, int);
-int dasd_devno_in_range(int);
+int dasd_add_busid(char *, int);
+int dasd_busid_known(char *);
 
 /* externals in dasd_gendisk.c */
 int  dasd_gendisk_init(void);
drivers/s390/block/dasd_proc.c +2 -2
diff -urN linux-2.6/drivers/s390/block/dasd_proc.c linux-2.6-s390/drivers/s390/block/dasd_proc.c
@@ -9,7 +9,7 @@
  *
  * /proc interface for the dasd driver.
  *
- * $Revision: 1.22 $
+ * $Revision: 1.23 $
  */
 
 #include <linux/config.h>
@@ -59,7 +59,7 @@
 	if (IS_ERR(device))
 		return 0;
 	/* Print device number. */
-	seq_printf(m, "%04x", _ccw_device_get_device_number(device->cdev));
+	seq_printf(m, "%s", device->cdev->dev.bus_id);
 	/* Print discipline string. */
 	if (device != NULL && device->discipline != NULL)
 		seq_printf(m, "(%s)", device->discipline->name);