From: David Chinner <dgc@sgi.com>
To: Ruben Porras <ruben.porras@linworks.de>
Cc: xfs@oss.sgi.com, iusty@k1024.org
Subject: Re: XFS shrink (step 0)
Date: Fri, 29 Jun 2007 16:55:25 +1000 [thread overview]
Message-ID: <20070629065525.GQ31489@sgi.com> (raw)
In-Reply-To: <46838FB4.1040906@linworks.de>
On Thu, Jun 28, 2007 at 12:38:44PM +0200, Ruben Porras wrote:
> David Chinner wrote:
> >No, there isn't anything currently in existence to do this.
> >
> >It's not difficult, though. What you need to do is count the number of
> >used blocks in the AGs that will be truncated off, and check whether
> >there is enough free space in the remaining AGs to hold all the
> >blocks that we are going to move.
> >
> >I think this could be done we a single loop across the perag
> >array or with a simple xfs_db wrapper and some shell/awk/perl
> >magic.
> >
> Do you mind that is it ok to depend on shell/awk/perl?
Sure. We have a few programs that are just shell wrappers
of other xfs programs
e.g:
xfs_bmap: shell script that calls xfs_io
xfs_check: shell script that calls xfs_db
xfs_info: shell script that calls xfs_growfs
> I'll do it in C looping through the perag array.
For something like this it's probably easier to do with shell/perl/awk.
e.g. in shell, the number of ags in the filesystem:
iterate all ags:
numags=`xfs_db -r -c "sb 0" -c "p agcount" /dev/sdb8 | sed -e 's/.* = //'`
lastag=`expr $numags - 1`
for ags in `seq 0 1 $lastag`; do
....
done
Free space in an AG 0:
xfs_db -r -c "freesp -s -a 0" /dev/sdb8 | awk '/total free blocks/ {print $4}'
And so on. You can peek into pretty much any structure on disk with xfs_db
and you can do it online so it's pretty much perfect for this sort of
checking. I'd start with something like this, and if it gets too complex
then we need to look at integrating it into xfs_db (i.e. writing it in C)....
Cheers,
Dave.
--
Dave Chinner
Principal Engineer
SGI Australian Software Group
next prev parent reply other threads:[~2007-06-29 6:55 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-01 16:39 XFS shrink functionality Ruben Porras
2007-06-04 0:16 ` David Chinner
2007-06-04 8:41 ` Iustin Pop
2007-06-04 9:21 ` David Chinner
2007-06-05 8:00 ` Iustin Pop
2007-06-06 1:50 ` Nathan Scott
2007-06-07 8:18 ` David Chinner
2007-06-08 8:23 ` Ruben Porras
2007-06-08 10:15 ` Iustin Pop
2007-06-08 15:12 ` David Chinner
2007-06-08 16:03 ` Iustin Pop
2007-06-09 2:15 ` David Chinner
2007-06-08 19:47 ` Ruben Porras
2007-06-14 8:35 ` Ruben Porras
2007-06-14 9:14 ` David Chinner
2007-06-08 14:44 ` David Chinner
2007-06-19 22:22 ` XFS shrink (step 0) Ruben Porras
2007-06-19 23:42 ` David Chinner
2007-06-28 10:38 ` Ruben Porras
2007-06-29 6:55 ` David Chinner [this message]
2007-07-30 17:30 ` Ruben Porras
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=20070629065525.GQ31489@sgi.com \
--to=dgc@sgi.com \
--cc=iusty@k1024.org \
--cc=ruben.porras@linworks.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