From: Andrew Morton <akpm@osdl.org>
To: <dhruv.anand@wipro.com>
Cc: linux-kernel@vger.kernel.org, akpm@zip.com.au,
janetinc@us.ibm.com, pbadari@us.ibm.com, nathans@sgi.com
Subject: Re: DIRECT IO for ext3/ext2.
Date: Fri, 21 Nov 2003 09:40:35 -0800 [thread overview]
Message-ID: <20031121094035.1e00b176.akpm@osdl.org> (raw)
In-Reply-To: <1E27FF611EBEFB4580387FCB5BEF00F3013DEEE8@blr-ec-msg04.wipro.com>
<dhruv.anand@wipro.com> wrote:
>
>
> Hi,
> I am working on an application on linux-2.6 that needs to
> bypass the buffer cache. In order to do so i use the direct
> IO functionality. Although open to the device succeeds with
> the DIRECT_IO flag, read from the device fails.
>
> Following is the exceprt fromt he code to open and read;
> --------------------------------------------------------
>
> if ((devf = open(dumpdev, O_RDONLY | O_DIRECT, 0)) < 0) {
> fprintf(KL_ERRORFP, "Error: open failed!\n");
> ...
> }
>
> if(err = read(devf, &magic_nr, sizeof(magic_nr)) != sizeof(magic_nr)) {
> fprintf(KL_ERRORFP, "Error: read() failed!\n");
> ...
> }
>
> ---------------------------------------------------------
> I am returned an errno=22, indicating 'Invalid argument'
>
O_DIRECT reads must be aligned to the filesystem blocksize. Both the
memory address and the file offset must be thus aligned.
next prev parent reply other threads:[~2003-11-21 17:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-11-21 15:53 dhruv.anand
2003-11-21 17:40 ` Andrew Morton [this message]
2003-11-21 19:30 dhruv.anand
2003-11-21 19:45 ` Andrew Morton
2003-11-25 8:16 ` Michael Kerrisk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20031121094035.1e00b176.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=akpm@zip.com.au \
--cc=dhruv.anand@wipro.com \
--cc=janetinc@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nathans@sgi.com \
--cc=pbadari@us.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®