http://oss.sgi.com/bugzilla/show_bug.cgi?id=219
Summary: O_DIRECT io no longer works when the available data size
is less than the underlying block-device size?
Product: Linux XFS
Version: unspecified
Platform: All
OS/Version: Linux
Status: NEW
Severity: normal
Priority: Medium
Component: XFS kernel code
AssignedTo: xfs-master@xxxxxxxxxxx
ReportedBy: cw@xxxxxxxx
this occurs linux-2.5.60; 2.4.x (from oss' CVS) works as expected
under 2.4.x i am able to read a 1 byte file O_DIRECT; 2.5.60 fails when doing
this
testing fs-block-sized (well, == page size, really) reads with a 5k file under
2.4.x shows i can read the first block then a partial for the second block (as
expected)
under 2.5.60 the first block read correctly, the second barfs
--------- snip snip --------- source code ---------
#define _GNU_SOURCE
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
#include <stdio.h>
int main()
{
int h;
int ps;
char *buf;
ssize_t n;
ps = getpagesize();
if (!(buf = valloc(ps)))
return 1;
if ((h = open("od.c", O_RDONLY|O_DIRECT)) < 0)
return 1;
do {
n = read(h, buf, ps);
if (n == -1) {
perror("read");
break;
}
printf("read %d bytes\n", n);
} while(n);
close(h);
return 0;
}
-------------- snip snip -------- scissor party ----------
results (not a 5k file as mentioned above, s/od.c/a.out/ for that):
cw:0@tapu(cw)$ uname -r
2.4.20-cw2
cw:0@tapu(cw)$ gcc -Wall od.c
cw:0@tapu(cw)$ ./a.out
read 503 bytes
read 0 bytes
cw:0@tapu(cw)$
and
charon:~% uname -r
2.5.60
charon:~% gcc -Wall od.c
charon:~% ./a.out
read: Invalid argument
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
|