From: Jakub Jelinek <jakub@redhat.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Ulrich Drepper <drepper@redhat.com>, David Chinner <dgc@sgi.com>,
"Amit K. Arora" <aarora@linux.vnet.ibm.com>,
torvalds@linux-foundation.org, 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 1/5] fallocate() implementation in i86, x86_64 and powerpc
Date: Fri, 4 May 2007 02:56:26 -0400 [thread overview]
Message-ID: <20070504065626.GW355@devserv.devel.redhat.com> (raw)
In-Reply-To: <20070503232815.2f62a75e.akpm@linux-foundation.org>
On Thu, May 03, 2007 at 11:28:15PM -0700, Andrew Morton wrote:
> > > The posix spec implies that negative `len' is permitted - presumably "allocate
> > > ahead of `offset'". How peculiar.
> >
> > I just checked the man page for posix_fallocate() and it says:
> >
> > EINVAL offset or len was less than zero.
That describes the current glibc implementation.
> > We should probably follow this lead.
>
> Yes, I think so. I'm suspecting that
> http://www.opengroup.org/onlinepubs/009695399/functions/posix_fallocate.html
> is just buggy. Or I can't read.
>
> I mean, if we're going to support negative `len' then is the byte at
> `offset' inside or outside the segment? Head spins.
>
> However it would be neat if someone could test $OTHER_OS and, perhaps more
> importantly, the present glibc emulation (which I assume your manpage is
> referring to, so this would be a manpage test ;)).
int
posix_fallocate (int fd, __off_t offset, __off_t len)
{
struct stat64 st;
struct statfs f;
/* `off_t' is a signed type. Therefore we can determine whether
OFFSET + LEN is too large if it is a negative value. */
if (offset < 0 || len < 0)
return EINVAL;
if (offset + len < 0)
return EFBIG;
/* First thing we have to make sure is that this is really a regular
file. */
if (__fxstat64 (_STAT_VER, fd, &st) != 0)
return EBADF;
if (S_ISFIFO (st.st_mode))
return ESPIPE;
if (! S_ISREG (st.st_mode))
return ENODEV;
if (len == 0)
{
if (st.st_size < offset)
{
int ret = __ftruncate (fd, offset);
if (ret != 0)
ret = errno;
return ret;
}
return 0;
}
...
is what glibc does ATM. Seems we violate the case where len == 0, as
EINVAL in that case is "shall fail". But reading the standard to imply
negative len is ok is too much guessing, there is no word what it means
when len is negative and
"required storage for regular file data starting at offset and continuing for len bytes"
doesn't make sense for negative size.
And given the general
"Implementations may support additional errors not included in this list,
may generate errors included in this list under circumstances other than
those described here, or may contain extensions or limitations that prevent
some errors from occurring."
I believe returning EINVAL for len < 0 is not a POSIX violation.
That doesn't mean the standard shouldn't be clarified, whether by saying
EINVAL must be returned for non-positive len or saying that using negative
len has undefined or implementation defined behavior.
> The above opengroup page only permits S_ISREG. Preallocating directories
> sounds quite useful to me, although it's something which would be pretty
> hard to emulate if the FS doesn't support it. And there's a decent case to
> be made for emulating it - run-anywhere reasons. Does glibc emulation support
> directories? Quite unlikely.
No, see above.
Jakub
next prev parent reply other threads:[~2007-05-04 6:56 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 [this message]
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
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=20070504065626.GW355@devserv.devel.redhat.com \
--to=jakub@redhat.com \
--cc=aarora@linux.vnet.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=cmm@us.ibm.com \
--cc=dgc@sgi.com \
--cc=drepper@redhat.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=torvalds@linux-foundation.org \
--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).