From: Dave Chinner <david@fromorbit.com>
To: "Darrick J. Wong" <djwong@kernel.org>
Cc: Wengang Wang <wen.gang.wang@oracle.com>, linux-xfs@vger.kernel.org
Subject: Re: [PATCH V2] xfs: make src file readable during reflink
Date: Wed, 6 Jul 2022 11:35:33 +1000 [thread overview]
Message-ID: <20220706013533.GK227878@dread.disaster.area> (raw)
In-Reply-To: <YsSFAmc70npnoCbM@magnolia>
On Tue, Jul 05, 2022 at 11:37:54AM -0700, Darrick J. Wong wrote:
> On Tue, Jun 28, 2022 at 11:07:55PM -0700, Wengang Wang wrote:
> > During a reflink operation, the IOLOCK and MMAPLOCK of the source file
> > are held in exclusive mode for the duration. This prevents reads on the
> > source file, which could be a very long time if the source file has
> > millions of extents.
> >
> > As the source of copy, besides some necessary modification (say dirty page
> > flushing), it plays readonly role. Locking source file exclusively through
> > out the full reflink copy is unreasonable.
> >
> > This patch downgrades exclusive locks on source file to shared modes after
> > page cache flushing and before cloning the extents. To avoid source file
> > change after lock downgradation, direct write paths take IOLOCK_EXCL on
> > seeing reflink copy happening to the files.
.....
> I /do/ wonder if range locking would be a better solution here, since we
> can safely unlock file ranges that we've already remapped?
Depends. The prototype I did allowed concurrent remaps to run on
different ranges of the file. The extent manipulations were still
internally serialised by the ILOCK so the concurrent modifications
were still serialised. Hence things like block mapping lookups for
read IO still serialised. (And hence my interest in lockless btrees
for the extent list so read IO wouldn't need to take the ILOCK at
all.)
However, if you want to remap the entire file, we've still got to
start with locking the entire file range and draining IO and writing
back all dirty data. So cloning a file is still a complete
serialisation event with range locking, but we can optimise away
some of the tail latencies by unlocking ranges remapped range by
remapped range...
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
next prev parent reply other threads:[~2022-07-06 1:35 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-29 6:07 [PATCH V2] xfs: make src file readable during reflink Wengang Wang
2022-07-05 16:34 ` Wengang Wang
2022-07-05 18:37 ` Darrick J. Wong
2022-07-06 1:35 ` Dave Chinner [this message]
2022-08-04 2:50 ` Wengang Wang
2022-07-06 1:24 ` Dave Chinner
[not found] <20220624191037.23683-1-wen.gang.wang@oracle.com>
2022-06-28 15:57 ` Wengang Wang
2022-06-28 22:21 ` 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=20220706013533.GK227878@dread.disaster.area \
--to=david@fromorbit.com \
--cc=djwong@kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=wen.gang.wang@oracle.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