mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Scott McDermott <vaxerdec@frontiernet.net>
To: linux-kernel@vger.kernel.org
Subject: O_DIRECT write to file by block-aligned, block-multiple buf fails?
Date: Thu, 15 May 2003 01:33:50 -0400	[thread overview]
Message-ID: <20030515013350.B1540@newbox.localdomain> (raw)

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?

             reply	other threads:[~2003-05-15  5:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-15  5:33 Scott McDermott [this message]
2003-05-15  6:04 ` Andreas Dilger
2003-05-15  6:16   ` Scott McDermott
2003-05-15  6:21   ` Andrew Morton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030515013350.B1540@newbox.localdomain \
    --to=vaxerdec@frontiernet.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®