Link: https://lore.kernel.org/r/20240123-vfs-bdev-file-v2-16-adbd023e19cc@kernel.org Reviewed-by: Jan Kara <jack@suse.cz> Signed-off-by: Christian Brauner <brauner@kernel.org>
···412412 KOBJ_CHANGE);413413 return 0;414414 }415415- disk_uevent(device->block->bdev_handle->bdev->bd_disk,415415+ disk_uevent(file_bdev(device->block->bdev_file)->bd_disk,416416 KOBJ_CHANGE);417417 }418418 return 0;···433433434434 device->state = DASD_STATE_READY;435435 if (device->block && !(device->features & DASD_FEATURE_USERAW))436436- disk_uevent(device->block->bdev_handle->bdev->bd_disk,436436+ disk_uevent(file_bdev(device->block->bdev_file)->bd_disk,437437 KOBJ_CHANGE);438438 return 0;439439}···35883588 * in the other openers.35893589 */35903590 if (device->block) {35913591- max_count = device->block->bdev_handle ? 0 : -1;35913591+ 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)···36343634 * so sync bdev first and then wait for our queues to become36353635 * empty36363636 */36373637- if (device->block && device->block->bdev_handle)36383638- bdev_mark_dead(device->block->bdev_handle->bdev, false);36373637+ if (device->block && device->block->bdev_file)36383638+ 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));
+18-18
drivers/s390/block/dasd_genhd.c
···127127 */128128int dasd_scan_partitions(struct dasd_block *block)129129{130130- struct bdev_handle *bdev_handle;130130+ struct file *bdev_file;131131 int rc;132132133133- bdev_handle = bdev_open_by_dev(disk_devt(block->gdp), BLK_OPEN_READ,133133+ bdev_file = bdev_file_open_by_dev(disk_devt(block->gdp), BLK_OPEN_READ,134134 NULL, NULL);135135- if (IS_ERR(bdev_handle)) {135135+ if (IS_ERR(bdev_file)) {136136 DBF_DEV_EVENT(DBF_ERR, block->base,137137 "scan partitions error, blkdev_get returned %ld",138138- PTR_ERR(bdev_handle));138138+ PTR_ERR(bdev_file));139139 return -ENODEV;140140 }141141···147147 "scan partitions error, rc %d", rc);148148149149 /*150150- * Since the matching bdev_release() call to the151151- * bdev_open_by_path() in this function is not called before150150+ * Since the matching fput() call to the151151+ * bdev_file_open_by_path() in this function is not called before152152 * dasd_destroy_partitions the offline open_count limit needs to be153153- * increased from 0 to 1. This is done by setting device->bdev_handle153153+ * increased from 0 to 1. This is done by setting device->bdev_file154154 * (see dasd_generic_set_offline). As long as the partition detection155155 * is running no offline should be allowed. That is why the assignment156156- * to block->bdev_handle is done AFTER the BLKRRPART ioctl.156156+ * to block->bdev_file is done AFTER the BLKRRPART ioctl.157157 */158158- block->bdev_handle = bdev_handle;158158+ block->bdev_file = bdev_file;159159 return 0;160160}161161···165165 */166166void dasd_destroy_partitions(struct dasd_block *block)167167{168168- struct bdev_handle *bdev_handle;168168+ struct file *bdev_file;169169170170 /*171171- * Get the bdev_handle pointer from the device structure and clear172172- * device->bdev_handle to lower the offline open_count limit again.171171+ * Get the bdev_file pointer from the device structure and clear172172+ * device->bdev_file to lower the offline open_count limit again.173173 */174174- bdev_handle = block->bdev_handle;175175- block->bdev_handle = NULL;174174+ bdev_file = block->bdev_file;175175+ block->bdev_file = NULL;176176177177- mutex_lock(&bdev_handle->bdev->bd_disk->open_mutex);178178- bdev_disk_changed(bdev_handle->bdev->bd_disk, true);179179- mutex_unlock(&bdev_handle->bdev->bd_disk->open_mutex);177177+ mutex_lock(&file_bdev(bdev_file)->bd_disk->open_mutex);178178+ bdev_disk_changed(file_bdev(bdev_file)->bd_disk, true);179179+ mutex_unlock(&file_bdev(bdev_file)->bd_disk->open_mutex);180180181181 /* Matching blkdev_put to the blkdev_get in dasd_scan_partitions. */182182- bdev_release(bdev_handle);182182+ fput(bdev_file);183183}184184185185int dasd_gendisk_init(void)
+1-1
drivers/s390/block/dasd_int.h
···650650 struct gendisk *gdp;651651 spinlock_t request_queue_lock;652652 struct blk_mq_tag_set tag_set;653653- struct bdev_handle *bdev_handle;653653+ struct file *bdev_file;654654 atomic_t open_count;655655656656 unsigned long blocks; /* size of volume in blocks */
+1-1
drivers/s390/block/dasd_ioctl.c
···537537 * This must be hidden from user-space.538538 */539539 dasd_info->open_count = atomic_read(&block->open_count);540540- if (!block->bdev_handle)540540+ if (!block->bdev_file)541541 dasd_info->open_count++;542542543543 /*