Skip to content

Commit c8e108d

Browse files
committed
s390: port block device access to file
Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Jan Kara <[email protected]> Signed-off-by: Christian Brauner <[email protected]>
1 parent e9a7254 commit c8e108d

File tree

4 files changed

+25
-25
lines changed

4 files changed

+25
-25
lines changed

drivers/s390/block/dasd.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ dasd_state_ready_to_online(struct dasd_device * device)
412412
KOBJ_CHANGE);
413413
return 0;
414414
}
415-
disk_uevent(device->block->bdev_handle->bdev->bd_disk,
415+
disk_uevent(file_bdev(device->block->bdev_file)->bd_disk,
416416
KOBJ_CHANGE);
417417
}
418418
return 0;
@@ -433,7 +433,7 @@ static int dasd_state_online_to_ready(struct dasd_device *device)
433433

434434
device->state = DASD_STATE_READY;
435435
if (device->block && !(device->features & DASD_FEATURE_USERAW))
436-
disk_uevent(device->block->bdev_handle->bdev->bd_disk,
436+
disk_uevent(file_bdev(device->block->bdev_file)->bd_disk,
437437
KOBJ_CHANGE);
438438
return 0;
439439
}
@@ -3588,7 +3588,7 @@ int dasd_generic_set_offline(struct ccw_device *cdev)
35883588
* in the other openers.
35893589
*/
35903590
if (device->block) {
3591-
max_count = device->block->bdev_handle ? 0 : -1;
3591+
max_count = device->block->bdev_file ? 0 : -1;
35923592
open_count = atomic_read(&device->block->open_count);
35933593
if (open_count > max_count) {
35943594
if (open_count > 0)
@@ -3634,8 +3634,8 @@ int dasd_generic_set_offline(struct ccw_device *cdev)
36343634
* so sync bdev first and then wait for our queues to become
36353635
* empty
36363636
*/
3637-
if (device->block && device->block->bdev_handle)
3638-
bdev_mark_dead(device->block->bdev_handle->bdev, false);
3637+
if (device->block && device->block->bdev_file)
3638+
bdev_mark_dead(file_bdev(device->block->bdev_file), false);
36393639
dasd_schedule_device_bh(device);
36403640
rc = wait_event_interruptible(shutdown_waitq,
36413641
_wait_for_empty_queues(device));

drivers/s390/block/dasd_genhd.c

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -127,15 +127,15 @@ void dasd_gendisk_free(struct dasd_block *block)
127127
*/
128128
int dasd_scan_partitions(struct dasd_block *block)
129129
{
130-
struct bdev_handle *bdev_handle;
130+
struct file *bdev_file;
131131
int rc;
132132

133-
bdev_handle = bdev_open_by_dev(disk_devt(block->gdp), BLK_OPEN_READ,
133+
bdev_file = bdev_file_open_by_dev(disk_devt(block->gdp), BLK_OPEN_READ,
134134
NULL, NULL);
135-
if (IS_ERR(bdev_handle)) {
135+
if (IS_ERR(bdev_file)) {
136136
DBF_DEV_EVENT(DBF_ERR, block->base,
137137
"scan partitions error, blkdev_get returned %ld",
138-
PTR_ERR(bdev_handle));
138+
PTR_ERR(bdev_file));
139139
return -ENODEV;
140140
}
141141

@@ -147,15 +147,15 @@ int dasd_scan_partitions(struct dasd_block *block)
147147
"scan partitions error, rc %d", rc);
148148

149149
/*
150-
* Since the matching bdev_release() call to the
151-
* bdev_open_by_path() in this function is not called before
150+
* Since the matching fput() call to the
151+
* bdev_file_open_by_path() in this function is not called before
152152
* dasd_destroy_partitions the offline open_count limit needs to be
153-
* increased from 0 to 1. This is done by setting device->bdev_handle
153+
* increased from 0 to 1. This is done by setting device->bdev_file
154154
* (see dasd_generic_set_offline). As long as the partition detection
155155
* is running no offline should be allowed. That is why the assignment
156-
* to block->bdev_handle is done AFTER the BLKRRPART ioctl.
156+
* to block->bdev_file is done AFTER the BLKRRPART ioctl.
157157
*/
158-
block->bdev_handle = bdev_handle;
158+
block->bdev_file = bdev_file;
159159
return 0;
160160
}
161161

@@ -165,21 +165,21 @@ int dasd_scan_partitions(struct dasd_block *block)
165165
*/
166166
void dasd_destroy_partitions(struct dasd_block *block)
167167
{
168-
struct bdev_handle *bdev_handle;
168+
struct file *bdev_file;
169169

170170
/*
171-
* Get the bdev_handle pointer from the device structure and clear
172-
* device->bdev_handle to lower the offline open_count limit again.
171+
* Get the bdev_file pointer from the device structure and clear
172+
* device->bdev_file to lower the offline open_count limit again.
173173
*/
174-
bdev_handle = block->bdev_handle;
175-
block->bdev_handle = NULL;
174+
bdev_file = block->bdev_file;
175+
block->bdev_file = NULL;
176176

177-
mutex_lock(&bdev_handle->bdev->bd_disk->open_mutex);
178-
bdev_disk_changed(bdev_handle->bdev->bd_disk, true);
179-
mutex_unlock(&bdev_handle->bdev->bd_disk->open_mutex);
177+
mutex_lock(&file_bdev(bdev_file)->bd_disk->open_mutex);
178+
bdev_disk_changed(file_bdev(bdev_file)->bd_disk, true);
179+
mutex_unlock(&file_bdev(bdev_file)->bd_disk->open_mutex);
180180

181181
/* Matching blkdev_put to the blkdev_get in dasd_scan_partitions. */
182-
bdev_release(bdev_handle);
182+
fput(bdev_file);
183183
}
184184

185185
int dasd_gendisk_init(void)

drivers/s390/block/dasd_int.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,7 @@ struct dasd_block {
650650
struct gendisk *gdp;
651651
spinlock_t request_queue_lock;
652652
struct blk_mq_tag_set tag_set;
653-
struct bdev_handle *bdev_handle;
653+
struct file *bdev_file;
654654
atomic_t open_count;
655655

656656
unsigned long blocks; /* size of volume in blocks */

drivers/s390/block/dasd_ioctl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ static int __dasd_ioctl_information(struct dasd_block *block,
537537
* This must be hidden from user-space.
538538
*/
539539
dasd_info->open_count = atomic_read(&block->open_count);
540-
if (!block->bdev_handle)
540+
if (!block->bdev_file)
541541
dasd_info->open_count++;
542542

543543
/*

0 commit comments

Comments
 (0)