From: Theodore Ts'o <tytso@mit.edu>
To: Dave Chinner <david@fromorbit.com>
Cc: Namjae Jeon <linkinjeon@gmail.com>,
elder@kernel.org, Namjae Jeon <namjae.jeon@samsung.com>,
linux-kernel@vger.kernel.org, xfs@oss.sgi.com, hch@infradead.org,
bpm@sgi.com, adilger.kernel@dilger.ca, a.sangwan@samsung.com,
linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org
Subject: Re: [PATCH 1/3] fs: Introduce new flag FALLOC_FL_COLLAPSE_RANGE
Date: Wed, 31 Jul 2013 20:46:45 -0400 [thread overview]
Message-ID: <20130801004645.GC11378@thunk.org> (raw)
In-Reply-To: <20130801002341.GI7118@dastard>
On Thu, Aug 01, 2013 at 10:23:41AM +1000, Dave Chinner wrote:
> On Wed, Jul 31, 2013 at 06:01:54PM -0400, Theodore Ts'o wrote:
> > Have you considered what happens if you have a 10 megabyte file, of
> > which the first 5 megs are mmap'ed into a userspace process.
> >
> > Now suppose you call COLLAPASE_RANGE on a one megabyte range starting
> > at offset 1024k from the beginning of the file.
> >
> > Does the right thing happen to the mmap'ed region in memory?
>
> Implementation detail. like a hole punch, it needs to invalidate the
> range that it is operating over so mmap()d regions are refaulted
> after the operation is done.
It's not just the range that it's operating on, but also the region
beyond the range that's been collapsed out. That's because the page
that had formerly located at offset 3072k would now be located at
2048k. And you had better make sure that any dirty pages located
beyond that are written out to disk before you do the invalidate and
collapse. As a result, there's going to be potential races that don't
exist with truncate and punch.
A quick eyeball of the patch didn't seem to show any code that handled
this, which is why I asked the question.
- Ted
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2013-08-01 0:46 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-31 14:42 [PATCH 1/3] fs: Introduce new flag FALLOC_FL_COLLAPSE_RANGE Namjae Jeon
2013-07-31 22:01 ` Theodore Ts'o
2013-08-01 0:23 ` Dave Chinner
2013-08-01 0:46 ` Theodore Ts'o [this message]
2013-08-01 0:54 ` Dave Chinner
2013-08-01 1:07 ` Theodore Ts'o
2013-08-01 2:59 ` Dave Chinner
2013-08-01 4:06 ` Theodore Ts'o
2013-08-01 4:32 ` Dave Chinner
2013-08-01 0:22 ` Dave Chinner
2013-08-01 5:07 ` Namjae Jeon
2013-08-02 2:37 ` Dave Chinner
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=20130801004645.GC11378@thunk.org \
--to=tytso@mit.edu \
--cc=a.sangwan@samsung.com \
--cc=adilger.kernel@dilger.ca \
--cc=bpm@sgi.com \
--cc=david@fromorbit.com \
--cc=elder@kernel.org \
--cc=hch@infradead.org \
--cc=linkinjeon@gmail.com \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=namjae.jeon@samsung.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).