lkml.org 
[lkml]   [2005]   [Mar]   [2]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateTue, 1 Mar 2005 21:34:25 -0800 (PST)
FromJunfeng Yang <>
SubjectO_DIRECT on 2.4 ext3
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

-
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/

\
 
 \ /
  Last update: 2005-03-22 14:10    [from the cache]
©2003-2008