From: David Chinner <dgc@sgi.com>
To: Timothy Shimmin <tes@sgi.com>
Cc: David Chinner <dgc@sgi.com>, xfs-dev <xfs-dev@sgi.com>,
xfs-oss <xfs@oss.sgi.com>
Subject: Re: Review: Multi-File Data Streams V2
Date: Mon, 25 Jun 2007 13:53:15 +1000 [thread overview]
Message-ID: <20070625035315.GL86004887@sgi.com> (raw)
In-Reply-To: <467B8BFA.2050107@sgi.com>
On Fri, Jun 22, 2007 at 06:44:42PM +1000, Timothy Shimmin wrote:
> Hi Dave,
>
> For the xfs_bmap.c/xfs_bmap_btalloc()
>
> *
> Might be clearer something like this:
> ------------------
> if (nullfb) {
> if (ap->userdata && xfs_inode_is_filestream(ap->ip)) {
> ag = xfs_filestream_lookup_ag(ap->ip);
> ag = (ag != NULLAGNUMBER) ? ag : 0;
> ap->rval = XFS_AGB_TO_FSB(mp, ag, 0);
> } else {
> ap->rval = XFS_INO_TO_FSB(mp, ap->ip->i_ino);
> }
> } else
> ap->rval = ap->firstblock;
> -------------------
> Unless we need "ag" set for the non-userdata && filestream case.
> I think Barry was questioning this today.
ag gets overwritten from args.fsbno, which is set up from
ap->rval, which comes from XFS_AGB_TO_FSB(mp, ag, 0) which means
that ag is not needed outside this check. So yes, it would
probably be cleaner.
> *
> It is interesting that at the start we set up the fsb
> for (userdata & filestreams) and then in a bunch of other places
> it tests just for filestreams - although, there is one spot further
> down which also tests for userdata.
Yes, because the userdata case you refer to is the need to select
a new stream ag - failing to allocate metadata, which may be in a
different AG, shouldn't cause the data stream to move.
In other cases, we check for filestreams to set up the fallbacks
on failure correctly. Those are the same for data and metadata
for filestreams.
> I find this a bit confusing (as usual:) - I thought we were only interested
> in changing the allocation of userdata for the filestream.
Mostly, yes, but metadata and data tend to be allocated with the
same locality principles which filestreams does not follow.
Hence there are small differences in the way we treat them.
> *
> As we talked about before, this code seems to come up in a few places:
>
> need = XFS_MIN_FREELIST_PAG(pag, mp);
> delta = need > pag->pagf_flcount ?
> need - pag->pagf_flcount : 0;
> longest = (pag->pagf_longest > delta) ?
> (pag->pagf_longest - delta) :
> (pag->pagf_flcount > 0 ||
> pag->pagf_longest > 0);
>
> Perhaps we could macroize/inline-function it?
Sure. I'll do that as a separate patch, though.
> It confused me in _xfs_filestream_pick_ag() when I was trying
> to understand it and so could do with a comment for it too.
> As I said then, I don't like the way it uses a boolean as
> the number of blocks, in the case when the longest extent is
> is smaller than the excess over the freelist which
> the fresspace-btree-splits-overhead needs.
Actually, the logic statement is correct. If we have a delta greater
than the longest extent, we cannot find out what the next longest
extent is without searching the btree. Hence we assume that the
longest extent is a single block, which means if the have free
extents in the tree (pag->pagf_longest > 0) or we have blocks in the
freelist (pag->pagf_flcount > 0) we are guaranteed to be able to
alocate a single block if there is space available. So the logic is:
longest = 0;
if pag->pagf_longest > delta
longest = pag->pagf_longest - delta;
else if pag->pagf_flcount > 0
longest = 1;
else if pag->pagf_longest > 0
longest = 1;
And the above is simply more compact.
> Also, the variables "need" and "delta" look pretty local to it.
*nod*
Cheers,
Dave.
--
Dave Chinner
Principal Engineer
SGI Australian Software Group
next prev parent reply other threads:[~2007-06-25 5:45 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-13 4:16 Review: Multi-File Data Streams V2 David Chinner
2007-06-16 20:38 ` Christoph Hellwig
2007-06-18 1:47 ` David Chinner
2007-06-22 8:44 ` Timothy Shimmin
2007-06-25 3:53 ` David Chinner [this message]
2007-06-26 12:16 ` Tim Shimmin
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=20070625035315.GL86004887@sgi.com \
--to=dgc@sgi.com \
--cc=tes@sgi.com \
--cc=xfs-dev@sgi.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