From: Eric Sandeen <sandeen@redhat.com>
To: Barry Naujok <bnaujok@sgi.com>, Niv Sardi <xaiki@sgi.com>,
xfs-oss <xfs@oss.sgi.com>
Subject: xfsprogs patch for calc_default_ag_geometry
Date: Wed, 30 Jan 2008 21:23:16 -0600 [thread overview]
Message-ID: <47A13F24.4090408@redhat.com> (raw)
was just looking at this a little tonight.
I wonder if something like this makes things
any more correct and/or readable.
The patch looks a little ugly but once applied
I think the code makes more sense, it more closely
follows the original spirit of the function, while still
implementing the goal of different geometries for
single disks.
Most importantly it doesn't skip the tricky:
count = dblocks / blocks + (dblocks % blocks != 0);
which is probably what caused the regression.
Or maybe you guys already have your own fix :)
Index: xfsprogs-2.9.5/mkfs/xfs_mkfs.c
===================================================================
--- xfsprogs-2.9.5.orig/mkfs/xfs_mkfs.c
+++ xfsprogs-2.9.5/mkfs/xfs_mkfs.c
@@ -413,6 +413,8 @@ calc_default_ag_geometry(
* First handle the extremes - the points at which we will
* always use the maximum AG size, the points at which we
* always use the minimum, and a "small-step" for 16-128Mb.
+ *
+ * These are chosen regardless of single- or multi-disk.
*/
if (dblocks >= TERABYTES(32, blocklog)) {
blocks = XFS_AG_MAX_BLOCKS(blocklog);
@@ -427,6 +429,9 @@ calc_default_ag_geometry(
}
/*
+ * Sizes in the middle.
+ *
+ * For multidisk:
* For the remainder we choose an AG size based on the
* number of data blocks available, trying to keep the
* number of AGs relatively small (especially compared
@@ -436,34 +441,34 @@ calc_default_ag_geometry(
* smaller counts at mkfs time.
*
* This scales us up smoothly between min/max AG sizes.
+ *
+ * For a single disk:
+ * Limit to 4 ags, unless quite large, then
+ * max out the AG size.
*/
- if (!multidisk) {
- if (dblocks >= TERABYTES(4, blocklog)) {
+ if (multidisk) {
+ if (dblocks > GIGABYTES(512, blocklog))
+ shift = 5;
+ else if (dblocks > GIGABYTES(8, blocklog))
+ shift = 4;
+ else if (dblocks >= MEGABYTES(128, blocklog))
+ shift = 3;
+ else
+ ASSERT(0);
+ } else {
+ if (dblocks < TERABYTES(4, blocklog))
+ shift = 2;
+ else {
blocks = XFS_AG_MAX_BLOCKS(blocklog);
- goto done;
- }
- count = 4;
-
- goto done;
- }
-
- if (dblocks > GIGABYTES(512, blocklog))
- shift = 5;
- else if (dblocks > GIGABYTES(8, blocklog))
- shift = 4;
- else if (dblocks >= MEGABYTES(128, blocklog))
- shift = 3;
- else
- ASSERT(0);
- blocks = dblocks >> shift;
+ goto done;
+ }
+ }
+ blocks = dblocks >> shift;
done:
- ASSERT (count || blocks);
if (!count)
count = dblocks / blocks + (dblocks % blocks != 0);
- if (!blocks)
- blocks = dblocks / count;
*agsize = blocks;
*agcount = count;
reply other threads:[~2008-01-31 3:23 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=47A13F24.4090408@redhat.com \
--to=sandeen@redhat.com \
--cc=bnaujok@sgi.com \
--cc=xaiki@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