On 09/11/2023 15:13, Christoph Hellwig wrote:
On Fri, Sep 29, 2023 at 10:27:07AM +0000, John Garry wrote:
We rely the block layer always being able to send a bio of size
atomic_write_unit_max without being required to split it due to request
queue or other bio limits.
A bio may contain min(BIO_MAX_VECS, limits->max_segments) vectors,
and each vector is at worst case the device logical block size from
direct IO alignment requirement.
A bio can have more than BIO_MAX_VECS if you use bio_init.
Right, FWIW we are only concerned with codepaths which use BIO_MAX_VECS,
but I suppose that is not good enough as a guarantee.
+static unsigned int blk_queue_max_guaranteed_bio_size_sectors(
+ struct request_queue *q)
+{
+ struct queue_limits *limits = &q->limits;
+ unsigned int max_segments = min_t(unsigned int, BIO_MAX_VECS,
+ limits->max_segments);
+ /* Limit according to dev sector size as we only support direct-io */
Who is "we", and how tells the caller to only ever use direct I/O?
I think that this can be dropped as a comment. My earlier series used
PAGE_SIZE and not sector size here, which I think was proper.
And how would a type of userspace I/O even matter for low-level
block code.
It shouldn't do, but we still need to limit according to request queue
limits.
What if I wanted to use this for file system metadata?
As mentioned, I think that the direct-IO comment can be dropped.
Thanks,
John