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

Configure Feed

Select the types of activity you want to include in your feed.

nvdimm-btt: convert to blk_alloc_disk/blk_cleanup_disk

Convert the nvdimm-btt driver to use the blk_alloc_disk and
blk_cleanup_disk helpers to simplify gendisk and request_queue
allocation.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Link: https://lore.kernel.org/r/20210521055116.1053587-17-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Christoph Hellwig and committed by
Jens Axboe
d4e4e583 6c552cea

+7 -19
+7 -17
drivers/nvdimm/btt.c
··· 1521 1521 struct nd_btt *nd_btt = btt->nd_btt; 1522 1522 struct nd_namespace_common *ndns = nd_btt->ndns; 1523 1523 1524 - /* create a new disk and request queue for btt */ 1525 - btt->btt_queue = blk_alloc_queue(NUMA_NO_NODE); 1526 - if (!btt->btt_queue) 1524 + btt->btt_disk = blk_alloc_disk(NUMA_NO_NODE); 1525 + if (!btt->btt_disk) 1527 1526 return -ENOMEM; 1528 - 1529 - btt->btt_disk = alloc_disk(0); 1530 - if (!btt->btt_disk) { 1531 - blk_cleanup_queue(btt->btt_queue); 1532 - return -ENOMEM; 1533 - } 1534 1527 1535 1528 nvdimm_namespace_disk_name(ndns, btt->btt_disk->disk_name); 1536 1529 btt->btt_disk->first_minor = 0; 1537 1530 btt->btt_disk->fops = &btt_fops; 1538 1531 btt->btt_disk->private_data = btt; 1539 - btt->btt_disk->queue = btt->btt_queue; 1540 1532 1541 - blk_queue_logical_block_size(btt->btt_queue, btt->sector_size); 1542 - blk_queue_max_hw_sectors(btt->btt_queue, UINT_MAX); 1543 - blk_queue_flag_set(QUEUE_FLAG_NONROT, btt->btt_queue); 1533 + blk_queue_logical_block_size(btt->btt_disk->queue, btt->sector_size); 1534 + blk_queue_max_hw_sectors(btt->btt_disk->queue, UINT_MAX); 1535 + blk_queue_flag_set(QUEUE_FLAG_NONROT, btt->btt_disk->queue); 1544 1536 1545 1537 if (btt_meta_size(btt)) { 1546 1538 int rc = nd_integrity_init(btt->btt_disk, btt_meta_size(btt)); 1547 1539 1548 1540 if (rc) { 1549 1541 del_gendisk(btt->btt_disk); 1550 - put_disk(btt->btt_disk); 1551 - blk_cleanup_queue(btt->btt_queue); 1542 + blk_cleanup_disk(btt->btt_disk); 1552 1543 return rc; 1553 1544 } 1554 1545 } ··· 1554 1563 static void btt_blk_cleanup(struct btt *btt) 1555 1564 { 1556 1565 del_gendisk(btt->btt_disk); 1557 - put_disk(btt->btt_disk); 1558 - blk_cleanup_queue(btt->btt_queue); 1566 + blk_cleanup_disk(btt->btt_disk); 1559 1567 } 1560 1568 1561 1569 /**
-2
drivers/nvdimm/btt.h
··· 201 201 /** 202 202 * struct btt - handle for a BTT instance 203 203 * @btt_disk: Pointer to the gendisk for BTT device 204 - * @btt_queue: Pointer to the request queue for the BTT device 205 204 * @arena_list: Head of the list of arenas 206 205 * @debugfs_dir: Debugfs dentry 207 206 * @nd_btt: Parent nd_btt struct ··· 218 219 */ 219 220 struct btt { 220 221 struct gendisk *btt_disk; 221 - struct request_queue *btt_queue; 222 222 struct list_head arena_list; 223 223 struct dentry *debugfs_dir; 224 224 struct nd_btt *nd_btt;