public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Paul Komkoff <i@stingr.net>
To: Roland Dreier <rdreier@cisco.com>
Cc: linux-btrfs <linux-btrfs@vger.kernel.org>
Subject: Re: btrfs fallocate woes
Date: Thu, 14 Jan 2010 18:24:06 +0000	[thread overview]
Message-ID: <715ea5c11001141024n8a6fa6fy95dfea4d991686c9@mail.gmail.com> (raw)
In-Reply-To: <aday6k0lhpx.fsf@roland-alpha.cisco.com>

On Thu, Jan 14, 2010 at 5:27 PM, Roland Dreier <rdreier@cisco.com> wrot=
e:
> My fallocate man page says:
>
> =A0 =A0 =A0 Because allocation is done in block size chunks, fallocat=
e() may
> =A0 =A0 =A0 allocate a larger range than that which was specified.
>
> so the btrfs behavior seems OK to me.
>
> You say this is a regression. =A0What btrfs version behaved different=
ly?

Err. My wording may not be very precise.
I see this as the regression from every other filesystem, to the
extent that rsync --preallocate will give you directory tree full of
corrupted files.

Also, your man page also says something else:
       If  FALLOC_FL_KEEP_SIZE  flag is not specified in mode, the
default behavior is almost same as when this flag is specified.  The
only difference is that on
       success, the file size will be changed if offset + len is
greater than the file size.   This  default  behavior  closely
resembles  the  behavior  of  the
       posix_fallocate(3) library function, and is intended as a
method of optimally implementing that function.

See, here nothing says to which value file size will be changed. Also,
posix_fallocate man page (which is actually a shortcut to
fallocate(fd, 0, ...)) says:
       If the size of the file is less than offset+len, then the file
is increased to this size; otherwise the file size is left unchanged.

Nowhere there it is said that size is ceil()'d to a blocksize.
Moreover, I never saw an app that does fallocate() and then
ftruncate() - every single app out there assumes that posix_fallocate
(and fallocate, fwiw), while may allocate more space, will set the
file size to something different than offset+len.
--=20
This message represents the official view of the voices in my head
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" =
in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2010-01-14 18:24 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-14 11:28 btrfs fallocate woes Paul Komkoff
2010-01-14 17:27 ` Roland Dreier
2010-01-14 18:24   ` Paul Komkoff [this message]
2010-01-14 18:25     ` Paul Komkoff
2010-01-14 18:26   ` Aneesh Kumar K. V
2010-01-14 19:20   ` Chris Mason
2010-01-14 20:33     ` Paul Komkoff
2010-01-19 15:18       ` Paul Komkoff
2010-01-20  7:28         ` Aneesh Kumar K. V
2010-01-20 15:13           ` Paul Komkoff

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=715ea5c11001141024n8a6fa6fy95dfea4d991686c9@mail.gmail.com \
    --to=i@stingr.net \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=rdreier@cisco.com \
    /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