All of lore.kernel.org
 help / color / mirror / Atom feed
From: Damien Le Moal <damien.lemoal@wdc.com>
To: linux-block@vger.kernel.org, Jens Axboe <axboe@kernel.dk>
Subject: [PATCH 5/7] block: Introduce zoned block device elevator feature
Date: Fri, 23 Aug 2019 09:15:26 +0900	[thread overview]
Message-ID: <20190823001528.5673-6-damien.lemoal@wdc.com> (raw)
In-Reply-To: <20190823001528.5673-1-damien.lemoal@wdc.com>

Introduce the elevator feature ELEVATOR_F_ZONED_BLOCK_DEV to indicate
that an elevator supports zoned block device write ordering control.

Mark the mq-deadline as supporting this feature which is implemented
using zone write locking. SCSI zoned block device scan and null_blk
device creation with zoned mode enabled are also modified to require
this feature using the helper blk_queue_required_elevator_features().

This requirement can always be satisfied as the mq-deadline scheduler is
always selected for in-kernel compilation when CONFIG_BLK_DEV_ZONED
(zoned block device support) is enabled.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
---
 block/mq-deadline.c           | 1 +
 drivers/block/null_blk_main.c | 5 +++++
 drivers/scsi/sd_zbc.c         | 2 ++
 include/linux/elevator.h      | 7 +++++++
 4 files changed, 15 insertions(+)

diff --git a/block/mq-deadline.c b/block/mq-deadline.c
index 2a2a2e82832e..95e03408f2ac 100644
--- a/block/mq-deadline.c
+++ b/block/mq-deadline.c
@@ -795,6 +795,7 @@ static struct elevator_type mq_deadline = {
 	.elevator_attrs = deadline_attrs,
 	.elevator_name = "mq-deadline",
 	.elevator_alias = "deadline",
+	.elevator_features = ELEVATOR_F_ZONED_BLOCK_DEV,
 	.elevator_owner = THIS_MODULE,
 };
 MODULE_ALIAS("mq-deadline-iosched");
diff --git a/drivers/block/null_blk_main.c b/drivers/block/null_blk_main.c
index 99c56d72ff78..253bb7b4443e 100644
--- a/drivers/block/null_blk_main.c
+++ b/drivers/block/null_blk_main.c
@@ -1538,6 +1538,9 @@ static int null_gendisk_register(struct nullb *nullb)
 
 		if (ret != 0)
 			return ret;
+
+		blk_queue_required_elevator_features(disk->queue,
+						ELEVATOR_F_ZONED_BLOCK_DEV);
 	}
 
 	add_disk(disk);
@@ -1691,6 +1694,8 @@ static int null_add_dev(struct nullb_device *dev)
 		blk_queue_chunk_sectors(nullb->q, dev->zone_size_sects);
 		nullb->q->limits.zoned = BLK_ZONED_HM;
 		blk_queue_flag_set(QUEUE_FLAG_ZONE_RESETALL, nullb->q);
+		blk_queue_required_elevator_features(nullb->q,
+						ELEVATOR_F_ZONED_BLOCK_DEV);
 	}
 
 	nullb->q->queuedata = nullb;
diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c
index 367614f0e34f..983f5d0be902 100644
--- a/drivers/scsi/sd_zbc.c
+++ b/drivers/scsi/sd_zbc.c
@@ -490,6 +490,8 @@ int sd_zbc_read_zones(struct scsi_disk *sdkp, unsigned char *buf)
 		goto err;
 
 	/* The drive satisfies the kernel restrictions: set it up */
+	blk_queue_required_elevator_features(sdkp->disk->queue,
+					     ELEVATOR_F_ZONED_BLOCK_DEV);
 	blk_queue_chunk_sectors(sdkp->disk->queue,
 			logical_to_sectors(sdkp->device, zone_blocks));
 	blk_queue_flag_set(QUEUE_FLAG_ZONE_RESETALL, sdkp->disk->queue);
diff --git a/include/linux/elevator.h b/include/linux/elevator.h
index a99ca9979d71..2b667cb23fc0 100644
--- a/include/linux/elevator.h
+++ b/include/linux/elevator.h
@@ -166,5 +166,12 @@ extern struct request *elv_rb_find(struct rb_root *, sector_t);
 #define rq_entry_fifo(ptr)	list_entry((ptr), struct request, queuelist)
 #define rq_fifo_clear(rq)	list_del_init(&(rq)->queuelist)
 
+/*
+ * Elevator features.
+ */
+
+/* Supports zoned block devices sequential write */
+#define ELEVATOR_F_ZONED_BLOCK_DEV	(1UL << 0)
+
 #endif /* CONFIG_BLOCK */
 #endif
-- 
2.21.0


  parent reply	other threads:[~2019-08-23  0:15 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-23  0:15 [PATCH 0/7] Elevator cleanups and improvements Damien Le Moal
2019-08-23  0:15 ` [PATCH 1/7] block: Cleanup elevator_init_mq() use Damien Le Moal
2019-08-23  8:08   ` Johannes Thumshirn
2019-08-23  0:15 ` [PATCH 2/7] block: Change elevator_init_mq() to always succeed Damien Le Moal
2019-08-23  8:54   ` Johannes Thumshirn
2019-08-23  0:15 ` [PATCH 3/7] block: Remove sysfs lock from elevator_init_rq() Damien Le Moal
2019-08-23  9:00   ` Johannes Thumshirn
2019-08-23 20:32   ` Bart Van Assche
2019-08-23  0:15 ` [PATCH 4/7] block: Introduce elevator features Damien Le Moal
2019-08-23 11:19   ` Johannes Thumshirn
2019-08-23  0:15 ` Damien Le Moal [this message]
2019-08-23 11:41   ` [PATCH 5/7] block: Introduce zoned block device elevator feature Johannes Thumshirn
2019-08-23  0:15 ` [PATCH 6/7] block: Improve default elevator selection Damien Le Moal
2019-08-23  0:15 ` [PATCH 7/7] block: Delay default elevator initialization Damien Le Moal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190823001528.5673-6-damien.lemoal@wdc.com \
    --to=damien.lemoal@wdc.com \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.