From: Andrew Price <anprice@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 2/5] libgfs2: Use the correct parent for rgrp tree insertion
Date: Mon, 23 Feb 2015 18:43:23 +0000 [thread overview]
Message-ID: <1424717006-20839-2-git-send-email-anprice@redhat.com> (raw)
In-Reply-To: <1424717006-20839-1-git-send-email-anprice@redhat.com>
lgfs2_rgrps_append() was using the parent of the last rgrp instead of
the last rgrp itself as the intended parent when inserting new rgrps
into the tree. This left the tree unbalanced in such a way as to make
lookups of the last node in the tree effectively a linear list search.
This was done for each rgrp insertion so, although it didn't cause a
noticeable slow-down for smaller file sytems, tests on 250TB volumes
requiring over a million resource groups would become CPU bound and
could take hours to complete.
This patch fixes lgfs2_rgrps_append() to use the correct parent node for
rgrp tree insertions, giving a significant performance improvement when
creating file systems on large volumes.
Resolves: rhbz#1194446
Signed-off-by: Andrew Price <anprice@redhat.com>
---
gfs2/libgfs2/rgrp.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/gfs2/libgfs2/rgrp.c b/gfs2/libgfs2/rgrp.c
index ed8e01d..cf4385a 100644
--- a/gfs2/libgfs2/rgrp.c
+++ b/gfs2/libgfs2/rgrp.c
@@ -539,9 +539,9 @@ struct osi_node *lgfs2_rgrps_root(lgfs2_rgrps_t rgs)
lgfs2_rgrp_t lgfs2_rgrps_append(lgfs2_rgrps_t rgs, struct gfs2_rindex *entry)
{
lgfs2_rgrp_t rg;
- lgfs2_rgrp_t lastrg = (lgfs2_rgrp_t)osi_last(&rgs->root);
struct osi_node **link = &rgs->root.osi_node;
- struct osi_node *parent = NULL;
+ struct osi_node *parent = osi_last(&rgs->root);
+ lgfs2_rgrp_t lastrg = (lgfs2_rgrp_t)parent;
errno = EINVAL;
if (entry == NULL)
@@ -550,7 +550,6 @@ lgfs2_rgrp_t lgfs2_rgrps_append(lgfs2_rgrps_t rgs, struct gfs2_rindex *entry)
if (lastrg != NULL) { /* Tree is not empty */
if (entry->ri_addr <= lastrg->ri.ri_addr)
return NULL; /* Appending with a lower address doesn't make sense */
- parent = osi_parent(&lastrg->node);
link = &lastrg->node.osi_right;
}
--
1.9.3
next prev parent reply other threads:[~2015-02-23 18:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-23 18:43 [Cluster-devel] [PATCH 1/5] fsck.gfs2: Fix memory leaks in pass1_process_rgrp Andrew Price
2015-02-23 18:43 ` Andrew Price [this message]
2015-02-23 18:43 ` [Cluster-devel] [PATCH 3/5] libgfs2: Remove some obsolete function declarations Andrew Price
2015-02-23 18:43 ` [Cluster-devel] [PATCH 4/5] gfs2-utils: Move metafs handling into gfs2/mkfs/ Andrew Price
2015-02-23 18:43 ` [Cluster-devel] [PATCH 5/5] gfs2_grow/jadd: Use a matching context mount option in mount_gfs2_meta Andrew Price
2015-02-23 19:17 ` [Cluster-devel] [PATCH 1/5] fsck.gfs2: Fix memory leaks in pass1_process_rgrp Bob Peterson
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=1424717006-20839-2-git-send-email-anprice@redhat.com \
--to=anprice@redhat.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;
as well as URLs for NNTP newsgroup(s).