block: move the dax flag to queue_limits
Move the dax flag into the queue_limits feature field so that it can be set atomically with the queue frozen. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Damien Le Moal <dlemoal@kernel.org> Reviewed-by: Hannes Reinecke <hare@suse.de> Link: https://lore.kernel.org/r/20240617060532.127975-21-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
f76af42f8b
commit
f467fee48d
@ -88,7 +88,6 @@ static const char *const blk_queue_flag_name[] = {
|
||||
QUEUE_FLAG_NAME(SAME_FORCE),
|
||||
QUEUE_FLAG_NAME(INIT_DONE),
|
||||
QUEUE_FLAG_NAME(POLL),
|
||||
QUEUE_FLAG_NAME(DAX),
|
||||
QUEUE_FLAG_NAME(STATS),
|
||||
QUEUE_FLAG_NAME(REGISTERED),
|
||||
QUEUE_FLAG_NAME(QUIESCED),
|
||||
|
@ -1834,11 +1834,11 @@ int dm_table_set_restrictions(struct dm_table *t, struct request_queue *q,
|
||||
limits->features |= BLK_FEAT_WRITE_CACHE | BLK_FEAT_FUA;
|
||||
|
||||
if (dm_table_supports_dax(t, device_not_dax_capable)) {
|
||||
blk_queue_flag_set(QUEUE_FLAG_DAX, q);
|
||||
limits->features |= BLK_FEAT_DAX;
|
||||
if (dm_table_supports_dax(t, device_not_dax_synchronous_capable))
|
||||
set_dax_synchronous(t->md->dax_dev);
|
||||
} else
|
||||
blk_queue_flag_clear(QUEUE_FLAG_DAX, q);
|
||||
limits->features &= ~BLK_FEAT_DAX;
|
||||
|
||||
if (dm_table_any_dev_attr(t, device_dax_write_cache_enabled, NULL))
|
||||
dax_write_cache(t->md->dax_dev, true);
|
||||
|
@ -465,7 +465,6 @@ static int pmem_attach_disk(struct device *dev,
|
||||
struct dax_device *dax_dev;
|
||||
struct nd_pfn_sb *pfn_sb;
|
||||
struct pmem_device *pmem;
|
||||
struct request_queue *q;
|
||||
struct gendisk *disk;
|
||||
void *addr;
|
||||
int rc;
|
||||
@ -499,6 +498,8 @@ static int pmem_attach_disk(struct device *dev,
|
||||
}
|
||||
if (fua)
|
||||
lim.features |= BLK_FEAT_FUA;
|
||||
if (is_nd_pfn(dev))
|
||||
lim.features |= BLK_FEAT_DAX;
|
||||
|
||||
if (!devm_request_mem_region(dev, res->start, resource_size(res),
|
||||
dev_name(&ndns->dev))) {
|
||||
@ -509,7 +510,6 @@ static int pmem_attach_disk(struct device *dev,
|
||||
disk = blk_alloc_disk(&lim, nid);
|
||||
if (IS_ERR(disk))
|
||||
return PTR_ERR(disk);
|
||||
q = disk->queue;
|
||||
|
||||
pmem->disk = disk;
|
||||
pmem->pgmap.owner = pmem;
|
||||
@ -547,9 +547,6 @@ static int pmem_attach_disk(struct device *dev,
|
||||
}
|
||||
pmem->virt_addr = addr;
|
||||
|
||||
if (pmem->pfn_flags & PFN_MAP)
|
||||
blk_queue_flag_set(QUEUE_FLAG_DAX, q);
|
||||
|
||||
disk->fops = &pmem_fops;
|
||||
disk->private_data = pmem;
|
||||
nvdimm_namespace_disk_name(ndns, disk->disk_name);
|
||||
|
@ -548,6 +548,7 @@ dcssblk_add_store(struct device *dev, struct device_attribute *attr, const char
|
||||
{
|
||||
struct queue_limits lim = {
|
||||
.logical_block_size = 4096,
|
||||
.features = BLK_FEAT_DAX,
|
||||
};
|
||||
int rc, i, j, num_of_segments;
|
||||
struct dcssblk_dev_info *dev_info;
|
||||
@ -643,7 +644,6 @@ dcssblk_add_store(struct device *dev, struct device_attribute *attr, const char
|
||||
dev_info->gd->fops = &dcssblk_devops;
|
||||
dev_info->gd->private_data = dev_info;
|
||||
dev_info->gd->flags |= GENHD_FL_NO_PART;
|
||||
blk_queue_flag_set(QUEUE_FLAG_DAX, dev_info->gd->queue);
|
||||
|
||||
seg_byte_size = (dev_info->end - dev_info->start + 1);
|
||||
set_capacity(dev_info->gd, seg_byte_size >> 9); // size in sectors
|
||||
|
@ -307,6 +307,9 @@ enum {
|
||||
|
||||
/* supports REQ_NOWAIT */
|
||||
BLK_FEAT_NOWAIT = (1u << 7),
|
||||
|
||||
/* supports DAX */
|
||||
BLK_FEAT_DAX = (1u << 8),
|
||||
};
|
||||
|
||||
/*
|
||||
@ -575,7 +578,6 @@ struct request_queue {
|
||||
#define QUEUE_FLAG_SAME_FORCE 12 /* force complete on same CPU */
|
||||
#define QUEUE_FLAG_INIT_DONE 14 /* queue is initialized */
|
||||
#define QUEUE_FLAG_POLL 16 /* IO polling enabled if set */
|
||||
#define QUEUE_FLAG_DAX 19 /* device supports DAX */
|
||||
#define QUEUE_FLAG_STATS 20 /* track IO start and completion times */
|
||||
#define QUEUE_FLAG_REGISTERED 22 /* queue has been registered to a disk */
|
||||
#define QUEUE_FLAG_QUIESCED 24 /* queue has been quiesced */
|
||||
@ -602,7 +604,7 @@ bool blk_queue_flag_test_and_set(unsigned int flag, struct request_queue *q);
|
||||
#define blk_queue_io_stat(q) ((q)->limits.features & BLK_FEAT_IO_STAT)
|
||||
#define blk_queue_zone_resetall(q) \
|
||||
test_bit(QUEUE_FLAG_ZONE_RESETALL, &(q)->queue_flags)
|
||||
#define blk_queue_dax(q) test_bit(QUEUE_FLAG_DAX, &(q)->queue_flags)
|
||||
#define blk_queue_dax(q) ((q)->limits.features & BLK_FEAT_DAX)
|
||||
#define blk_queue_pci_p2pdma(q) \
|
||||
test_bit(QUEUE_FLAG_PCI_P2PDMA, &(q)->queue_flags)
|
||||
#ifdef CONFIG_BLK_RQ_ALLOC_TIME
|
||||
|
Loading…
Reference in New Issue
Block a user