[PATCH v3 09/15] block: Add checks to merging of atomic writes
Nilay Shroff
nilay at linux.ibm.com
Mon Feb 12 04:01:20 PST 2024
On 2/12/24 16:50, John Garry wrote:
> I'm not sure what is going on with your mail client here.
Sorry for the inconvenience, I will check the settings.
>>
>> So is it a good idea to validate here whether we could potentially exceed
>>
>> the atomic-write-max-unit-size supported by device before we allow merging?
>
> Note that we have atomic_write_max_bytes and atomic_write_max_unit_size, and they are not always the same thing.
>
>>
>> In case we exceed the atomic-write-max-unit-size post merge then don't allow
>>
>> merging?
>
> We check this elsewhere. I just expanded the normal check for max request size to cover atomic writes.
>
> Normally we check that a merged request would not exceed max_sectors value, and this max_sectors value can be got from blk_queue_get_max_sectors().
>
> So if you check a function like ll_back_merge_fn(), we have a merging size check:
>
> if (blk_rq_sectors(req) + bio_sectors(bio) >
> blk_rq_get_max_sectors(req, blk_rq_pos(req))) {
> req_set_nomerge(req->q, req);
> return 0;
> }
>
> And here the blk_rq_get_max_sectors() -> blk_queue_get_max_sectors() call now also supports atomic writes (see patch #7):
OK got it. I think I have missed this part.
>
> @@ -167,7 +167,16 @@ static inline unsigned get_max_io_size(struct bio *bio,
> {
> ...
>
> + if (bio->bi_opf & REQ_ATOMIC)
> + max_sectors = lim->atomic_write_max_sectors;
> + else
> + max_sectors = lim->max_sectors;
>
> Note that we do not allow merging of atomic and non-atomic writes.
>
Yeah
Thanks,
--Nilay
More information about the Linux-nvme
mailing list