cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Bob Peterson <rpeterso@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [gfs2-utils PATCH 1/7] fsck.gfs2: Don't bother to pass bl blockmap pointer
Date: Wed, 22 Jun 2016 14:26:46 -0500	[thread overview]
Message-ID: <cae674dc15e7901b251f10f232206288e8f53979.1466623302.git.rpeterso@redhat.com> (raw)
In-Reply-To: <cover.1466623302.git.rpeterso@redhat.com>

Since the blockmap pointer, bl, is a global variable of pass1, we
don't need to pass it around needlessly. Make this more efficient.

Signed-off-by: Bob Peterson <rpeterso@redhat.com>
---
 gfs2/fsck/pass1.c | 25 ++++++++++++-------------
 1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/gfs2/fsck/pass1.c b/gfs2/fsck/pass1.c
index 6f04109..112b68e 100644
--- a/gfs2/fsck/pass1.c
+++ b/gfs2/fsck/pass1.c
@@ -90,17 +90,17 @@ static int delete_block(struct gfs2_inode *ip, uint64_t block,
 			struct gfs2_buffer_head **bh, const char *btype,
 			void *private);
 
-static int gfs2_blockmap_set(struct gfs2_bmap *bmap, uint64_t bblock, int mark)
+static int gfs2_blockmap_set(uint64_t bblock, int mark)
 {
 	static unsigned char *byte;
 	static uint64_t b;
 
-	if (!bmap)
+	if (bl == NULL)
 		return 0;
-	if (bblock > bmap->size)
+	if (bblock > bl->size)
 		return -1;
 
-	byte = bmap->map + BLOCKMAP_SIZE2(bblock);
+	byte = bl->map + BLOCKMAP_SIZE2(bblock);
 	b = BLOCKMAP_BYTE_OFFSET2(bblock);
 	*byte &= ~(BLOCKMAP_MASK2 << b);
 	*byte |= (mark & BLOCKMAP_MASK2) << b;
@@ -120,7 +120,7 @@ static int _fsck_blockmap_set(struct gfs2_inode *ip, uint64_t bblock,
 	if (error)
 		return error;
 
-	return gfs2_blockmap_set(bl, bblock, mark);
+	return gfs2_blockmap_set(bblock, mark);
 }
 
 #define fsck_blockmap_set(ip, b, bt, m) \
@@ -1336,7 +1336,7 @@ static int alloc_metalist(struct gfs2_inode *ip, uint64_t block,
 			    "%lld (0x%llx) is now marked as indirect.\n"),
 			  desc, (unsigned long long)block,
 			  (unsigned long long)block);
-		gfs2_blockmap_set(bl, block, ip->i_sbd->gfs1 ?
+		gfs2_blockmap_set(block, ip->i_sbd->gfs1 ?
 				  GFS2_BLKST_DINODE : GFS2_BLKST_USED);
 	}
 	return meta_is_good;
@@ -1358,7 +1358,7 @@ static int alloc_data(struct gfs2_inode *ip, uint64_t metablock,
 			    "%lld (0x%llx) is now marked as data.\n"),
 			  desc, (unsigned long long)block,
 			  (unsigned long long)block);
-		gfs2_blockmap_set(bl, block, GFS2_BLKST_USED);
+		gfs2_blockmap_set(block, GFS2_BLKST_USED);
 	}
 	return 0;
 }
@@ -1407,8 +1407,7 @@ static int pass1_check_metatree(struct gfs2_inode *ip,
 
 	error = check_metatree(ip, pass);
 	if (error)
-		gfs2_blockmap_set(bl, ip->i_di.di_num.no_addr,
-				  GFS2_BLKST_FREE);		
+		gfs2_blockmap_set(ip->i_di.di_num.no_addr, GFS2_BLKST_FREE);
 	return error;
 }
 
@@ -1671,7 +1670,7 @@ static int check_system_inode(struct gfs2_sbd *sdp,
 				   "%llu (0x%llx)\n"),
 				 (unsigned long long)iblock,
 				 (unsigned long long)iblock);
-			gfs2_blockmap_set(bl, iblock, GFS2_BLKST_FREE);
+			gfs2_blockmap_set(iblock, GFS2_BLKST_FREE);
 			check_n_fix_bitmap(sdp, (*sysinode)->i_rgd, iblock, 0,
 					   GFS2_BLKST_FREE);
 			inode_put(sysinode);
@@ -1706,7 +1705,7 @@ static int check_system_inode(struct gfs2_sbd *sdp,
 				/* Set the blockmap (but not bitmap) back to
 				   'free' so that it gets checked like any
 				   normal dinode. */
-				gfs2_blockmap_set(bl, iblock, GFS2_BLKST_FREE);
+				gfs2_blockmap_set(iblock, GFS2_BLKST_FREE);
 				log_err( _("Removed system inode \"%s\".\n"),
 					 filename);
 			}
@@ -2044,7 +2043,7 @@ static int pass1_process_rgrp(struct gfs2_sbd *sdp, struct rgrp_tree *rgd)
 
 		n = lgfs2_bm_scan(rgd, k, ibuf, GFS2_BLKST_UNLINKED);
 		for (i = 0; i < n; i++) {
-			gfs2_blockmap_set(bl, ibuf[i], GFS2_BLKST_UNLINKED);
+			gfs2_blockmap_set(ibuf[i], GFS2_BLKST_UNLINKED);
 			if (fsck_abort)
 				goto out;
 		}
@@ -2200,7 +2199,7 @@ int pass1(struct gfs2_sbd *sdp)
 			log_debug( _("rgrp block %lld (0x%llx) "
 				     "is now marked as 'rgrp data'\n"),
 				   rgd->ri.ri_addr + i, rgd->ri.ri_addr + i);
-			if (gfs2_blockmap_set(bl, rgd->ri.ri_addr + i,
+			if (gfs2_blockmap_set(rgd->ri.ri_addr + i,
 					      GFS2_BLKST_USED)) {
 				stack;
 				gfs2_special_free(&gfs1_rindex_blks);
-- 
2.5.5



  reply	other threads:[~2016-06-22 19:26 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-22 19:26 [Cluster-devel] [gfs2-utils PATCH 0/7] fsck.gfs2 performance improvements Bob Peterson
2016-06-22 19:26 ` Bob Peterson [this message]
2016-06-23 12:45   ` [Cluster-devel] [gfs2-utils PATCH 1/7] fsck.gfs2: Don't bother to pass bl blockmap pointer Andrew Price
2016-06-22 19:26 ` [Cluster-devel] [gfs2-utils PATCH 2/7] fsck.gfs2: Remember the previous rgrp pointer for speed Bob Peterson
2016-06-22 19:26 ` [Cluster-devel] [gfs2-utils PATCH 3/7] fsck.gfs2: Don't set gfs1rg pointer unless we need to Bob Peterson
2016-06-22 19:26 ` [Cluster-devel] [gfs2-utils PATCH 4/7] fsck.gfs2: Make _fsck_bitmap_set not send a return code Bob Peterson
2016-06-22 19:26 ` [Cluster-devel] [gfs2-utils PATCH 5/7] fsck.gfs2: convert fsck_bitmap_set to a macro Bob Peterson
2016-06-22 19:26 ` [Cluster-devel] [gfs2-utils PATCH 6/7] fsck.gfs2: Speed up function bitmap_type Bob Peterson
2016-06-22 19:26 ` [Cluster-devel] [gfs2-utils PATCH 7/7] fsck.gfs2: Make pass2 go by directory rbtree for performance Bob Peterson
2016-06-27 12:24 ` [Cluster-devel] [gfs2-utils PATCH 0/7] fsck.gfs2 performance improvements Steven Whitehouse

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=cae674dc15e7901b251f10f232206288e8f53979.1466623302.git.rpeterso@redhat.com \
    --to=rpeterso@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).