* [PATCH] btrfs-progs: add udev rule to use mq-deadline on zoned btrfs
@ 2022-01-25 13:22 Johannes Thumshirn
2022-01-25 14:20 ` David Sterba
0 siblings, 1 reply; 3+ messages in thread
From: Johannes Thumshirn @ 2022-01-25 13:22 UTC (permalink / raw)
To: David Sterba
Cc: Damien Le Moal, Naohiro Aota, linux-btrfs, Josef Bacik,
Johannes Thumshirn
As zoned btrfs uses regular writes for metadata, it needs zone write
locking in the IO scheduler. Add a udev rule that configures an IO
scheduler doing zone write locking.
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
---
64-btrfs-zoned.rules | 9 +++++++++
Makefile | 2 +-
2 files changed, 10 insertions(+), 1 deletion(-)
create mode 100644 64-btrfs-zoned.rules
diff --git a/64-btrfs-zoned.rules b/64-btrfs-zoned.rules
new file mode 100644
index 000000000000..d70e22740557
--- /dev/null
+++ b/64-btrfs-zoned.rules
@@ -0,0 +1,9 @@
+SUBSYSTEM!="block", GOTO="btrfs_end"
+ACTION!="add|change", GOTO="btrfs_end"
+ENV{ID_FS_TYPE}!="btrfs", GOTO="btrfs_end"
+
+# Zoned btrfs needs an IO scheduler that supports zone write locking and
+# currently mq-deadline is the only scheduler capable of this.
+ATTR{queue/zoned}=="host-managed", ATTR{queue/scheduler}="mq-deadline"
+
+LABEL="btrfs_end"
diff --git a/Makefile b/Makefile
index a75d9ad8de1c..1223ba6d069f 100644
--- a/Makefile
+++ b/Makefile
@@ -231,7 +231,7 @@ image_objects = image/main.o image/sanitize.o
all_objects = $(objects) $(cmds_objects) $(libbtrfs_objects) $(convert_objects) \
$(mkfs_objects) $(image_objects) $(libbtrfsutil_objects)
-udev_rules = 64-btrfs-dm.rules
+udev_rules = 64-btrfs-dm.rules 64-btrfs-zoned.rules
ifeq ("$(origin V)", "command line")
BUILD_VERBOSE = $(V)
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] btrfs-progs: add udev rule to use mq-deadline on zoned btrfs
2022-01-25 13:22 [PATCH] btrfs-progs: add udev rule to use mq-deadline on zoned btrfs Johannes Thumshirn
@ 2022-01-25 14:20 ` David Sterba
2022-01-25 14:28 ` Johannes Thumshirn
0 siblings, 1 reply; 3+ messages in thread
From: David Sterba @ 2022-01-25 14:20 UTC (permalink / raw)
To: Johannes Thumshirn
Cc: David Sterba, Damien Le Moal, Naohiro Aota, linux-btrfs,
Josef Bacik
On Tue, Jan 25, 2022 at 05:22:00AM -0800, Johannes Thumshirn wrote:
> As zoned btrfs uses regular writes for metadata, it needs zone write
> locking in the IO scheduler. Add a udev rule that configures an IO
> scheduler doing zone write locking.
I'm not sure how the udev rules are distributed nowadays, if it's
supposed to be packaged with the tools themselves or with
systemd-something. No problem adding it to btrfs-progs git but there
may be other parties interested.
Also, is there some sanity check in the zoned device driver to make sure
the mq-deadline is selected? To avoid accidental problems. Maybe we can
add some progs checks to to mkfs, if it makes sense to hardcode the io
scheduler name as they come and go in a rapid succession (measured on
geological time scale).
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] btrfs-progs: add udev rule to use mq-deadline on zoned btrfs
2022-01-25 14:20 ` David Sterba
@ 2022-01-25 14:28 ` Johannes Thumshirn
0 siblings, 0 replies; 3+ messages in thread
From: Johannes Thumshirn @ 2022-01-25 14:28 UTC (permalink / raw)
To: dsterba@suse.cz
Cc: linux-btrfs@vger.kernel.org, dsterba@suse.com, Damien Le Moal,
josef@toxicpanda.com, naohire.aota@wdc.com
On Tue, 2022-01-25 at 15:20 +0100, David Sterba wrote:
> On Tue, Jan 25, 2022 at 05:22:00AM -0800, Johannes Thumshirn wrote:
> > As zoned btrfs uses regular writes for metadata, it needs zone
> > write
> > locking in the IO scheduler. Add a udev rule that configures an IO
> > scheduler doing zone write locking.
>
> I'm not sure how the udev rules are distributed nowadays, if it's
> supposed to be packaged with the tools themselves or with
> systemd-something. No problem adding it to btrfs-progs git but there
> may be other parties interested.
This is where 64-btrfs-dm.rules is found so I guessed we're still
shipping the rule.
>
> Also, is there some sanity check in the zoned device driver to make
> sure
> the mq-deadline is selected? To avoid accidental problems. Maybe we
> can
> add some progs checks to to mkfs, if it makes sense to hardcode the
> io
> scheduler name as they come and go in a rapid succession (measured on
> geological time scale).
sd and null_blk specifically request an io scheduler that is capable of
doing zone write locking. NVMe doesn't as it want's to exploit as much
parallelism as possible, so we need to set it at least on ZNS NVMe.
I've opted out of encoding a match for NVMe into it as it won't hurt if
null_blk or sd are probed and get a mq-deadline switch.
I don't think we need to let mkfs do the scheduler switch, cause that
won't persist across reboots.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-01-25 14:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-25 13:22 [PATCH] btrfs-progs: add udev rule to use mq-deadline on zoned btrfs Johannes Thumshirn
2022-01-25 14:20 ` David Sterba
2022-01-25 14:28 ` Johannes Thumshirn
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.