From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Eric Sandeen <sandeen@sandeen.net>
Cc: Jorge Guerra <jorge.guerra@gmail.com>,
linux-xfs@vger.kernel.org, osandov@osandov.com,
Jorge Guerra <jorgeguerra@fb.com>
Subject: Re: [PATCH] xfs_db: Scan entire file system when using 'frag'
Date: Fri, 26 Apr 2019 18:24:06 -0700 [thread overview]
Message-ID: <20190427012406.GO178290@magnolia> (raw)
In-Reply-To: <4c0ed0bf-c980-9379-3816-c8e5dddd61b5@sandeen.net>
On Fri, Apr 26, 2019 at 07:13:49PM -0500, Eric Sandeen wrote:
> On 4/26/19 5:59 PM, Jorge Guerra wrote:
> > From: Jorge Guerra <jorgeguerra@fb.com>
> >
> > While running the 'frag' command of 'xfs_db' we noticed that the
> > tool is not scanning all the files in the file system. We noticed
> > this when we modified the tool to print the inodes of all the files
> > scanned. For example:
> >
> > $ find /mnt/xfsdisk -type f | wc -l
> > 1782674
> > $ xfs_db -r -c frag /dev/sdXX | grep MB | awk '{print $5}' | paste -s -d+ | bc
> > 656818
> >
> > Upon inspecting the code we noticed that the scanfunc_ino function
> > stops processing a given inode block once it encounters a free leaf.
> > However, in practice we see that inodes are necessarily always layed
> > out contiguously on the leaf node. This resulted in the 'frag'
> > command skipping some valid inodes.
> >
> > In this change we modify the scanfunc_ino function to skip freed
> > inodes. With the change in place we ran the same experiment again
> > and noticed a more accurate file count:
> >
> > $ find /mnt/d0 -type f | wc -l
> > 1810442
> > $ xfs_db -r -c frag /dev/sdXX | grep MB | awk '{print $5}' | paste -s -d+ | bc
> > 1810442
> >
> > Signed-off-by: Jorge Guerra <jorgeguerra@fb.com>
>
> This looks right, but I'll warn you that xfs_db's frag command is largely
> useless in the first place. ;)
I was looking through the manpages for the part where it says frag is
useless but couldn't find it. Oh well. :(
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
--D
>
> Also, I think:
>
> Fixes: 2a5eb70c ("xfs_db: teach the frag command about sparse inode chunks")
>
> Reviewed-by: Eric Sandeen <sandeen@redhat.com>
>
> Thanks!
>
> > ---
> > db/frag.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/db/frag.c b/db/frag.c
> > index 5f33cb73..91395234 100644
> > --- a/db/frag.c
> > +++ b/db/frag.c
> > @@ -507,7 +507,7 @@ scanfunc_ino(
> >
> > for (j = 0; j < inodes_per_buf; j++) {
> > if (XFS_INOBT_IS_FREE_DISK(&rp[i], ioff + j))
> > - goto next_buf;
> > + continue;
> > dip = (xfs_dinode_t *)((char *)iocur_top->data +
> > ((off + j) << mp->m_sb.sb_inodelog));
> > process_inode(agf, agino + ioff + j, dip);
> >
next prev parent reply other threads:[~2019-04-27 1:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-26 22:59 [PATCH] xfs_db: Scan entire file system when using 'frag' Jorge Guerra
2019-04-27 0:13 ` Eric Sandeen
2019-04-27 1:24 ` Darrick J. Wong [this message]
2019-04-27 3:32 ` Jorge Guerra
2019-04-27 3:32 ` Jorge Guerra
2019-04-27 10:51 ` Eric Sandeen
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=20190427012406.GO178290@magnolia \
--to=darrick.wong@oracle.com \
--cc=jorge.guerra@gmail.com \
--cc=jorgeguerra@fb.com \
--cc=linux-xfs@vger.kernel.org \
--cc=osandov@osandov.com \
--cc=sandeen@sandeen.net \
/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