From: Brian Foster <bfoster@redhat.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH v2 3/5] xfs: reuse iomap delalloc code for COW fork reservation
Date: Mon, 16 Jan 2017 11:26:01 -0500 [thread overview]
Message-ID: <20170116162601.GB6302@bfoster.bfoster> (raw)
In-Reply-To: <20170113171312.GB27605@infradead.org>
On Fri, Jan 13, 2017 at 09:13:12AM -0800, Christoph Hellwig wrote:
> On Wed, Jan 11, 2017 at 12:54:07PM -0500, Brian Foster wrote:
> > COW fork reservation (delayed allocation) is implemented in
> > xfs_reflink_reserve_cow() and is generally based on the traditional data
> > fork delalloc logic in xfs_file_iomap_begin_delay(). In preparation for
> > further changes to implement more aggressive COW fork preallocation,
> > refactor the COW reservation code to reuse xfs_file_iomap_begin_delay()
> > for data fork allocation as well as COW fork reservation. This patch
> > does not change behavior.
>
> I'm still trying to understand the point of patches 1-3: there is no
> functionality, but a lot of new code is added to reuse some other code.
>
IMO, patches 1-3 stand on their own as cleanup/refactor patches,
regardless of whether we want the actual speculative preallocation patch
(in current form or at all). xfs_reflink_reserve_cow() is mostly a
copy&paste of _iomap_begin_delay() operating on the cow fork rather than
the data fork, so technically we really shouldn't have a need for a
feature specific helper. Duplication aside, I also find the code a bit
confusing to follow in that we have to traverse through several
functions in "do nothing" cases such as non-shared blocks of a reflinked
file.
I would have preferred that code get factored into _begin_delay() from
the start, but it was too late for that by the time I grokked it and
there are also other callers from which prealloc may or may not be
appropriate (and that is why this patch by itself is not sufficient to
kill off _reserve_cow()). That said, we might be able to refactor the
allocation part of both functions such that we can replace the feature
specific helper with a common generic one. IOWs, these patches make it
so I don't have to further duplicate the prealloc stuff between
_write_begin() and _reserve_cow() and in the long term, I think this
helps facilitate further consolidation of duplicate code.
> How would patch 5 look like without that "reuse"?
I suppose we'd copy&paste more of begin_delay() into the reflink
specific helper (e.g., the prealloc bits). Then perhaps add a param to
control whether to perform preallocation.
Brian
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2017-01-16 16:26 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-11 17:54 [PATCH v2 0/5] xfs: basic cow fork speculative preallocation Brian Foster
2017-01-11 17:54 ` [PATCH v2 1/5] xfs: refactor iomap delalloc existing extent search into helper Brian Foster
2017-01-11 17:54 ` [PATCH v2 2/5] xfs: logically separate iomap range from allocation range Brian Foster
2017-01-11 17:54 ` [PATCH v2 3/5] xfs: reuse iomap delalloc code for COW fork reservation Brian Foster
2017-01-13 17:13 ` Christoph Hellwig
2017-01-16 16:26 ` Brian Foster [this message]
2017-01-16 17:37 ` Christoph Hellwig
2017-01-16 19:04 ` Brian Foster
2017-01-11 17:54 ` [PATCH v2 4/5] xfs: free cowblocks and retry on buffered write ENOSPC Brian Foster
2017-01-13 17:12 ` Christoph Hellwig
2017-01-11 17:54 ` [PATCH v2 5/5] xfs: implement basic COW fork speculative preallocation Brian Foster
2017-01-13 17:13 ` [PATCH v2 0/5] xfs: basic cow " Christoph Hellwig
2017-01-16 16:26 ` Brian Foster
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=20170116162601.GB6302@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