Writing IO at max_sectors_kb

464 views Asked by At

on Linux (using 5.9) if my NVMe disk has a max_sectors_kb == 2048 but logical_block_size == 512, does that still mean that if i submit a write of 2048KB that either...

  1. the entire operation will fail if the drive's kernel write queue is saturated (nr_requests == 256)

or

  1. the entire 2048KB write will be written and never less than 2048KB?

I'm using io_uring and O_DIRECT.

1

There are 1 answers

0
Anon On
  1. io_uring has a queue of its own and you can set its entries in io_uring_setup(2) to a number larger than 256. Further the submission and completion queues are separate from the queues of in-flight requests so you would have to saturate entries AND nr_requests.
  2. Looks like someone asked Jens this over on https://twitter.com/victorxstewart/status/1338303336370593792 :

Victor Stewart @victorxstewart

@axboe if you only submit file IO of size hw_sector_kb, using O_DIRECT, with the fixed ops, is it still possible to get short reads or writes? or for batches to complete out of order?

Jens Axboe @axboe Replying to @victorxstewart

Short generally shouldn’t happen, out or order completions can (and will) always happen.

However you need to clarify your question. Are you actually asking "is O_DIRECT atomic even in the face of power failure?" (i.e. is all of a given I/O is written and if not does the area being written remain exactly as all old data)?

In the io-uring mailing list thread [PATCH v3 RESEND] iomap: set REQ_NOWAIT according to IOCB_NOWAIT in Direct IO there is a warning that an initial filesystem I/Os can be split apart and be sent down separately (and worse separately fail) if certain other options are set.

It's probably best to ask more directly over on the io_uring mailing list - http://vger.kernel.org/vger-lists.html#io-uring .