From: Brian Foster <bfoster@redhat.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH RFC 3/4] xfs: reuse xfs_file_iomap_begin_delay() for cow fork delalloc
Date: Tue, 15 Nov 2016 13:11:25 -0500 [thread overview]
Message-ID: <20161115181125.GE65218@bfoster.bfoster> (raw)
In-Reply-To: <20161115142826.GC18630@infradead.org>
On Tue, Nov 15, 2016 at 06:28:26AM -0800, Christoph Hellwig wrote:
> > + /*
> > + * Search for a preexisting extent. COW fork allocation may still be
> > + * required for reflink inodes if the data extent is shared.
> > + */
> > xfs_bmap_search_extents(ip, offset_fsb, XFS_DATA_FORK, &eof, &idx,
> > &got, &prev);
> > imap = got;
>
> Maybe we should look up directly into imap and now duplicate that
> information for imap and got?
>
Didn't you recently change this code from doing that? I'm not following
how changing it back helps us...
> > if (xfs_is_reflink_inode(ip)) {
> > + bool shared, trimmed;
> >
> > + /*
> > + * Assume the data extent is shared if an extent exists
> > + * in the cow fork.
> > + */
> > + xfs_trim_extent(&imap, offset_fsb,
> > + end_fsb - offset_fsb);
> > + xfs_bmap_search_extents(ip, imap.br_startoff,
> > + XFS_COW_FORK, &eof, &idx, &got, &prev);
> > + if (!eof && got.br_startoff <= imap.br_startoff) {
> > + trace_xfs_reflink_cow_found(ip, &got);
> > + xfs_trim_extent(&imap, got.br_startoff,
> > + got.br_blockcount);
> > + goto done;
> > + }
> > +
> > + /*
> > + * No existing cow fork extent. Now we have to actually
> > + * check if the data extent is shared and trim the
> > + * mapping to the next (un)shared boundary.
> > + */
> > + error = xfs_reflink_trim_around_shared(ip, &imap,
> > + &shared, &trimmed);
> > if (error)
> > goto out_unlock;
> > + if (!shared)
> > + goto done;
> > +
> > + end_fsb = imap.br_startoff + imap.br_blockcount;
>
> I think the code for looking at the COW fork should go into a little
> helper, even if it means passing a few arguments to it.
>
Ok.
> > + fork = XFS_COW_FORK;
> > + } else {
> > + trace_xfs_iomap_found(ip, offset, count, 0, &imap);
> > + goto done;
> > }
>
> And while we're at it - try to always handle the a that ends with a
> goto first, that helps to reduce the indentation level.
>
Indeed, that looks like a nice cleanup.
Brian
next prev parent reply other threads:[~2016-11-15 18:11 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-08 20:27 [PATCH RFC 0/4] xfs: basic cow fork speculative preallocation Brian Foster
2016-11-08 20:27 ` [PATCH RFC 1/4] xfs: clean up cow fork reservation and tag inodes correctly Brian Foster
2016-11-15 14:16 ` Christoph Hellwig
2016-11-15 18:11 ` Brian Foster
2016-11-18 8:11 ` Christoph Hellwig
2016-11-18 15:10 ` Brian Foster
2016-11-08 20:27 ` [PATCH RFC 2/4] xfs: logically separate iomap range from allocation range Brian Foster
2016-11-15 14:18 ` Christoph Hellwig
2016-11-15 18:11 ` Brian Foster
2016-11-08 20:27 ` [PATCH RFC 3/4] xfs: reuse xfs_file_iomap_begin_delay() for cow fork delalloc Brian Foster
2016-11-15 14:28 ` Christoph Hellwig
2016-11-15 18:11 ` Brian Foster [this message]
2016-11-18 8:13 ` Christoph Hellwig
2016-11-18 15:11 ` Brian Foster
2016-11-08 20:27 ` [PATCH RFC 4/4] xfs: implement basic COW fork speculative preallocation Brian Foster
2016-11-08 20:48 ` [PATCH RFC 0/4] xfs: basic cow " Darrick J. Wong
2016-11-08 22:39 ` Brian Foster
2016-11-08 23:34 ` 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=20161115181125.GE65218@bfoster.bfoster \
--to=bfoster@redhat.com \
--cc=hch@infradead.org \
--cc=linux-xfs@vger.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;
as well as URLs for NNTP newsgroup(s).