aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/block/dasd_genhd.c
diff options
context:
space:
mode:
authorStefan Weinhuber <wein@de.ibm.com>2008-01-26 08:11:23 -0500
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2008-01-26 08:11:28 -0500
commit8e09f21574ea3028d5629e5de759e0b196c690c5 (patch)
treeced4feb1847ee6c2a7b7b4cec8f3118f83d3a386 /drivers/s390/block/dasd_genhd.c
parent0ac30be461084f30ad6e22c6b91347e880ed41aa (diff)
[S390] dasd: add hyper PAV support to DASD device driver, part 1
Parallel access volumes (PAV) is a storage server feature, that allows to start multiple channel programs on the same DASD in parallel. It defines alias devices which can be used as alternative paths to the same disk. With the old base PAV support we only needed rudimentary functionality in the DASD device driver. As the mapping between base and alias devices was static, we just had to export an identifier (uid) and could leave the combining of devices to external layers like a device mapper multipath. Now hyper PAV removes the requirement to dedicate alias devices to specific base devices. Instead each alias devices can be combined with multiple base device on a per request basis. This requires full support by the DASD device driver as now each channel program itself has to identify the target base device. The changes to the dasd device driver and the ECKD discipline are: - Separate subchannel device representation (dasd_device) from block device representation (dasd_block). Only base devices are block devices. - Gather information about base and alias devices and possible combinations. - For each request decide which dasd_device should be used (base or alias) and build specific channel program. - Support summary unit checks, which allow the storage server to upgrade / downgrade between base and hyper PAV at runtime (support is mandatory). Signed-off-by: Stefan Weinhuber <wein@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/s390/block/dasd_genhd.c')
-rw-r--r--drivers/s390/block/dasd_genhd.c76
1 files changed, 36 insertions, 40 deletions
diff --git a/drivers/s390/block/dasd_genhd.c b/drivers/s390/block/dasd_genhd.c
index 47ba4462708d..aee6565aaf98 100644
--- a/drivers/s390/block/dasd_genhd.c
+++ b/drivers/s390/block/dasd_genhd.c
@@ -25,14 +25,15 @@
25/* 25/*
26 * Allocate and register gendisk structure for device. 26 * Allocate and register gendisk structure for device.
27 */ 27 */
28int 28int dasd_gendisk_alloc(struct dasd_block *block)
29dasd_gendisk_alloc(struct dasd_device *device)
30{ 29{
31 struct gendisk *gdp; 30 struct gendisk *gdp;
31 struct dasd_device *base;
32 int len; 32 int len;
33 33
34 /* Make sure the minor for this device exists. */ 34 /* Make sure the minor for this device exists. */
35 if (device->devindex >= DASD_PER_MAJOR) 35 base = block->base;
36 if (base->devindex >= DASD_PER_MAJOR)
36 return -EBUSY; 37 return -EBUSY;
37 38
38 gdp = alloc_disk(1 << DASD_PARTN_BITS); 39 gdp = alloc_disk(1 << DASD_PARTN_BITS);
@@ -41,9 +42,9 @@ dasd_gendisk_alloc(struct dasd_device *device)
41 42
42 /* Initialize gendisk structure. */ 43 /* Initialize gendisk structure. */
43 gdp->major = DASD_MAJOR; 44 gdp->major = DASD_MAJOR;
44 gdp->first_minor = device->devindex << DASD_PARTN_BITS; 45 gdp->first_minor = base->devindex << DASD_PARTN_BITS;
45 gdp->fops = &dasd_device_operations; 46 gdp->fops = &dasd_device_operations;
46 gdp->driverfs_dev = &device->cdev->dev; 47 gdp->driverfs_dev = &base->cdev->dev;
47 48
48 /* 49 /*
49 * Set device name. 50 * Set device name.
@@ -53,53 +54,51 @@ dasd_gendisk_alloc(struct dasd_device *device)
53 * dasdaaaa - dasdzzzz : 456976 devices, added up = 475252 54 * dasdaaaa - dasdzzzz : 456976 devices, added up = 475252
54 */ 55 */
55 len = sprintf(gdp->disk_name, "dasd"); 56 len = sprintf(gdp->disk_name, "dasd");
56 if (device->devindex > 25) { 57 if (base->devindex > 25) {
57 if (device->devindex > 701) { 58 if (base->devindex > 701) {
58 if (device->devindex > 18277) 59 if (base->devindex > 18277)
59 len += sprintf(gdp->disk_name + len, "%c", 60 len += sprintf(gdp->disk_name + len, "%c",
60 'a'+(((device->devindex-18278) 61 'a'+(((base->devindex-18278)
61 /17576)%26)); 62 /17576)%26));
62 len += sprintf(gdp->disk_name + len, "%c", 63 len += sprintf(gdp->disk_name + len, "%c",
63 'a'+(((device->devindex-702)/676)%26)); 64 'a'+(((base->devindex-702)/676)%26));
64 } 65 }
65 len += sprintf(gdp->disk_name + len, "%c", 66 len += sprintf(gdp->disk_name + len, "%c",
66 'a'+(((device->devindex-26)/26)%26)); 67 'a'+(((base->devindex-26)/26)%26));
67 } 68 }
68 len += sprintf(gdp->disk_name + len, "%c", 'a'+(device->devindex%26)); 69 len += sprintf(gdp->disk_name + len, "%c", 'a'+(base->devindex%26));
69 70
70 if (device->features & DASD_FEATURE_READONLY) 71 if (block->base->features & DASD_FEATURE_READONLY)
71 set_disk_ro(gdp, 1); 72 set_disk_ro(gdp, 1);
72 gdp->private_data = device; 73 gdp->private_data = block;
73 gdp->queue = device->request_queue; 74 gdp->queue = block->request_queue;
74 device->gdp = gdp; 75 block->gdp = gdp;
75 set_capacity(device->gdp, 0); 76 set_capacity(block->gdp, 0);
76 add_disk(device->gdp); 77 add_disk(block->gdp);
77 return 0; 78 return 0;
78} 79}
79 80
80/* 81/*
81 * Unregister and free gendisk structure for device. 82 * Unregister and free gendisk structure for device.
82 */ 83 */
83void 84void dasd_gendisk_free(struct dasd_block *block)
84dasd_gendisk_free(struct dasd_device *device)
85{ 85{
86 if (device->gdp) { 86 if (block->gdp) {
87 del_gendisk(device->gdp); 87 del_gendisk(block->gdp);
88 device->gdp->queue = NULL; 88 block->gdp->queue = NULL;
89 put_disk(device->gdp); 89 put_disk(block->gdp);
90 device->gdp = NULL; 90 block->gdp = NULL;
91 } 91 }
92} 92}
93 93
94/* 94/*
95 * Trigger a partition detection. 95 * Trigger a partition detection.
96 */ 96 */
97int 97int dasd_scan_partitions(struct dasd_block *block)
98dasd_scan_partitions(struct dasd_device * device)
99{ 98{
100 struct block_device *bdev; 99 struct block_device *bdev;
101 100
102 bdev = bdget_disk(device->gdp, 0); 101 bdev = bdget_disk(block->gdp, 0);
103 if (!bdev || blkdev_get(bdev, FMODE_READ, 1) < 0) 102 if (!bdev || blkdev_get(bdev, FMODE_READ, 1) < 0)
104 return -ENODEV; 103 return -ENODEV;
105 /* 104 /*
@@ -117,7 +116,7 @@ dasd_scan_partitions(struct dasd_device * device)
117 * is why the assignment to device->bdev is done AFTER 116 * is why the assignment to device->bdev is done AFTER
118 * the BLKRRPART ioctl. 117 * the BLKRRPART ioctl.
119 */ 118 */
120 device->bdev = bdev; 119 block->bdev = bdev;
121 return 0; 120 return 0;
122} 121}
123 122
@@ -125,8 +124,7 @@ dasd_scan_partitions(struct dasd_device * device)
125 * Remove all inodes in the system for a device, delete the 124 * Remove all inodes in the system for a device, delete the
126 * partitions and make device unusable by setting its size to zero. 125 * partitions and make device unusable by setting its size to zero.
127 */ 126 */
128void 127void dasd_destroy_partitions(struct dasd_block *block)
129dasd_destroy_partitions(struct dasd_device * device)
130{ 128{
131 /* The two structs have 168/176 byte on 31/64 bit. */ 129 /* The two structs have 168/176 byte on 31/64 bit. */
132 struct blkpg_partition bpart; 130 struct blkpg_partition bpart;
@@ -137,8 +135,8 @@ dasd_destroy_partitions(struct dasd_device * device)
137 * Get the bdev pointer from the device structure and clear 135 * Get the bdev pointer from the device structure and clear
138 * device->bdev to lower the offline open_count limit again. 136 * device->bdev to lower the offline open_count limit again.
139 */ 137 */
140 bdev = device->bdev; 138 bdev = block->bdev;
141 device->bdev = NULL; 139 block->bdev = NULL;
142 140
143 /* 141 /*
144 * See fs/partition/check.c:delete_partition 142 * See fs/partition/check.c:delete_partition
@@ -149,17 +147,16 @@ dasd_destroy_partitions(struct dasd_device * device)
149 memset(&barg, 0, sizeof(struct blkpg_ioctl_arg)); 147 memset(&barg, 0, sizeof(struct blkpg_ioctl_arg));
150 barg.data = (void __force __user *) &bpart; 148 barg.data = (void __force __user *) &bpart;
151 barg.op = BLKPG_DEL_PARTITION; 149 barg.op = BLKPG_DEL_PARTITION;
152 for (bpart.pno = device->gdp->minors - 1; bpart.pno > 0; bpart.pno--) 150 for (bpart.pno = block->gdp->minors - 1; bpart.pno > 0; bpart.pno--)
153 ioctl_by_bdev(bdev, BLKPG, (unsigned long) &barg); 151 ioctl_by_bdev(bdev, BLKPG, (unsigned long) &barg);
154 152
155 invalidate_partition(device->gdp, 0); 153 invalidate_partition(block->gdp, 0);
156 /* Matching blkdev_put to the blkdev_get in dasd_scan_partitions. */ 154 /* Matching blkdev_put to the blkdev_get in dasd_scan_partitions. */
157 blkdev_put(bdev); 155 blkdev_put(bdev);
158 set_capacity(device->gdp, 0); 156 set_capacity(block->gdp, 0);
159} 157}
160 158
161int 159int dasd_gendisk_init(void)
162dasd_gendisk_init(void)
163{ 160{
164 int rc; 161 int rc;
165 162
@@ -174,8 +171,7 @@ dasd_gendisk_init(void)
174 return 0; 171 return 0;
175} 172}
176 173
177void 174void dasd_gendisk_exit(void)
178dasd_gendisk_exit(void)
179{ 175{
180 unregister_blkdev(DASD_MAJOR, "dasd"); 176 unregister_blkdev(DASD_MAJOR, "dasd");
181} 177}