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

* Re: O_DIRECT write to file by block-aligned, block-multiple buf fails?
  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
  0 siblings, 2 replies; 4+ messages in thread
From: Andreas Dilger @ 2003-05-15  6:04 UTC (permalink / raw)
  To: Scott McDermott; +Cc: linux-kernel

On May 15, 2003  01:33 -0400, Scott McDermott wrote:
> This should mean I can write aligned pages with direct IO, right?
> 
>         write: Invalid argument
> 
>         $ grep /tmp /proc/mounts
>         /dev/hda5 /mnt/tmp ext3 rw 0 0

ext3 does not support O_DIRECT in 2.4 yet.

Cheers, Andreas
--
Andreas Dilger
http://sourceforge.net/projects/ext2resize/
http://www-mddsp.enel.ucalgary.ca/People/adilger/


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

* Re: O_DIRECT write to file by block-aligned, block-multiple buf fails?
  2003-05-15  6:04 ` Andreas Dilger
@ 2003-05-15  6:16   ` Scott McDermott
  2003-05-15  6:21   ` Andrew Morton
  1 sibling, 0 replies; 4+ messages in thread
From: Scott McDermott @ 2003-05-15  6:16 UTC (permalink / raw)
  To: linux-kernel; +Cc: adilger

Andreas Dilger on Thu 15/05 00:04 -0600:
> On May 15, 2003  01:33 -0400, Scott McDermott wrote:
> > This should mean I can write aligned pages with direct
> > IO, right?
> > 
> >         write: Invalid argument
> > 
> >         $ grep /tmp /proc/mounts
> >         /dev/hda5 /mnt/tmp ext3 rw 0 0
> 
> ext3 does not support O_DIRECT in 2.4 yet.

should open() on an ext3-based file fail when O_DIRECT is
among the flags?

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

* Re: O_DIRECT write to file by block-aligned, block-multiple buf fails?
  2003-05-15  6:04 ` Andreas Dilger
  2003-05-15  6:16   ` Scott McDermott
@ 2003-05-15  6:21   ` Andrew Morton
  1 sibling, 0 replies; 4+ messages in thread
From: Andrew Morton @ 2003-05-15  6:21 UTC (permalink / raw)
  To: Andreas Dilger; +Cc: vaxerdec, linux-kernel

Andreas Dilger <adilger@clusterfs.com> wrote:
>
> On May 15, 2003  01:33 -0400, Scott McDermott wrote:
> > This should mean I can write aligned pages with direct IO, right?
> > 
> >         write: Invalid argument
> > 
> >         $ grep /tmp /proc/mounts
> >         /dev/hda5 /mnt/tmp ext3 rw 0 0
> 
> ext3 does not support O_DIRECT in 2.4 yet.
> 

It does if you apply

ftp://ftp.kernel.org/pub/linux/kernel/people/andrea/kernels/v2.4/2.4.21rc2aa1/10_ext3-o_direct-2

^ 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®