79103587

Date: 2024-10-18 20:36:15
Score: 1
Natty:
Report link

It's way more complicated than folks might think.

  1. Buffer should be page boundary aligned.
  2. Offset for the access must be sector size aligned.
  3. Transfer size must be a multiple of sector size.
  4. There is NO API for asking from POSIX system calls, what is the sector size of a file system. Further more, the filesystem may have an array of disks, where each may have a different sector size. 512, or 4096 ...
  5. If one tries a read() for 512 bytes it could fail, if the drive is a 4k sector drive, or it could succeed if the drive supports 512e (emulated 512 byte sectors) However, the emulation may have an impact on the performance, and produce significantly lower performance when using 512e.
  6. There is again no standard POSIX system call for asking if the drive, or drives are using 512e.

Yes, it's very complicated indeed, and without asking the owner of the hardware what is the optimal sector size to use, across all of the drives that are involved in the filesystem, there is no way to predict the behavior, in both success or failure, or the performance aspects.

Reasons:
  • Long answer (-1):
  • No code block (0.5):
  • Unregistered user (0.5):
  • Low reputation (1):
Posted by: Iozone