hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/s390/block/dasd_genhd.c
....@@ -76,7 +76,7 @@
7676 gdp->queue = block->request_queue;
7777 block->gdp = gdp;
7878 set_capacity(block->gdp, 0);
79
- device_add_disk(&base->cdev->dev, block->gdp);
79
+ device_add_disk(&base->cdev->dev, block->gdp, NULL);
8080 return 0;
8181 }
8282
....@@ -101,22 +101,17 @@
101101 struct block_device *bdev;
102102 int rc;
103103
104
- bdev = bdget_disk(block->gdp, 0);
105
- if (!bdev) {
106
- DBF_DEV_EVENT(DBF_ERR, block->base, "%s",
107
- "scan partitions error, bdget returned NULL");
108
- return -ENODEV;
109
- }
110
-
111
- rc = blkdev_get(bdev, FMODE_READ, NULL);
112
- if (rc < 0) {
104
+ bdev = blkdev_get_by_dev(disk_devt(block->gdp), FMODE_READ, NULL);
105
+ if (IS_ERR(bdev)) {
113106 DBF_DEV_EVENT(DBF_ERR, block->base,
114
- "scan partitions error, blkdev_get returned %d",
115
- rc);
107
+ "scan partitions error, blkdev_get returned %ld",
108
+ PTR_ERR(bdev));
116109 return -ENODEV;
117110 }
118111
119
- rc = blkdev_reread_part(bdev);
112
+ mutex_lock(&bdev->bd_mutex);
113
+ rc = bdev_disk_changed(bdev, false);
114
+ mutex_unlock(&bdev->bd_mutex);
120115 if (rc)
121116 DBF_DEV_EVENT(DBF_ERR, block->base,
122117 "scan partitions error, rc %d", rc);
....@@ -141,9 +136,6 @@
141136 */
142137 void dasd_destroy_partitions(struct dasd_block *block)
143138 {
144
- /* The two structs have 168/176 byte on 31/64 bit. */
145
- struct blkpg_partition bpart;
146
- struct blkpg_ioctl_arg barg;
147139 struct block_device *bdev;
148140
149141 /*
....@@ -153,19 +145,10 @@
153145 bdev = block->bdev;
154146 block->bdev = NULL;
155147
156
- /*
157
- * See fs/partition/check.c:delete_partition
158
- * Can't call delete_partitions directly. Use ioctl.
159
- * The ioctl also does locking and invalidation.
160
- */
161
- memset(&bpart, 0, sizeof(struct blkpg_partition));
162
- memset(&barg, 0, sizeof(struct blkpg_ioctl_arg));
163
- barg.data = (void __force __user *) &bpart;
164
- barg.op = BLKPG_DEL_PARTITION;
165
- for (bpart.pno = block->gdp->minors - 1; bpart.pno > 0; bpart.pno--)
166
- ioctl_by_bdev(bdev, BLKPG, (unsigned long) &barg);
148
+ mutex_lock(&bdev->bd_mutex);
149
+ blk_drop_partitions(bdev);
150
+ mutex_unlock(&bdev->bd_mutex);
167151
168
- invalidate_partition(block->gdp, 0);
169152 /* Matching blkdev_put to the blkdev_get in dasd_scan_partitions. */
170153 blkdev_put(bdev, FMODE_READ);
171154 set_capacity(block->gdp, 0);