Commit e3f89564 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

null_blk: clean up the block device operations

Remove the pointless stub open and release methods, give the operations
vector a slightly less confusing name, and use normal alignment for the
assignment operators.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarDamien Le Moal <damien.lemoal@wdc.com>
Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
Reviewed-by: default avatarChaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 5eac3eb3
...@@ -1468,19 +1468,8 @@ static void null_config_discard(struct nullb *nullb) ...@@ -1468,19 +1468,8 @@ static void null_config_discard(struct nullb *nullb)
blk_queue_flag_set(QUEUE_FLAG_DISCARD, nullb->q); blk_queue_flag_set(QUEUE_FLAG_DISCARD, nullb->q);
} }
static int null_open(struct block_device *bdev, fmode_t mode) static const struct block_device_operations null_ops = {
{
return 0;
}
static void null_release(struct gendisk *disk, fmode_t mode)
{
}
static const struct block_device_operations null_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.open = null_open,
.release = null_release,
.report_zones = null_zone_report, .report_zones = null_zone_report,
}; };
...@@ -1582,7 +1571,7 @@ static int null_gendisk_register(struct nullb *nullb) ...@@ -1582,7 +1571,7 @@ static int null_gendisk_register(struct nullb *nullb)
disk->flags |= GENHD_FL_EXT_DEVT | GENHD_FL_SUPPRESS_PARTITION_INFO; disk->flags |= GENHD_FL_EXT_DEVT | GENHD_FL_SUPPRESS_PARTITION_INFO;
disk->major = null_major; disk->major = null_major;
disk->first_minor = nullb->index; disk->first_minor = nullb->index;
disk->fops = &null_fops; disk->fops = &null_ops;
disk->private_data = nullb; disk->private_data = nullb;
disk->queue = nullb->q; disk->queue = nullb->q;
strncpy(disk->disk_name, nullb->disk_name, DISK_NAME_LEN); strncpy(disk->disk_name, nullb->disk_name, DISK_NAME_LEN);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment