mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* O_DIRECT write to file by block-aligned, block-multiple buf fails?
@ 2003-05-15  5:33 Scott McDermott
  2003-05-15  6:04 ` Andreas Dilger
  0 siblings, 1 reply; 4+ messages in thread
From: Scott McDermott @ 2003-05-15  5:33 UTC (permalink / raw)
  To: linux-kernel

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?

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-05-15  6:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-15  5:33 O_DIRECT write to file by block-aligned, block-multiple buf fails? Scott McDermott
2003-05-15  6:04 ` Andreas Dilger
2003-05-15  6:16   ` Scott McDermott
2003-05-15  6:21   ` Andrew Morton

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®