From: Dave Chinner <david@fromorbit.com>
To: Christoph Hellwig <hch@lst.de>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH 2/9] xfs: split xfs_bmap_btalloc_nullfb
Date: Mon, 14 Apr 2014 11:55:44 +1000 [thread overview]
Message-ID: <20140414015544.GH27694@dastard> (raw)
In-Reply-To: <1397289723-26243-3-git-send-email-hch@lst.de>
On Sat, Apr 12, 2014 at 10:01:56AM +0200, Christoph Hellwig wrote:
> Split xfs_bmap_btalloc_nullfb into one function for filestream allocations
> and one for everything else that share a few helpers. This dramatically
> simplifies the control flow.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
Small comment below.
> ---
> fs/xfs/xfs_bmap.c | 200 +++++++++++++++++++++++++++++++----------------------
> 1 file changed, 117 insertions(+), 83 deletions(-)
>
> diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c
> index 3340f0e..d5d52df 100644
> --- a/fs/xfs/xfs_bmap.c
> +++ b/fs/xfs/xfs_bmap.c
> @@ -3517,6 +3517,67 @@ xfs_bmap_adjacent(
> #undef ISVALID
> }
>
> +static int
> +xfs_bmap_longest_free_extent(
> + struct xfs_trans *tp,
> + xfs_agnumber_t ag,
> + xfs_extlen_t *blen,
> + int *notinit)
> +{
> + struct xfs_mount *mp = tp->t_mountp;
> + struct xfs_perag *pag;
> + xfs_extlen_t longest;
> + int error = 0;
> +
> + pag = xfs_perag_get(mp, ag);
> + if (!pag->pagf_init) {
> + error = xfs_alloc_pagf_init(mp, tp, ag, XFS_ALLOC_FLAG_TRYLOCK);
> + if (error)
> + goto out;
> +
> + if (!pag->pagf_init) {
> + *notinit = 1;
> + goto out;
> + }
> + }
> +
> + longest = xfs_alloc_longest_free_extent(mp, pag);
> + if (*blen < longest)
> + *blen = longest;
> +
> +out:
> + xfs_perag_put(pag);
> + return error;
> +}
> +
> +static void
> +xfs_bmap_fix_args(
> + struct xfs_bmalloca *ap,
> + struct xfs_alloc_arg *args,
> + xfs_extlen_t *blen,
> + int notinit)
Not a big fan of the "fix_args" name here. What it's actually doing
is setting the minimum allocation length. Also, it could return the
minimum length rather than set it inside the function, and pass
blen by value rather than reference as it isn't modified in the
function...
Other than that, it's a good cleanup.
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2014-04-14 1:55 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-12 8:01 filestream allocator rewrite Christoph Hellwig
2014-04-12 8:01 ` [PATCH 1/9] xfs: don't try to use the filestream allocator for metadata allocations Christoph Hellwig
2014-04-12 8:01 ` [PATCH 2/9] xfs: split xfs_bmap_btalloc_nullfb Christoph Hellwig
2014-04-14 1:55 ` Dave Chinner [this message]
2014-04-14 7:03 ` Christoph Hellwig
2014-04-14 7:17 ` Dave Chinner
2014-04-12 8:01 ` [PATCH 3/9] xfs: handle duplicate entries in xfs_mru_cache_insert Christoph Hellwig
2014-04-12 8:01 ` [PATCH 4/9] xfs: embedd mru_elem into parent structure Christoph Hellwig
2014-04-12 8:01 ` [PATCH 5/9] xfs: remove XFS_IFILESTREAM Christoph Hellwig
2014-04-12 8:02 ` [PATCH 6/9] xfs: rewrite the filestream allocator using the dentry cache Christoph Hellwig
2014-04-12 8:02 ` [PATCH 7/9] xfs: don't create a slab cache for filestream items Christoph Hellwig
2014-04-12 8:02 ` [PATCH 8/9] xfs: remove xfs_filestream_associate Christoph Hellwig
2014-04-12 8:02 ` [PATCH 9/9] xfs: add filestream allocator tracepoints Christoph Hellwig
2014-04-14 2:23 ` filestream allocator rewrite Dave Chinner
2014-04-22 21:06 ` 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=20140414015544.GH27694@dastard \
--to=david@fromorbit.com \
--cc=hch@lst.de \
--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).