1

I need to pass a direct ATA request to a hard drive (0x25, READ DMA EXT), to disobey max sector count (long story), and to bypass all possible OS caches, buffers, reorderings et al.

HDIO_DRIVE_TASKFILE IOCTL is no longer available due to libata.

I accomplished the goal with a SG_IO IOCTL with ATA pass-through (SG_ATA_16). Works perfectly except one problem: I can read a maximum of 8192 sectors in one command. I need to read a full of 32767 sectors.

  • max_hw_sectors_kb is 32767, so the drive supports this much transfer
  • max_sectors_kb was low, yet I brought it up to 32767 sectors, to no avail
  • scheduler is set to noop, no change.
  • Tried gather buffer (iovec_count>0, properly set iovecs to consecutive buffer slices), no change.

Environment: Ubuntu 16.04/16.10/17.04 with standard kernels, SATA drive connected to standard AHCI interface on Intel chipset.

No matter what I do, starting with 8193 sectors, IOCTL bails out with "Invalid argument" error.

Where to look? What else can cause a 4MB data transfer cap?

4

0 回答 0