-
Improvement
-
Resolution: Unresolved
-
Medium
-
None
-
None
-
None
-
3
-
9223372036854775807
Unaligned DIO currently uses one flag for both "needs a bounce buffer" and "sends a partial-page BRW". When only the I/O length is not page-aligned (file offset and user buffer starts are page-aligned), user pages already map 1:1 onto file pages, so copying the whole range into a bounce buffer is unnecessary and costs CPU/bandwidth.
Separate bounce vs pin:
- Add ll_dio_can_pin(): pin user pages when the file offset and every user segment start on a page boundary, and only the last segment may end mid-page.
- A mid-page end with more I/O after that segment still bounces (would break 1:1 file-page mapping).
- Non user-backed iterators and encrypted files (partial page padded to an encryption unit) keep the old rule and pin only fully aligned I/O.
- Partial last pages still require the OST unaligned_dio feature and llite.unaligned_dio; unaligned AIO remains refused.
- is_unaligned_directio() / the readv/writev loop path follows the same bounce vs pin split so length-only unaligned DIO is not forced through the per-segment bounce path.
Test: sanity/119s — length-only DIO (aligned offset/buffer, size not page-aligned) checks vfstrace for the pin path (no ", bounce"), and confirms EINVAL when llite.unaligned_dio=0.
Related: LU-13805 (unaligned direct i/o)