mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
To: Jan Kara <jack@suse.cz>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Direct IO for fat
Date: Fri, 09 Feb 2007 00:44:06 +0900	[thread overview]
Message-ID: <87k5ysfyd5.fsf@duaron.myhome.or.jp> (raw)
In-Reply-To: <20070208112808.GA3767@duck.suse.cz> (Jan Kara's message of "Thu\, 8 Feb 2007 12\:28\:08 +0100")

Jan Kara <jack@suse.cz> writes:

>   Hello,

Hello,

>   I've noticed that extending a file using direct IO fails for FAT with
> EINVAL. It's basically because of the following code in fat_direct_IO():
>
> if (rw == WRITE) {
>         /*
>          * FIXME: blockdev_direct_IO() doesn't use
>          * ->prepare_write(),
>          * so we need to update the ->mmu_private to block
>          * boundary.
>          *
>          * But we must fill the remaining area or hole by nul for
>          * updating ->mmu_private.
>          */
>         loff_t size = offset + iov_length(iov, nr_segs);
>         if (MSDOS_I(inode)->mmu_private < size)
>                 return -EINVAL;
> }
>
>   But isn't this check bogus? blockdev_direct_IO writes only to space that
> is already allocated and stops as soon as it needs to extend the file
> (further extension is then handled by buffered writes). So it should
> already do what it needed for FAT. Thanks for an answer in advance.

FAT has to fill the hole completely, but DIO doesn't seems to do.

e.g.
        fd = open("file", O_WRONLY | O_CREAT | O_TRUNC);
        write(fd, buf, 512);
        lseek(fd, 10000, SEEK_SET);
        write(fd, buf, 512);

We need to allocate the blocks on 512 ~ 10000, and fill it with zero.
However, I think DIO doesn't fill it. If I'm missing something, please
let me know, I'll kill that check.

Thanks.
-- 
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

  reply	other threads:[~2007-02-08 15:44 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-08 11:28 Jan Kara
2007-02-08 15:44 ` OGAWA Hirofumi [this message]
2007-02-08 16:10   ` Jan Kara
2007-02-08 16:40     ` OGAWA Hirofumi
2007-02-08 17:35       ` Jan Kara
2007-02-08 18:41         ` Jan Kara
2007-02-08 19:53           ` OGAWA Hirofumi
2007-02-09  7:19             ` Jan Kara
2007-02-09 13:42               ` OGAWA Hirofumi

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=87k5ysfyd5.fsf@duaron.myhome.or.jp \
    --to=hirofumi@mail.parknet.co.jp \
    --cc=jack@suse.cz \
    --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®