lkml.org 
[lkml]   [2003]   [May]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectO_DIRECT write to file by block-aligned, block-multiple buf fails?
I thought based on searching the archives that 2.4 O_DIRECT
requires fs block size alignment of the buffer, and that the
buffer is an exact multiple of block size. This should mean
I can write aligned pages with direct IO, right?

int
main (void)
{
char *buf;
int fd;

buf = memalign(getpagesize(), getpagesize());
fd = open("/tmp/testfile", O_TRUNC|O_WRONLY|O_DIRECT);
if (write(fd, buf, getpagesize()) == -1)
perror("write");
}

$ ./test
write: Invalid argument

$ grep /tmp /proc/mounts
/dev/hda5 /mnt/tmp ext3 rw 0 0

$ sudo dumpe2fs /dev/hda5 | grep Block\ size
dumpe2fs 1.27 (8-Mar-2002)
Block size: 4096

$ uname -rm
2.4.21-pre4-ac1 i686

what silly thing am I not understanding here?
-
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 13:35    [W:1.337 / U:0.208 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site