On 06/11/2025 14:00, Mikulas Patocka wrote:
The atomic write size is limited elsewhere, specifically
blk_atomic_writes_update_limits() - the limit there is quite similar (to what
is added in this updated patch). So I don't think that we need to do anything
special in dm-crypt, as that block limit is already tighter.
I suppose that this code can be kept with a comment (saying that it is
unnecessary, but safer to keep). Or we can just drop the code and add a
comment (saying that we don't need to limit here, as it is done elsewhere).
Thanks,
John
What if someone creates a hypothetical device that supports atomic writes
larger than BIO_MAX_VECS << PAGE_SHIFT? I think, we should limit it.
Yeah, it's entirely possible. And this is why we have separate HW and SW
atomic write limits. The HW limits are just what the HW can support, and
has no theoretical limit (apart from what we can fit in the
request_queue limits values). But the SW limits are a combination of the
HW limits and what the block stack can support (when guaranteeing to
never split a bio). The SW upper limit is about ~500KB for 4K PAGE_SIZE
- it can be less if the bdev has a limited segment count max. The SW
limits are what we report to userspace in terms of the maximum atomic
write size; in addition, it is the SW limits which the block stack
checks for when submitting a bio.
So you could cap the HW limits to BIO_MAX_VECS << PAGE_SHIFT, but it
would not have any effect in practice.
Thanks,
John