From: Hugh Dickins <hughd@google.com>
To: Cong Wang <amwang@redhat.com>
Cc: Pekka Enberg <penberg@kernel.org>,
Lennart Poettering <lennart@poettering.net>,
KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
Dave Hansen <dave@linux.vnet.ibm.com>,
linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
linux-mm@kvack.org, kay.sievers@vrfy.org
Subject: Re: [Patch] tmpfs: add fallocate support
Date: Wed, 16 Nov 2011 17:31:36 -0800 (PST) [thread overview]
Message-ID: <alpine.LSU.2.00.1111161634360.1957@sister.anvils> (raw)
In-Reply-To: <4EC3633D.6090900@redhat.com>
[-- Attachment #1: Type: TEXT/PLAIN, Size: 2197 bytes --]
On Wed, 16 Nov 2011, Cong Wang wrote:
> 于 2011年11月16日 15:12, Pekka Enberg 写道:
> > On Wed, 16 Nov 2011, Cong Wang wrote:
> > > > What's the use case for this?
> > >
> > > Systemd needs it, see http://lkml.org/lkml/2011/10/20/275.
> > > I am adding Kay into Cc.
> >
> > The post doesn't mention why it needs it, though.
> >
>
> Right, I should mention this in the changelog. :-/
Yes, but I think Pekka's point is that the page which you link to does not
explain why Plumbers would want tmpfs to support fallocate() properly.
What good is it going to do for them? Why not just do it in userspace,
either by dd if=/dev/zero of=tmpfsfile, or by mmap() and touch if very
anxious to avoid the triple memset/memcpy (once reading from /dev/zero,
once allocating tmpfs pages, once copying to tmpfs pages)? Or splice().
I don't want to stand in the way of progress, but there's a lot of
things tmpfs does not support (a persistent filesystem would be top
of the list; but readahead, direct I/O, AIO, ....), and it may be
better to continue not to support them unless there's good reason.
tmpfs does not have a disk layout that we need to optimize.
I did not study your implementation in detail, but agree with Dave
and Kame that (if it needs to be in kernel at all) you should reuse
the existing code rather than repeating extracts: shmem_getpage_gfp()
is the one place which looks after all of shmem page allocation, so
I'd prefer you just make a loop of calls to that (with a new sgp_type
if there's particular reason to do something differently in there).
I've not yet looked up the specification of fallocate(), but it
looked surprising to be allocating pages up to the point where a
page already exists (when shmem_add_to_page_cache will fail) and
then giving up with -EEXIST.
Seeing your Subject, I imagined at first that you would be implementing
FALLOC_FL_PUNCH_HOLE support. That is on my list to do: tmpfs has its
own peculiar madvise(MADV_REMOVE) support (and yes, you may question
whether we were right to add that in) - we should be converting
MADV_REMOVE to use FALLOC_FL_PUNCH_HOLE, and tmpfs to support that.
Thanks,
Hugh
next prev parent reply other threads:[~2011-11-17 1:31 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-15 8:42 Amerigo Wang
2011-11-15 10:23 ` Cong Wang
2011-11-15 17:43 ` Dave Hansen
2011-11-16 7:21 ` Cong Wang
2011-11-16 23:21 ` Dave Hansen
2011-11-15 11:23 ` Pekka Enberg
2011-11-16 7:09 ` Cong Wang
2011-11-16 7:12 ` Pekka Enberg
2011-11-16 7:16 ` Cong Wang
2011-11-17 1:31 ` Hugh Dickins [this message]
2011-11-18 10:27 ` Cong Wang
2011-11-16 1:18 ` KAMEZAWA Hiroyuki
2011-11-16 7:12 ` Cong Wang
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=alpine.LSU.2.00.1111161634360.1957@sister.anvils \
--to=hughd@google.com \
--cc=akpm@linux-foundation.org \
--cc=amwang@redhat.com \
--cc=dave@linux.vnet.ibm.com \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=kay.sievers@vrfy.org \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=lennart@poettering.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=penberg@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