Allow use of fua to be disabled on per-device basis?
From: Andres Freund
Date: Tue Dec 15 2020 - 14:12:43 EST
Hi,
I have a few Samsung NVMe SSDs where FUA (i.e. REQ_FUA) is a slower than
full device cache flushes (i.e. REQ_PREFLUSH). I would like to be able
to disable use of FUA for those.
As a first step, would it make sense to add write support to
/sys/block/*/queue/fua?
The biggest issue with that is that it seems like it'd be preferrable to
only allow enabling fua if the underlying device supports that, and that
that information isn't currently stored anywhere but QUEUE_FLAG_FUA.
The easiest way to deal with that would be to split QUEUE_FLAG_FUA into
QUEUE_FLAG_FUA_HW and QUEUE_FLAG_FUA_ENABLED, and have
blk_queue_write_cache() set QUEUE_FLAG_FUA_ENABLED to
QUEUE_FLAG_FUA_HW. Then the new blk-sysfs.c queue_fua_set() would only
allow setting QUEUE_FLAG_FUA_ENABLED if QUEUE_FLAG_FUA_HW is availabl.e
Does that roughly make sense?
In a second step it could be reasonable to add an nvme quirks indicating
slow FUA for those devices? But I'll leave that for later...
Greetings,
Andres Freund