Message ID | 20220125132200.56122-1-johannes.thumshirn@wdc.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | btrfs-progs: add udev rule to use mq-deadline on zoned btrfs | expand |
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).
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.
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)
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