Re: O_DIRECT for block device

From: Joel Becker
Date: Thu Sep 22 2005 - 03:42:29 EST


On Thu, Sep 22, 2005 at 01:51:16PM +0530, Karthik Sarangan wrote:
> open("/dev/sdb", O_DIRECT) succeeds.
> A 'read' or 'write' returns -1 and errno is EINVAL.

You must align your buffer to at least sector size. See
posix_memalign(3).

--

Life's Little Instruction Book #30

"Never buy a house without a fireplace."

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker@xxxxxxxxxx
Phone: (650) 506-8127
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/