Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=255... Commit: 25541883d8844c4cfcac59346a211c897a84bbb6 Parent: 7471efad8ae060d70803bbf66d21e9a36abdd3a5 Author: Bob Peterson bob@ganesha.peterson AuthorDate: Thu Jan 21 14:26:17 2010 -0600 Committer: Bob Peterson rpeterso@redhat.com CommitterDate: Tue Jan 26 14:39:29 2010 -0600
fsck.gfs2: pass1 should use gfs2_special_add not _set
Since pass1 traverses the file system sequentially by block, it can safely assume blocks it adds to the special_blocks list are not already on it. Therefore, it can safely add those blocks to the list and avoid checking for it already being there. This saves a tiny bit of time, which may seem trivial but when there are a million inodes on the list, the time saved is worth it.
rhbz#455300 --- gfs2/fsck/pass1.c | 4 ++-- gfs2/libgfs2/block_list.c | 11 ++++++++--- gfs2/libgfs2/libgfs2.h | 3 ++- 3 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/gfs2/fsck/pass1.c b/gfs2/fsck/pass1.c index 0070886..ba5206d 100644 --- a/gfs2/fsck/pass1.c +++ b/gfs2/fsck/pass1.c @@ -364,7 +364,7 @@ static int finish_eattr_indir(struct gfs2_inode *ip, int leaf_pointers, (unsigned long long)ip->i_di.di_num.no_addr); /* Mark the inode as having an eattr in the block map so pass1c can check it. */ - gfs2_special_set(&ip->i_sbd->eattr_blocks, ip->i_di.di_num.no_addr); + gfs2_special_add(&ip->i_sbd->eattr_blocks, ip->i_di.di_num.no_addr); if (!leaf_pointer_errors) return 0; log_err( _("Inode %lld (0x%llx) has recoverable indirect " @@ -494,7 +494,7 @@ static int check_eattr_leaf(struct gfs2_inode *ip, uint64_t block, "block(s) attached.\n"), (unsigned long long)ip->i_di.di_num.no_addr, (unsigned long long)ip->i_di.di_num.no_addr); - gfs2_special_set(&sdp->eattr_blocks, ip->i_di.di_num.no_addr); + gfs2_special_add(&sdp->eattr_blocks, ip->i_di.di_num.no_addr); if(gfs2_check_range(sdp, block)) { log_warn( _("Inode #%llu (0x%llx): Extended Attribute leaf " "block #%llu (0x%llx) is out of range.\n"), diff --git a/gfs2/libgfs2/block_list.c b/gfs2/libgfs2/block_list.c index bc8babc..b671a4b 100644 --- a/gfs2/libgfs2/block_list.c +++ b/gfs2/libgfs2/block_list.c @@ -79,12 +79,10 @@ struct special_blocks *blockfind(struct special_blocks *blist, uint64_t num) return NULL; }
-void gfs2_special_set(struct special_blocks *blocklist, uint64_t block) +void gfs2_special_add(struct special_blocks *blocklist, uint64_t block) { struct special_blocks *b;
- if (blockfind(blocklist, block)) - return; b = malloc(sizeof(struct special_blocks)); if (b) { memset(b, 0, sizeof(*b)); @@ -93,6 +91,13 @@ void gfs2_special_set(struct special_blocks *blocklist, uint64_t block) } }
+void gfs2_special_set(struct special_blocks *blocklist, uint64_t block) +{ + if (blockfind(blocklist, block)) + return; + gfs2_special_add(blocklist, block); +} + void gfs2_special_clear(struct special_blocks *blocklist, uint64_t block) { struct special_blocks *b; diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h index 86db414..0452e47 100644 --- a/gfs2/libgfs2/libgfs2.h +++ b/gfs2/libgfs2/libgfs2.h @@ -303,10 +303,11 @@ enum gfs2_mark_block { extern struct gfs2_bmap *gfs2_bmap_create(struct gfs2_sbd *sdp, uint64_t size, uint64_t *addl_mem_needed); extern struct special_blocks *blockfind(struct special_blocks *blist, uint64_t num); +extern void gfs2_special_add(struct special_blocks *blocklist, uint64_t block); extern void gfs2_special_set(struct special_blocks *blocklist, uint64_t block); extern void gfs2_special_free(struct special_blocks *blist); extern int gfs2_blockmap_set(struct gfs2_sbd *sdp, struct gfs2_bmap *il, - uint64_t block, enum gfs2_mark_block mark); + uint64_t block, enum gfs2_mark_block mark); extern void gfs2_special_clear(struct special_blocks *blocklist, uint64_t block); /* gfs2_block_unmark clears ONE mark for the given block */
cluster-commits@lists.stg.fedorahosted.org