From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Eric Sandeen <sandeen@sandeen.net>
Cc: sandeen@redhat.com, linux-xfs@vger.kernel.org
Subject: Re: [PATCH 12/12] xfs_spaceman: add group summary mode
Date: Wed, 21 Jun 2017 14:58:12 -0700 [thread overview]
Message-ID: <20170621215812.GS4733@birch.djwong.org> (raw)
In-Reply-To: <847e6b56-aba2-2371-b8f3-a3d8800c1ae8@sandeen.net>
On Wed, Jun 21, 2017 at 04:53:52PM -0500, Eric Sandeen wrote:
> On 6/15/17 3:37 PM, Darrick J. Wong wrote:
> > From: Darrick J. Wong <darrick.wong@oracle.com>
> >
> > Add a -g switch to show only a per-group summary.
> >
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
>
> with a small fix (see below)
>
> Reviewed-by: Eric Sandeen <sandeen@redhat.com>
>
> > ---
> > man/man8/xfs_spaceman.8 | 6 +++++-
> > spaceman/freesp.c | 27 ++++++++++++++++++++++++---
> > 2 files changed, 29 insertions(+), 4 deletions(-)
> >
> >
> > diff --git a/man/man8/xfs_spaceman.8 b/man/man8/xfs_spaceman.8
> > index f064360..0302196 100644
> > --- a/man/man8/xfs_spaceman.8
> > +++ b/man/man8/xfs_spaceman.8
> > @@ -25,7 +25,7 @@ then the program exits.
> >
> > .SH COMMANDS
> > .TP
> > -.BI "freesp [ \-drs ] [-a agno] [ \-b | \-e bsize | \-h bsize | \-m factor ]"
> > +.BI "freesp [ \-dgrs ] [-a agno] [ \-b | \-e bsize | \-h bsize | \-m factor ]"
> > With no arguments,
> > .B freesp
> > shows a histogram of all free space extents in the filesystem.
> > @@ -49,6 +49,10 @@ This is the default, and is mutually exclusive with the
> > Print debugging information such as the raw free space extent information.
> >
> > .TP
> > +.B \-g
> > +Print the free space block and extent counts for each AG.
> > +
> > +.TP
> > .B \-e bsize
> > Set all histogram bin sizes to a specific value.
> > This option is mutually exclusive with the
> > diff --git a/spaceman/freesp.c b/spaceman/freesp.c
> > index 99e50cf..79eea44 100644
> > --- a/spaceman/freesp.c
> > +++ b/spaceman/freesp.c
> > @@ -43,6 +43,7 @@ static long long multsize;
> > static int histcount;
> > static int seen1;
> > static int summaryflag;
> > +static int gflag;
> > static bool rtflag;
> > static long long totblocks;
> > static long long totexts;
> > @@ -164,6 +165,8 @@ scan_ag(
> > off64_t bperag;
> > off64_t aglen;
> > xfs_agblock_t agbno;
> > + unsigned long long freeblks = 0;
> > + unsigned long long freeexts = 0;
> > int ret;
> > int i;
> >
> > @@ -216,6 +219,8 @@ scan_ag(
> > agbno = (extent->fmr_physical - (bperag * agno)) /
> > blocksize;
> > aglen = extent->fmr_length / blocksize;
> > + freeblks += aglen;
> > + freeexts++;
> >
> > addtohist(agno, agbno, aglen);
> > }
> > @@ -225,6 +230,15 @@ scan_ag(
> > break;
> > fsmap_advance(fsmap);
> > }
> > +
> > + if (gflag) {
> > + if (agno == NULLAGNUMBER)
> > + printf(_(" rtdev %10llu %10llu\n"), freeexts,
> > + freeblks);
> > + else
> > + printf(_("%10u %10llu %10llu\n"), agno, freeexts,
> > + freeblks);
> > + }
> > }
> > static void
> > aglistadd(
> > @@ -258,7 +272,7 @@ init(
> > hist = NULL;
> > rtflag = false;
> >
> > - while ((c = getopt(argc, argv, "a:bde:h:m:rs")) != EOF) {
> > + while ((c = getopt(argc, argv, "a:bde:gh:m:rs")) != EOF) {
> > switch (c) {
> > case 'a':
> > aglistadd(optarg);
> > @@ -280,6 +294,10 @@ init(
> > return command_usage(&freesp_cmd);
> > speced = 1;
> > break;
> > + case 'g':
> > + histcount = 0;
> > + gflag++;
> > + break;
>
> This global needs to be reset in init() or it sticks:
>
> (I can fix it on the way in)
Ok, sounds good. Assuming it's a simple insertion of "gflag = 0" somewhere
before the getopt while loop,
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
--D
>
> xfs_spaceman> freesp
> from to extents blocks pct
> 1 1 647503 647503 1.69
> 2 3 334189 790976 2.07
> 4 7 369499 2009667 5.26
> 8 15 116258 1233152 3.23
> 16 31 16648 370824 0.97
> 32 63 8817 387963 1.01
> 64 127 5474 487854 1.28
> 128 255 3483 631960 1.65
> 256 511 2613 956121 2.50
> 512 1023 1758 1249204 3.27
> 1024 2047 828 1151649 3.01
> 2048 4095 357 972144 2.54
> 4096 8191 122 687724 1.80
> 8192 16383 38 432634 1.13
> 16384 32767 23 566786 1.48
> 32768 65535 15 765430 2.00
> 65536 131071 14 1359754 3.56
> 131072 262143 4 653264 1.71
> 262144 524287 4 1775562 4.64
> 524288 1048575 2 1390287 3.64
> 1048576 2097151 2 2446908 6.40
> 2097152 4194303 2 6234130 16.31
> 4194304 8388607 2 11023746 28.84
> xfs_spaceman> freesp -g
> AG extents blocks
> 0 280589 6629403
> 1 289696 11847480
> 2 14299 7806587
> 3 923071 11941772
> xfs_spaceman> freesp
> AG extents blocks
> 0 280589 6629403
> 1 289696 11847480
> 2 14299 7806587
> 3 923071 11941772
>
>
> > case 'h':
> > if (speced && !histcount)
> > goto many_spec;
> > @@ -331,13 +349,15 @@ freesp_f(
> >
> > if (!init(argc, argv))
> > return 0;
> > + if (gflag)
> > + printf(_(" AG extents blocks\n"));
> > if (rtflag)
> > scan_ag(NULLAGNUMBER);
> > for (agno = 0; !rtflag && agno < file->geom.agcount; agno++) {
> > if (inaglist(agno))
> > scan_ag(agno);
> > }
> > - if (histcount)
> > + if (histcount && !gflag)
> > printhist();
> > if (summaryflag) {
> > printf(_("total free extents %lld\n"), totexts);
> > @@ -363,6 +383,7 @@ freesp_help(void)
> > " -b -- binary histogram bin size\n"
> > " -d -- debug output\n"
> > " -e bsize -- Use fixed histogram bin size of bsize\n"
> > +" -g -- Print only a per-AG summary.\n"
> > " -h hbsz -- Use custom histogram bin size of h1.\n"
> > " Multiple specifications are allowed.\n"
> > " -m bmult -- Use histogram bin size multiplier of bmult.\n"
> > @@ -382,7 +403,7 @@ freesp_init(void)
> > freesp_cmd.cfunc = freesp_f;
> > freesp_cmd.argmin = 0;
> > freesp_cmd.argmax = -1;
> > - freesp_cmd.args = "[-drs] [-a agno]... [ -b | -e bsize | -h h1... | -m bmult ]";
> > + freesp_cmd.args = "[-dgrs] [-a agno]... [ -b | -e bsize | -h h1... | -m bmult ]";
> > freesp_cmd.flags = CMD_FLAG_ONESHOT;
> > freesp_cmd.oneline = _("Examine filesystem free space");
> > freesp_cmd.help = freesp_help;
> >
> > --
> > 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
> >
> --
> 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
prev parent reply other threads:[~2017-06-21 21:58 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-15 20:35 [PATCH v9 00/12] xfsprogs 4.12: GETFSMAP support Darrick J. Wong
2017-06-15 20:35 ` [PATCH 01/12] xfs_io: refactor numlen into a library function Darrick J. Wong
2017-06-21 20:40 ` Eric Sandeen
2017-06-15 20:36 ` [PATCH 02/12] libxcmd: add cvt{int, long} to convert strings to int and long Darrick J. Wong
2017-06-21 20:16 ` Eric Sandeen
2017-06-21 20:29 ` Darrick J. Wong
2017-06-21 20:33 ` Eric Sandeen
2017-06-21 20:38 ` Darrick J. Wong
2017-06-21 21:19 ` [PATCH v2 " Darrick J. Wong
2017-06-15 20:36 ` [PATCH 03/12] libxfs: use crc32c slice-by-8 variant by default Darrick J. Wong
2017-06-21 20:42 ` Eric Sandeen
2017-06-15 20:36 ` [PATCH 04/12] xfs: introduce the XFS_IOC_GETFSMAP ioctl Darrick J. Wong
2017-06-21 20:43 ` Eric Sandeen
2017-06-15 20:36 ` [PATCH 05/12] xfs_io: support the new getfsmap ioctl Darrick J. Wong
2017-06-21 20:51 ` Eric Sandeen
2017-06-21 20:54 ` Darrick J. Wong
2017-06-15 20:36 ` [PATCH 06/12] xfs_repair: replace rmap_compare with libxfs version Darrick J. Wong
2017-06-15 20:36 ` [PATCH 07/12] xfs_spaceman: space management tool Darrick J. Wong
2017-06-21 21:12 ` Eric Sandeen
2017-06-15 20:36 ` [PATCH 08/12] xfs_spaceman: add FITRIM support Darrick J. Wong
2017-06-21 21:21 ` Eric Sandeen
2017-06-15 20:36 ` [PATCH 09/12] xfs_spaceman: add new speculative prealloc control Darrick J. Wong
2017-06-21 21:26 ` Eric Sandeen
2017-06-15 20:36 ` [PATCH 10/12] xfs_spaceman: Free space mapping command Darrick J. Wong
2017-06-21 21:32 ` Eric Sandeen
2017-06-15 20:36 ` [PATCH 11/12] xfs_spaceman: add a man page Darrick J. Wong
2017-06-21 21:45 ` Eric Sandeen
2017-06-15 20:37 ` [PATCH 12/12] xfs_spaceman: add group summary mode Darrick J. Wong
2017-06-21 21:53 ` Eric Sandeen
2017-06-21 21:58 ` Darrick J. Wong [this message]
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=20170621215812.GS4733@birch.djwong.org \
--to=darrick.wong@oracle.com \
--cc=linux-xfs@vger.kernel.org \
--cc=sandeen@redhat.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;
as well as URLs for NNTP newsgroup(s).