gfs2-utils: master - fsck.gfs2: small parameter passing optimization

Bob Peterson rpeterso at fedoraproject.org
Tue Jan 26 21:11:12 UTC 2010


Gitweb:        http://git.fedorahosted.org/git/gfs2-utils.git?p=gfs2-utils.git;a=commitdiff;h=c73635bba7d4f1aab558dab181b311f1cc32a475
Commit:        c73635bba7d4f1aab558dab181b311f1cc32a475
Parent:        966e6ce68492ca770a73171db2f97e246dacb959
Author:        Bob Peterson <bob at ganesha.peterson>
AuthorDate:    Mon Jan 25 14:54:39 2010 -0600
Committer:     Bob Peterson <rpeterso at redhat.com>
CommitterDate: Tue Jan 26 15:09:52 2010 -0600

fsck.gfs2: small parameter passing optimization

This patch is a small optimization in a very often-used function,
done for performance purposes.  Function handle_di in pass1 derives
the block number from the buffer already passed in rather than
having the block number passed in as well, and wasting time
pushing it to the stack and off the stack.

rhbz#455300
---
 gfs2/fsck/pass1.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/gfs2/fsck/pass1.c b/gfs2/fsck/pass1.c
index bb56487..1d33bd3 100644
--- a/gfs2/fsck/pass1.c
+++ b/gfs2/fsck/pass1.c
@@ -867,13 +867,13 @@ struct metawalk_fxns rangecheck_fxns = {
         .check_eattr_leaf = rangecheck_eattr_leaf,
 };
 
-static int handle_di(struct gfs2_sbd *sdp, struct gfs2_buffer_head *bh,
-			  uint64_t block)
+static int handle_di(struct gfs2_sbd *sdp, struct gfs2_buffer_head *bh)
 {
 	uint8_t q;
 	struct gfs2_inode *ip;
 	int error;
 	struct block_count bc = {0};
+	uint64_t block = bh->b_blocknr;
 	long bad_pointers;
 
 	q = block_type(block);
@@ -1192,7 +1192,7 @@ int pass1(struct gfs2_sbd *sbp)
 				}
 				check_n_fix_bitmap(sbp, block,
 						   gfs2_block_free);
-			} else if (handle_di(sbp, bh, block) < 0) {
+			} else if (handle_di(sbp, bh) < 0) {
 				stack;
 				brelse(bh);
 				return FSCK_ERROR;


More information about the cluster-commits mailing list