From: Andrew Morton <akpm@linux-foundation.org>
To: Andreas Dilger <adilger@clusterfs.com>
Cc: "Amit K. Arora" <aarora@linux.vnet.ibm.com>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-ext4@vger.kernel.org, xfs@oss.sgi.com, suparna@in.ibm.com,
cmm@us.ibm.com
Subject: Re: [PATCH 4/5] ext4: fallocate support in ext4
Date: Mon, 7 May 2007 13:58:25 -0700 [thread overview]
Message-ID: <20070507135825.f8545a65.akpm@linux-foundation.org> (raw)
In-Reply-To: <20070507113753.GA5439@schatzie.adilger.int>
On Mon, 7 May 2007 05:37:54 -0600
Andreas Dilger <adilger@clusterfs.com> wrote:
> > > + block = offset >> blkbits;
> > > + max_blocks = (EXT4_BLOCK_ALIGN(len + offset, blkbits) >> blkbits)
> > > + - block;
> > > + mutex_lock(&EXT4_I(inode)->truncate_mutex);
> > > + credits = ext4_ext_calc_credits_for_insert(inode, NULL);
> > > + mutex_unlock(&EXT4_I(inode)->truncate_mutex);
> >
> > Now I'm mystified. Given that we're allocating an arbitrary amount of disk
> > space, and that this disk space will require an arbitrary amount of
> > metadata, how can we work out how much journal space we'll be needing
> > without at least looking at `len'?
>
> Good question.
>
> The uninitialized extent can cover up to 128MB with a single entry.
> If @path isn't specified, then ext4_ext_calc_credits_for_insert()
> function returns the maximum number of extents needed to insert a leaf,
> including splitting all of the index blocks. That would allow up to 43GB
> (340 extents/block * 128MB) to be preallocated, but it still needs to take
> the size of the preallocation into account (adding 3 blocks per 43GB - a
> leaf block, a bitmap block and a group descriptor).
I think the use of ext4_journal_extend() (as Amit has proposed) will help
here, but it is not sufficient.
Because under some circumstances, a journal_extend() failure could mean
that we fail to allocate all the required disk space. If it is infrequent
enough, that is acceptable when the caller is using fallocate() for
performance reasons.
But it is very much not acceptable if the caller is using fallocate() for
space-reservation reasons. If you used fallocate to reserve 1GB of disk
and fallocate() "succeeded" and you later get ENOSPC then you'd have a
right to get a bit upset.
So I think the ext3/4 fallocate() implementation will need to be
implemented as a loop:
while (len) {
journal_start();
len -= do_fallocate(len, ...);
journal_stop();
}
Now the interesting question is: what do we do if we get halfway through
this loop and then run out of space? We could leave the disk all filled up
and then return failure to the caller, but that's pretty poor behaviour,
IMO.
Does the proposed implementation handle quotas correctly, btw? Has that
been tested?
Final point: it's fairly disappointing that the present implementation is
ext4-only, and extent-only. I do think we should be aiming at an ext4
bitmap-based implementation and an ext3 implementation.
next prev parent reply other threads:[~2007-05-07 20:58 UTC|newest]
Thread overview: 303+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20070117094658.GA17390@amitarora.in.ibm.com>
2007-02-07 7:48 ` Testing ext4 persistent preallocation patches for 64 bit features Amit K. Arora
2007-02-07 8:25 ` Mingming Cao
2007-02-07 10:36 ` Suparna Bhattacharya
2007-02-07 21:11 ` Andreas Dilger
2007-02-08 8:52 ` Amit K. Arora
2007-02-08 10:51 ` Amit K. Arora
[not found] ` <20070225022326.137b4875.akpm@linux-foundation.org>
2007-03-01 18:34 ` [RFC] Heads up on sys_fallocate() Amit K. Arora
2007-03-01 19:15 ` Eric Sandeen
2007-03-02 10:45 ` Andreas Dilger
2007-03-02 13:17 ` Dave Kleikamp
2007-03-01 20:23 ` Jeff Garzik
2007-03-01 20:31 ` Jeremy Allison
2007-03-01 21:14 ` Jeremy Fitzhardinge
2007-03-01 22:58 ` Alan
2007-03-01 22:05 ` Jeremy Fitzhardinge
2007-03-01 23:11 ` Alan
2007-03-01 22:15 ` Jeremy Fitzhardinge
2007-03-01 22:25 ` Andrew Morton
2007-03-01 22:40 ` Nathan Scott
2007-03-01 22:39 ` Eric Sandeen
2007-03-01 22:52 ` Andrew Morton
2007-03-02 18:28 ` Mingming Cao
2007-03-05 12:27 ` Jan Kara
2007-03-05 20:02 ` Mingming Cao
2007-03-06 7:28 ` Christoph Hellwig
2007-03-06 14:36 ` Ulrich Drepper
2007-03-06 14:47 ` Christoph Hellwig
2007-03-06 14:50 ` Jan Kara
2007-03-06 18:23 ` Eric Sandeen
2007-03-07 8:51 ` Jan Kara
2007-03-07 11:30 ` Jörn Engel
2007-03-06 16:46 ` Eric Sandeen
2007-03-13 23:46 ` David Chinner
2007-03-05 21:41 ` Eric Sandeen
2007-03-01 22:41 ` Anton Blanchard
2007-03-01 22:44 ` Dave Kleikamp
2007-03-01 22:59 ` Andrew Morton
2007-03-01 23:09 ` Dave Kleikamp
2007-03-02 13:41 ` Jan Engelhardt
2007-03-02 18:09 ` Mingming Cao
2007-03-02 7:09 ` Ulrich Drepper
2007-03-01 23:38 ` Christoph Hellwig
2007-03-03 22:45 ` Arnd Bergmann
2007-03-04 20:11 ` Anton Altaparmakov
2007-03-04 20:53 ` Arnd Bergmann
2007-03-04 22:38 ` Ulrich Drepper
2007-03-04 23:22 ` Anton Altaparmakov
2007-03-05 14:37 ` Theodore Tso
2007-03-05 15:07 ` Anton Altaparmakov
2007-03-05 15:15 ` Ulrich Drepper
2007-03-05 15:35 ` Christoph Hellwig
2007-03-05 16:01 ` Theodore Tso
2007-03-05 16:07 ` Ulrich Drepper
2007-03-05 0:16 ` Jörn Engel
2007-03-05 0:32 ` Anton Altaparmakov
2007-03-05 0:35 ` Anton Altaparmakov
2007-03-05 0:44 ` Arnd Bergmann
2007-03-05 11:49 ` Jörn Engel
2007-03-05 15:09 ` Ulrich Drepper
2007-03-05 0:36 ` Arnd Bergmann
2007-03-05 11:41 ` Jörn Engel
2007-03-05 15:08 ` Ulrich Drepper
2007-03-05 15:33 ` Jörn Engel
2007-03-05 15:48 ` Ulrich Drepper
2007-03-05 22:00 ` Eric Sandeen
2007-03-05 4:23 ` Christoph Hellwig
2007-03-05 13:18 ` Christoph Hellwig
2007-03-01 23:29 ` Eric Sandeen
2007-03-01 23:51 ` Christoph Hellwig
2007-03-01 23:36 ` Christoph Hellwig
2007-03-02 6:03 ` Badari Pulavarty
2007-03-02 6:16 ` Andrew Morton
2007-03-02 13:23 ` Dave Kleikamp
2007-03-02 15:29 ` Ulrich Drepper
2007-03-02 15:16 ` Eric Sandeen
2007-03-02 16:13 ` Badari Pulavarty
2007-03-02 17:01 ` Andrew Morton
2007-03-02 17:19 ` Eric Sandeen
2007-03-16 14:31 ` [RFC][PATCH] sys_fallocate() system call Amit K. Arora
2007-03-16 15:21 ` Heiko Carstens
2007-03-19 9:24 ` Amit K. Arora
2007-03-19 11:23 ` Heiko Carstens
2007-03-16 16:17 ` Heiko Carstens
2007-03-17 9:59 ` Paul Mackerras
2007-03-17 11:07 ` Matthew Wilcox
2007-03-17 14:30 ` Heiko Carstens
2007-03-17 14:38 ` Stephen Rothwell
2007-03-17 14:42 ` Stephen Rothwell
2007-03-17 11:10 ` Matthew Wilcox
2007-03-21 12:04 ` Amit K. Arora
2007-03-21 21:35 ` Chris Wedgwood
2007-03-29 11:51 ` Interface for the new fallocate() " Amit K. Arora
2007-03-29 16:35 ` Chris Wedgwood
2007-03-29 17:01 ` Jan Engelhardt
2007-03-29 17:18 ` linux-os (Dick Johnson)
2007-03-29 18:05 ` Jan Engelhardt
2007-03-29 18:37 ` Linus Torvalds
2007-03-30 7:00 ` Heiko Carstens
2007-03-29 17:10 ` Andrew Morton
2007-03-30 7:14 ` Jakub Jelinek
2007-03-30 8:39 ` Heiko Carstens
2007-03-30 9:15 ` Paul Mackerras
2007-04-05 11:26 ` Amit K. Arora
2007-04-05 11:44 ` Amit K. Arora
2007-04-05 15:50 ` Randy Dunlap
2007-04-06 9:58 ` Andreas Dilger
2007-04-17 12:55 ` Amit K. Arora
2007-04-18 13:06 ` Andreas Dilger
2007-04-20 13:51 ` Amit K. Arora
2007-04-20 14:59 ` Jakub Jelinek
2007-04-24 12:16 ` Amit K. Arora
2007-04-26 17:50 ` [PATCH 0/5] fallocate " Amit K. Arora
2007-04-26 18:03 ` [PATCH 1/5] fallocate() implementation in i86, x86_64 and powerpc Amit K. Arora
2007-05-04 4:29 ` Andrew Morton
2007-05-04 4:41 ` Paul Mackerras
2007-05-09 10:15 ` Suparna Bhattacharya
2007-05-09 10:50 ` Paul Mackerras
2007-05-09 11:10 ` Suparna Bhattacharya
2007-05-09 11:37 ` Paul Mackerras
2007-05-09 12:00 ` Martin Schwidefsky
2007-05-09 12:05 ` Amit K. Arora
2007-05-04 4:55 ` Andrew Morton
2007-05-04 6:07 ` David Chinner
2007-05-04 6:28 ` Andrew Morton
2007-05-04 6:56 ` Jakub Jelinek
2007-05-07 13:08 ` Ulrich Drepper
2007-05-04 7:27 ` David Chinner
2007-05-07 11:10 ` Amit K. Arora
2007-05-07 11:03 ` Amit K. Arora
2007-05-09 16:01 ` Amit K. Arora
2007-05-09 16:54 ` Andreas Dilger
2007-05-09 17:07 ` Mingming Cao
2007-05-10 0:59 ` David Chinner
2007-05-10 11:56 ` Amit K. Arora
2007-05-10 22:39 ` David Chinner
2007-05-11 11:03 ` Suparna Bhattacharya
2007-05-12 8:01 ` David Chinner
2007-06-12 6:16 ` Amit K. Arora
2007-06-12 8:11 ` David Chinner
2007-06-13 23:52 ` David Chinner
2007-06-14 9:14 ` Andreas Dilger
2007-06-14 12:04 ` David Chinner
2007-06-14 19:33 ` Andreas Dilger
2007-06-25 13:28 ` [PATCH 0/6][TAKE5] fallocate system call Amit K. Arora
2007-06-25 13:40 ` [PATCH 1/7][TAKE5] fallocate() implementation on i386, x86_64 and powerpc Amit K. Arora
2007-06-26 19:38 ` Heiko Carstens
2007-06-25 13:42 ` [PATCH 2/7][TAKE5] fallocate() on s390(x) Amit K. Arora
2007-06-26 15:15 ` Heiko Carstens
2007-06-25 13:43 ` [PATCH 3/7][TAKE5] fallocate() on ia64 Amit K. Arora
2007-06-25 13:45 ` [PATCH 4/7][TAKE5] support new modes in fallocate Amit K. Arora
2007-06-25 15:03 ` Amit K. Arora
2007-06-25 21:46 ` Andreas Dilger
2007-06-26 10:32 ` Amit K. Arora
2007-06-26 15:34 ` Andreas Dilger
2007-06-26 19:09 ` Amit K. Arora
2007-06-26 23:18 ` David Chinner
2007-06-28 18:19 ` Amit K. Arora
2007-06-28 23:39 ` Nathan Scott
2007-06-29 1:03 ` David Chinner
2007-06-30 10:21 ` Christoph Hellwig
2007-06-30 16:52 ` Andreas Dilger
2007-07-03 10:08 ` Amit K. Arora
2007-07-03 10:31 ` Christoph Hellwig
2007-07-03 11:46 ` Amit K. Arora
2007-07-04 5:37 ` Timothy Shimmin
2007-07-11 9:04 ` Christoph Hellwig
2007-07-11 9:03 ` Christoph Hellwig
2007-07-12 7:28 ` Suparna Bhattacharya
2007-07-12 8:26 ` Amit K. Arora
2007-07-12 14:40 ` Andreas Dilger
2007-07-12 13:13 ` David Chinner
2007-07-12 14:15 ` Amit K. Arora
2007-07-01 22:55 ` David Chinner
2007-07-02 11:47 ` Amit K. Arora
2007-07-11 9:05 ` Christoph Hellwig
2007-06-26 23:14 ` David Chinner
2007-06-27 3:49 ` Andreas Dilger
2007-06-27 13:36 ` David Chinner
2007-06-27 23:28 ` Nathan Scott
2007-06-28 0:39 ` David Chinner
2007-06-28 0:53 ` Nathan Scott
2007-06-30 10:26 ` Christoph Hellwig
2007-06-25 21:52 ` Andreas Dilger
2007-06-26 10:45 ` Amit K. Arora
2007-06-26 15:42 ` Andreas Dilger
2007-06-26 19:12 ` Amit K. Arora
2007-06-26 23:32 ` David Chinner
2007-06-26 23:26 ` David Chinner
2007-06-25 13:48 ` [PATCH 5/7][TAKE5] ext4: fallocate support in ext4 Amit K. Arora
2007-06-25 13:49 ` [PATCH 6/7][TAKE5] ext4: write support for preallocated blocks Amit K. Arora
2007-06-25 13:50 ` [PATCH 7/7][TAKE5] ext4: support new modes Amit K. Arora
2007-06-25 21:56 ` Andreas Dilger
2007-06-26 12:07 ` Amit K. Arora
2007-06-26 16:14 ` Andreas Dilger
2007-06-26 19:29 ` Amit K. Arora
2007-06-27 0:04 ` David Chinner
2007-06-28 18:07 ` Amit K. Arora
2007-06-26 23:15 ` [PATCH 0/6][TAKE5] fallocate system call David Chinner
2007-06-28 9:55 ` Andrew Morton
2007-06-28 17:36 ` Mingming Cao
2007-06-28 17:57 ` Amit K. Arora
2007-06-28 18:33 ` Andrew Morton
2007-06-28 18:45 ` Dave Kleikamp
2007-06-28 18:57 ` Jeff Garzik
2007-06-29 7:20 ` Christoph Hellwig
2007-06-29 13:56 ` Theodore Tso
2007-06-29 14:29 ` Jeff Garzik
2007-06-29 17:42 ` Theodore Tso
2007-06-29 15:50 ` Mingming Caoc
2007-06-29 20:57 ` Andrew Morton
2007-07-01 7:35 ` Ext4 patches for 2.6.22-rc6 Mingming Cao
2007-06-28 20:34 ` [PATCH 0/6][TAKE5] fallocate system call Andreas Dilger
2007-06-30 10:14 ` [PATCH 1/5] fallocate() implementation in i86, x86_64 and powerpc Christoph Hellwig
2007-04-26 18:07 ` [PATCH 2/5] fallocate() on s390 Amit K. Arora
2007-04-26 18:11 ` [PATCH 3/5] ext4: Extent overlap bugfix Amit K. Arora
2007-05-04 4:30 ` Andrew Morton
2007-05-07 11:46 ` Amit K. Arora
2007-04-26 18:13 ` [PATCH 4/5] ext4: fallocate support in ext4 Amit K. Arora
2007-05-04 4:31 ` Andrew Morton
2007-05-07 11:37 ` Andreas Dilger
2007-05-07 20:58 ` Andrew Morton [this message]
2007-05-07 22:21 ` Andreas Dilger
2007-05-07 22:38 ` Andrew Morton
2007-05-07 23:14 ` Theodore Tso
2007-05-07 23:31 ` Andrew Morton
2007-05-08 0:30 ` Mingming Cao
2007-05-07 23:02 ` Jeff Garzik
2007-05-07 23:36 ` Theodore Tso
2007-05-08 1:07 ` Andreas Dilger
2007-05-08 1:25 ` Jeff Garzik
2007-05-08 0:00 ` Mingming Cao
2007-05-08 0:15 ` Andrew Morton
2007-05-08 0:41 ` Mingming Cao
2007-05-08 1:43 ` Theodore Tso
2007-05-08 16:52 ` Andreas Dilger
2007-05-08 17:46 ` Mingming Cao
2007-05-14 13:34 ` Jan Kara
2007-05-07 12:07 ` Amit K. Arora
2007-05-07 15:24 ` Dave Kleikamp
2007-05-08 10:52 ` Amit K. Arora
2007-05-08 14:47 ` Dave Kleikamp
2007-04-26 18:16 ` [PATCH 5/5] ext4: write support for preallocated blocks/extents Amit K. Arora
2007-05-04 4:32 ` Andrew Morton
2007-05-07 12:11 ` Amit K. Arora
2007-05-07 12:40 ` Pekka Enberg
2007-05-07 13:04 ` Amit K. Arora
2007-04-27 12:10 ` [PATCH 0/5] fallocate system call Heiko Carstens
2007-04-27 14:43 ` Jörn Engel
2007-04-27 17:46 ` Heiko Carstens
2007-04-27 20:42 ` Chris Wedgwood
2007-04-30 0:47 ` David Chinner
2007-04-30 3:09 ` [PATCH] ia64 fallocate syscall David Chinner
2007-04-30 3:11 ` [PATCH] XFS ->fallocate() support David Chinner
2007-04-30 3:14 ` [PATCH] Add preallocation beyond EOF to fallocate David Chinner
2007-04-30 5:25 ` [PATCH 0/5] fallocate system call Chris Wedgwood
2007-04-30 5:56 ` David Chinner
2007-04-30 6:01 ` Chris Wedgwood
2007-05-02 12:53 ` Amit K. Arora
2007-05-03 10:34 ` Andreas Dilger
2007-05-14 13:29 ` [PATCH 0/5][TAKE2] " Amit K. Arora
[not found] ` <20070514142820.GA31468@amitarora.in.ibm.com>
2007-05-14 14:45 ` [PATCH 1/5][TAKE2] fallocate() implementation on i86, x86_64 and powerpc Amit K. Arora
2007-05-14 23:44 ` Stephen Rothwell
2007-05-15 13:23 ` Amit K. Arora
2007-05-14 14:48 ` [PATCH 2/5][TAKE2] fallocate() on s390 Amit K. Arora
2007-05-14 15:33 ` [PATCH 2/5][TAKE2] fallocate() on s390 - glibc wrapper Amit K. Arora
2007-05-14 14:50 ` [PATCH 3/5][TAKE2] ext4: Extent overlap bugfix Amit K. Arora
2007-05-14 14:52 ` [PATCH 4/5][TAKE2] ext4: fallocate support in ext4 Amit K. Arora
2007-05-14 14:54 ` [PATCH 5/5][TAKE2] ext4: write support for preallocated blocks Amit K. Arora
2007-05-15 6:31 ` [PATCH 0/5][TAKE2] fallocate system call Andreas Dilger
2007-05-15 12:40 ` Amit K. Arora
2007-05-15 19:37 ` [PATCH 0/5][TAKE3] " Amit K. Arora
[not found] ` <20070515195421.GA2948@amitarora.in.ibm.com>
2007-05-15 20:03 ` [PATCH 1/5][TAKE3] fallocate() implementation on i86, x86_64 and powerpc Amit K. Arora
2007-05-16 0:42 ` Mingming Cao
2007-05-16 12:31 ` Amit K. Arora
2007-05-16 3:16 ` David Chinner
2007-05-16 12:21 ` Dave Kleikamp
2007-05-16 12:37 ` Amit K. Arora
2007-05-16 23:40 ` David Chinner
2007-05-17 12:10 ` Dave Kleikamp
2007-05-17 12:28 ` Amit K. Arora
2007-05-15 20:10 ` [PATCH 2/5][TAKE3] fallocate() on s390 Amit K. Arora
2007-05-15 20:13 ` [PATCH 3/5][TAKE3] ext4: Extent overlap bugfix Amit K. Arora
2007-05-15 20:16 ` [PATCH 4/5][TAKE3] ext4: fallocate support in ext4 Amit K. Arora
2007-05-15 20:18 ` [PATCH 5/5][TAKE3] ext4: write support for preallocated blocks Amit K. Arora
2007-05-15 23:52 ` [PATCH 0/5][TAKE3] fallocate system call Mingming Cao
2007-05-17 14:11 ` [PATCH 0/6][TAKE4] " Amit K. Arora
[not found] ` <20070517141458.GA26641@amitarora.in.ibm.com>
2007-05-17 14:23 ` [PATCH 1/6][TAKE4] fallocate() implementation on i86, x86_64 and powerpc Amit K. Arora
2007-05-17 14:25 ` [PATCH 2/6][TAKE4] fallocate() on s390 Amit K. Arora
2007-05-17 14:25 ` [PATCH 3/6][TAKE4] fallocate() on ia64 Amit K. Arora
2007-05-17 14:26 ` [PATCH 4/6][TAKE4] ext4: Extent overlap bugfix Amit K. Arora
2007-05-17 14:29 ` [PATCH 5/6][TAKE4] ext4: fallocate support in ext4 Amit K. Arora
2007-05-17 14:30 ` [PATCH 6/6][TAKE4] ext4: write support for preallocated blocks Amit K. Arora
2007-05-19 6:44 ` [PATCH 0/6][TAKE4] fallocate system call Andrew Morton
2007-05-21 5:24 ` Mingming Cao
2007-03-30 7:19 ` Interface for the new fallocate() " Heiko Carstens
2007-03-30 9:15 ` Paul Mackerras
[not found] ` <17932.54606.323431.491736@cargo.ozlabs.ibm.com>
2007-03-30 10:44 ` Jörn Engel
2007-03-30 12:55 ` Heiko Carstens
2007-04-09 13:01 ` Paul Mackerras
2007-04-09 16:34 ` Jörn Engel
2007-03-17 5:33 ` [RFC][PATCH] sys_fallocate() " Stephen Rothwell
2007-03-19 9:30 ` Amit K. Arora
2007-03-17 14:53 ` Russell King
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=20070507135825.f8545a65.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=aarora@linux.vnet.ibm.com \
--cc=adilger@clusterfs.com \
--cc=cmm@us.ibm.com \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=suparna@in.ibm.com \
--cc=xfs@oss.sgi.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;
as well as URLs for NNTP newsgroup(s).