O_DIRECT alignment requirements ?

Rob van Nieuwkerk (robn@verdi.et.tudelft.nl)
Wed, 9 Apr 2003 14:16:08 +0200


Hi all,

I plan to use O_DIRECT in my application (on a partition, no fs).
It is hard to find info on the exact requirements on the mandatory
alignments of buffer, offset, transfer size: it's easy to find many
contradicting documents. And checking the kernel source itself isn't
trivial.

lseek(int fildes, off_t offset, int whence);
read(int fd, void *buf, size_t count);

My current assumption is this:

- offset must be block_aligned (multiple of 512)
- buf must be page_aligned (4096 on IA32)
- count must be "block_aligned" (multiple of 512)

Is this correct ?

r.

sysinfo:
--------
- Linux 2.4 (recent versions)
- using raw partion, no files, no fs
- IA32
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/