Skip to content

Commit 9c1e42e

Browse files
Christoph Hellwigaxboe
authored andcommitted
block: move the pci_p2pdma flag to queue_limits
Move the pci_p2pdma 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-25-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent a52758a commit 9c1e42e

3 files changed

Lines changed: 7 additions & 9 deletions

File tree

block/blk-mq-debugfs.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ static const char *const blk_queue_flag_name[] = {
9090
QUEUE_FLAG_NAME(STATS),
9191
QUEUE_FLAG_NAME(REGISTERED),
9292
QUEUE_FLAG_NAME(QUIESCED),
93-
QUEUE_FLAG_NAME(PCI_P2PDMA),
9493
QUEUE_FLAG_NAME(RQ_ALLOC_TIME),
9594
QUEUE_FLAG_NAME(HCTX_ACTIVE),
9695
QUEUE_FLAG_NAME(SQ_SCHED),

drivers/nvme/host/core.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3735,6 +3735,9 @@ static void nvme_alloc_ns(struct nvme_ctrl *ctrl, struct nvme_ns_info *info)
37353735

37363736
if (ctrl->opts && ctrl->opts->data_digest)
37373737
lim.features |= BLK_FEAT_STABLE_WRITES;
3738+
if (ctrl->ops->supports_pci_p2pdma &&
3739+
ctrl->ops->supports_pci_p2pdma(ctrl))
3740+
lim.features |= BLK_FEAT_PCI_P2PDMA;
37383741

37393742
disk = blk_mq_alloc_disk(ctrl->tagset, &lim, ns);
37403743
if (IS_ERR(disk))
@@ -3744,11 +3747,6 @@ static void nvme_alloc_ns(struct nvme_ctrl *ctrl, struct nvme_ns_info *info)
37443747

37453748
ns->disk = disk;
37463749
ns->queue = disk->queue;
3747-
3748-
if (ctrl->ops->supports_pci_p2pdma &&
3749-
ctrl->ops->supports_pci_p2pdma(ctrl))
3750-
blk_queue_flag_set(QUEUE_FLAG_PCI_P2PDMA, ns->queue);
3751-
37523750
ns->ctrl = ctrl;
37533751
kref_init(&ns->kref);
37543752

include/linux/blkdev.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,9 @@ enum {
319319

320320
/* supports Zone Reset All */
321321
BLK_FEAT_ZONE_RESETALL = (1u << 11),
322+
323+
/* supports PCI(e) p2p requests */
324+
BLK_FEAT_PCI_P2PDMA = (1u << 12),
322325
};
323326

324327
/*
@@ -588,7 +591,6 @@ struct request_queue {
588591
#define QUEUE_FLAG_STATS 20 /* track IO start and completion times */
589592
#define QUEUE_FLAG_REGISTERED 22 /* queue has been registered to a disk */
590593
#define QUEUE_FLAG_QUIESCED 24 /* queue has been quiesced */
591-
#define QUEUE_FLAG_PCI_P2PDMA 25 /* device supports PCI p2p requests */
592594
#define QUEUE_FLAG_RQ_ALLOC_TIME 27 /* record rq->alloc_time_ns */
593595
#define QUEUE_FLAG_HCTX_ACTIVE 28 /* at least one blk-mq hctx is active */
594596
#define QUEUE_FLAG_SQ_SCHED 30 /* single queue style io dispatch */
@@ -611,8 +613,7 @@ bool blk_queue_flag_test_and_set(unsigned int flag, struct request_queue *q);
611613
#define blk_queue_zone_resetall(q) \
612614
((q)->limits.features & BLK_FEAT_ZONE_RESETALL)
613615
#define blk_queue_dax(q) ((q)->limits.features & BLK_FEAT_DAX)
614-
#define blk_queue_pci_p2pdma(q) \
615-
test_bit(QUEUE_FLAG_PCI_P2PDMA, &(q)->queue_flags)
616+
#define blk_queue_pci_p2pdma(q) ((q)->limits.features & BLK_FEAT_PCI_P2PDMA)
616617
#ifdef CONFIG_BLK_RQ_ALLOC_TIME
617618
#define blk_queue_rq_alloc_time(q) \
618619
test_bit(QUEUE_FLAG_RQ_ALLOC_TIME, &(q)->queue_flags)

0 commit comments

Comments
 (0)