* O_DIRECT on 2.4 ext3
@ 2005-03-02 5:34 Junfeng Yang
2005-03-02 6:42 ` Andreas Dilger
0 siblings, 1 reply; 2+ messages in thread
From: Junfeng Yang @ 2005-03-02 5:34 UTC (permalink / raw)
To: Linux Kernel Mailing List
Hi,
I tried to read from a regular ext3 file opened as O_DIRECT, but got the
"Invalid argument" error. Running the same test program on a block device
succeeded.
uname -a shows
Linux ******* 2.4.27-2-686-smp #1 SMP Thu Jan 20 11:02:39 JST 2005 i686
GNU/Linux
My test case is
#include <sys/types.h>
#include <sys/stat.h>
#include <asm/fcntl.h>
#include <stdio.h>
#include <assert.h>
#define BLK (4096U)
main()
{
char buf[BLK * 2];
char *p = (char*)((((unsigned)buf) + (BLK-1)) & ~(BLK-1));
int fd, l;
fprintf(stderr, "buf = %p, p = %p\n", buf, p);
if((fd=open("sbd0", O_RDONLY|O_DIRECT)) < 0) {
perror("open");
assert(0);
}
if((l=pread(fd, p, BLK, 0)) < 0) {
perror("pread");
assert(0);
}
fprintf(stderr, "pread returns %d\n", l);
close (fd);
}
Does anyone know what's going on?
Thanks,
-Junfeng
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: O_DIRECT on 2.4 ext3
2005-03-02 5:34 O_DIRECT on 2.4 ext3 Junfeng Yang
@ 2005-03-02 6:42 ` Andreas Dilger
0 siblings, 0 replies; 2+ messages in thread
From: Andreas Dilger @ 2005-03-02 6:42 UTC (permalink / raw)
To: Junfeng Yang; +Cc: Linux Kernel Mailing List
[-- Attachment #1: Type: text/plain, Size: 468 bytes --]
On Mar 01, 2005 21:34 -0800, Junfeng Yang wrote:
> I tried to read from a regular ext3 file opened as O_DIRECT, but got the
> "Invalid argument" error. Running the same test program on a block device
> succeeded.
ext3 doesn't support the direct_IO method in 2.4 kernels, though there
was a patch at one time.
Cheers, Andreas
--
Andreas Dilger
http://sourceforge.net/projects/ext2resize/
http://members.shaw.ca/adilger/ http://members.shaw.ca/golinux/
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-03-02 6:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-02 5:34 O_DIRECT on 2.4 ext3 Junfeng Yang
2005-03-02 6:42 ` Andreas Dilger
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®