* [Cluster-devel] [PATCH 55/56] fsck.gfs2: Speed up rangecheck functions
@ 2011-08-25 17:03 Bob Peterson
0 siblings, 0 replies; only message in thread
From: Bob Peterson @ 2011-08-25 17:03 UTC (permalink / raw)
To: cluster-devel.redhat.com
From c047763230204f55c2da9a6558f47bc26f4b526c Mon Sep 17 00:00:00 2001
From: Bob Peterson <rpeterso@redhat.com>
Date: Thu, 25 Aug 2011 10:49:36 -0500
Subject: [PATCH 55/56] fsck.gfs2: Speed up rangecheck functions
This patch speeds up the block rangecheck functions by passing
the block type in as an integer rather than a translated string
constant. The translation functions were a bit costly.
rhbz#675723
---
gfs2/fsck/pass1.c | 26 ++++++++++++++------------
1 files changed, 14 insertions(+), 12 deletions(-)
diff --git a/gfs2/fsck/pass1.c b/gfs2/fsck/pass1.c
index 8db8579..9929301 100644
--- a/gfs2/fsck/pass1.c
+++ b/gfs2/fsck/pass1.c
@@ -1052,9 +1052,14 @@ static int invalidate_eattr_leaf(struct gfs2_inode *ip, uint64_t block,
* be trusted. Thus it needs to be in a separate loop.
* Returns: 0 if good range, otherwise != 0
*/
+enum b_types { btype_meta, btype_leaf, btype_data, btype_ieattr, btype_eattr};
+const char *btypes[5] = {
+ "metadata", "leaf", "data", "indirect extended attribute",
+ "extended attribute" };
+
static int rangecheck_block(struct gfs2_inode *ip, uint64_t block,
- struct gfs2_buffer_head **bh,
- const char *btype, void *private)
+ struct gfs2_buffer_head **bh, enum b_types btype,
+ void *private)
{
long *bad_pointers = (long *)private;
uint8_t q;
@@ -1063,7 +1068,7 @@ static int rangecheck_block(struct gfs2_inode *ip, uint64_t block,
(*bad_pointers)++;
log_info( _("Bad %s block pointer (invalid or out of range "
"#%ld) found in inode %lld (0x%llx).\n"),
- btype, *bad_pointers,
+ btypes[btype], *bad_pointers,
(unsigned long long)ip->i_di.di_num.no_addr,
(unsigned long long)ip->i_di.di_num.no_addr);
if ((*bad_pointers) <= BAD_POINTER_TOLERANCE)
@@ -1077,7 +1082,7 @@ static int rangecheck_block(struct gfs2_inode *ip, uint64_t block,
(*bad_pointers)++;
log_info( _("Duplicated %s block pointer (violation %ld, block"
" %lld (0x%llx)) found in inode %lld (0x%llx).\n"),
- btype, *bad_pointers,
+ btypes[btype], *bad_pointers,
(unsigned long long)block, (unsigned long long)block,
(unsigned long long)ip->i_di.di_num.no_addr,
(unsigned long long)ip->i_di.di_num.no_addr);
@@ -1093,36 +1098,33 @@ static int rangecheck_metadata(struct gfs2_inode *ip, uint64_t block,
struct gfs2_buffer_head **bh, int h,
void *private)
{
- return rangecheck_block(ip, block, bh, _("metadata"), private);
+ return rangecheck_block(ip, block, bh, btype_meta, private);
}
static int rangecheck_leaf(struct gfs2_inode *ip, uint64_t block,
void *private)
{
- return rangecheck_block(ip, block, NULL, _("leaf"), private);
+ return rangecheck_block(ip, block, NULL, btype_leaf, private);
}
static int rangecheck_data(struct gfs2_inode *ip, uint64_t block,
void *private)
{
- return rangecheck_block(ip, block, NULL, _("data"), private);
+ return rangecheck_block(ip, block, NULL, btype_data, private);
}
static int rangecheck_eattr_indir(struct gfs2_inode *ip, uint64_t block,
uint64_t parent,
struct gfs2_buffer_head **bh, void *private)
{
- return rangecheck_block(ip, block, NULL,
- _("indirect extended attribute"),
- private);
+ return rangecheck_block(ip, block, NULL, btype_ieattr, private);
}
static int rangecheck_eattr_leaf(struct gfs2_inode *ip, uint64_t block,
uint64_t parent, struct gfs2_buffer_head **bh,
void *private)
{
- return rangecheck_block(ip, block, NULL, _("extended attribute"),
- private);
+ return rangecheck_block(ip, block, NULL, btype_eattr, private);
}
struct metawalk_fxns rangecheck_fxns = {
--
1.7.4.4
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2011-08-25 17:03 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-25 17:03 [Cluster-devel] [PATCH 55/56] fsck.gfs2: Speed up rangecheck functions Bob Peterson
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).