mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* 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

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®