In 2.4, your buffer, offset, and transfer size must be soft
blocksize aligned. That's the output of BLKBSZGET against the block
device. For unmounted partitions that is 512b, for most people's ext3
filesystems that is 4K. It is, FYI, the number set by set_blocksize().
In 2.5, the alignment restrictions have been relaxed. Your
offset, buffer, and transfer size must all be aligned on the hardware
sector size. That is the output of BLKSSZGET against the block device,
and is also what get_hardsect_size() returns in the kernel. For almost
all disks this number is 512b, so you can do O_DIRECT on 512b alignment
for a raw disk or for an ext3 filesystem. About the only thing that
may not have a 512b hardware sector size is a CD-ROM.
Joel
--"Hey mister if you're gonna walk on water, Could you drop a line my way?"
Joel Becker Senior Member of Technical Staff Oracle Corporation E-mail: joel.becker@oracle.com Phone: (650) 506-8127 - 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/