Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

s390: port block device access to file

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>

+25 -25
+5 -5
drivers/s390/block/dasd.c
··· 412 412 KOBJ_CHANGE); 413 413 return 0; 414 414 } 415 - disk_uevent(device->block->bdev_handle->bdev->bd_disk, 415 + disk_uevent(file_bdev(device->block->bdev_file)->bd_disk, 416 416 KOBJ_CHANGE); 417 417 } 418 418 return 0; ··· 433 433 434 434 device->state = DASD_STATE_READY; 435 435 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, 437 437 KOBJ_CHANGE); 438 438 return 0; 439 439 } ··· 3588 3588 * in the other openers. 3589 3589 */ 3590 3590 if (device->block) { 3591 - max_count = device->block->bdev_handle ? 0 : -1; 3591 + max_count = device->block->bdev_file ? 0 : -1; 3592 3592 open_count = atomic_read(&device->block->open_count); 3593 3593 if (open_count > max_count) { 3594 3594 if (open_count > 0) ··· 3634 3634 * so sync bdev first and then wait for our queues to become 3635 3635 * empty 3636 3636 */ 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); 3639 3639 dasd_schedule_device_bh(device); 3640 3640 rc = wait_event_interruptible(shutdown_waitq, 3641 3641 _wait_for_empty_queues(device));
+18 -18
drivers/s390/block/dasd_genhd.c
··· 127 127 */ 128 128 int dasd_scan_partitions(struct dasd_block *block) 129 129 { 130 - struct bdev_handle *bdev_handle; 130 + struct file *bdev_file; 131 131 int rc; 132 132 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, 134 134 NULL, NULL); 135 - if (IS_ERR(bdev_handle)) { 135 + if (IS_ERR(bdev_file)) { 136 136 DBF_DEV_EVENT(DBF_ERR, block->base, 137 137 "scan partitions error, blkdev_get returned %ld", 138 - PTR_ERR(bdev_handle)); 138 + PTR_ERR(bdev_file)); 139 139 return -ENODEV; 140 140 } 141 141 ··· 147 147 "scan partitions error, rc %d", rc); 148 148 149 149 /* 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 152 152 * 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 154 154 * (see dasd_generic_set_offline). As long as the partition detection 155 155 * 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. 157 157 */ 158 - block->bdev_handle = bdev_handle; 158 + block->bdev_file = bdev_file; 159 159 return 0; 160 160 } 161 161 ··· 165 165 */ 166 166 void dasd_destroy_partitions(struct dasd_block *block) 167 167 { 168 - struct bdev_handle *bdev_handle; 168 + struct file *bdev_file; 169 169 170 170 /* 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. 173 173 */ 174 - bdev_handle = block->bdev_handle; 175 - block->bdev_handle = NULL; 174 + bdev_file = block->bdev_file; 175 + block->bdev_file = NULL; 176 176 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); 180 180 181 181 /* Matching blkdev_put to the blkdev_get in dasd_scan_partitions. */ 182 - bdev_release(bdev_handle); 182 + fput(bdev_file); 183 183 } 184 184 185 185 int dasd_gendisk_init(void)
+1 -1
drivers/s390/block/dasd_int.h
··· 650 650 struct gendisk *gdp; 651 651 spinlock_t request_queue_lock; 652 652 struct blk_mq_tag_set tag_set; 653 - struct bdev_handle *bdev_handle; 653 + struct file *bdev_file; 654 654 atomic_t open_count; 655 655 656 656 unsigned long blocks; /* size of volume in blocks */
+1 -1
drivers/s390/block/dasd_ioctl.c
··· 537 537 * This must be hidden from user-space. 538 538 */ 539 539 dasd_info->open_count = atomic_read(&block->open_count); 540 - if (!block->bdev_handle) 540 + if (!block->bdev_file) 541 541 dasd_info->open_count++; 542 542 543 543 /*