Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=024... Commit: 0247047ad88bb1a16d72f5237053ce1fd014b85f Parent: 953b67780ad01166f8d0fc20d57dc8ee65e6d31e Author: Bob Peterson rpeterso@redhat.com AuthorDate: Thu Feb 25 13:18:14 2010 -0600 Committer: Bob Peterson rpeterso@redhat.com CommitterDate: Thu Feb 25 13:19:48 2010 -0600
gfs2: fix regressions from performance fixes
This patch fixes regressions recently introduced by the performance enhancements for fsck.gfs2 and libgfs2.
rhbz#568446 --- gfs2/edit/hexedit.c | 2 +- gfs2/edit/savemeta.c | 3 ++- gfs2/libgfs2/fs_ops.c | 12 ++++-------- gfs2/libgfs2/structures.c | 16 ++++++++++------ gfs2/mkfs/main_grow.c | 2 ++ gfs2/mkfs/main_mkfs.c | 1 + 6 files changed, 20 insertions(+), 16 deletions(-)
diff --git a/gfs2/edit/hexedit.c b/gfs2/edit/hexedit.c index 45dfcc4..109f9c0 100644 --- a/gfs2/edit/hexedit.c +++ b/gfs2/edit/hexedit.c @@ -2536,7 +2536,7 @@ static void process_field(const char *field, uint64_t *newval, int print_field) struct gfs2_rgrp rg;
fblock = blockstack[blockhist % BLOCK_STACK_SIZE].block; - rbh = bread(&sbd, block); + rbh = bread(&sbd, fblock); type = get_block_type(rbh); switch (type) { case GFS2_METATYPE_SB: diff --git a/gfs2/edit/savemeta.c b/gfs2/edit/savemeta.c index 496a7d2..f6d136f 100644 --- a/gfs2/edit/savemeta.c +++ b/gfs2/edit/savemeta.c @@ -133,7 +133,7 @@ static void warm_fuzzy_stuff(uint64_t wfsblock, int force, int save) if (last_fs_block) { printf("\r"); if (save) { - percent = (block * 100) / last_fs_block; + percent = (wfsblock * 100) / last_fs_block; printf("%" PRIu64 " metadata blocks (%" PRIu64 "%%) processed, ", wfsblock, percent); @@ -299,6 +299,7 @@ static void save_indirect_blocks(int out_fd, osi_list_t *cur_list, if (height != hgt) { /* If not at max height */ nbh = bread(&sbd, indir_block); osi_list_add_prev(&nbh->b_altlist, cur_list); + brelse(nbh); } } /* for all data on the indirect block */ } diff --git a/gfs2/libgfs2/fs_ops.c b/gfs2/libgfs2/fs_ops.c index 254c705..7c698ef 100644 --- a/gfs2/libgfs2/fs_ops.c +++ b/gfs2/libgfs2/fs_ops.c @@ -674,14 +674,10 @@ struct gfs2_buffer_head *get_file_buf(struct gfs2_inode *ip, uint64_t lbn, bmodified(ip->i_bh); ip->i_di.di_size = (lbn + 1) << sdp->sd_sb.sb_bsize_shift; } - if (new) - return bget(sdp, dbn); - else { - if (dbn == ip->i_di.di_num.no_addr) - return ip->i_bh; - else - return bread(sdp, dbn); - } + if (dbn == ip->i_di.di_num.no_addr) + return ip->i_bh; + else + return bread(sdp, dbn); }
int gfs2_dirent_first(struct gfs2_inode *dip, struct gfs2_buffer_head *bh, diff --git a/gfs2/libgfs2/structures.c b/gfs2/libgfs2/structures.c index b1dd4ff..37ed8e6 100644 --- a/gfs2/libgfs2/structures.c +++ b/gfs2/libgfs2/structures.c @@ -105,6 +105,7 @@ int write_journal(struct gfs2_sbd *sdp, struct gfs2_inode *ip, unsigned int j, if (!bh) return -1;
+ memset(bh->b_data, 0, sdp->bsize); lh.lh_sequence = seq; lh.lh_blkno = x; gfs2_log_header_out(&lh, bh); @@ -205,6 +206,8 @@ static int build_quota_change(struct gfs2_inode *per_node, unsigned int j) struct gfs2_inode *ip; unsigned int blocks = sdp->qcsize << (20 - sdp->sd_sb.sb_bsize_shift); unsigned int x; + unsigned int hgt; + struct gfs2_buffer_head *bh;
memset(&mh, 0, sizeof(struct gfs2_meta_header)); mh.mh_magic = GFS2_MAGIC; @@ -212,16 +215,18 @@ static int build_quota_change(struct gfs2_inode *per_node, unsigned int j) mh.mh_format = GFS2_FORMAT_QC;
sprintf(name, "quota_change%u", j); - ip = createi(per_node, name, S_IFREG | 0600, - GFS2_DIF_SYSTEM); + ip = createi(per_node, name, S_IFREG | 0600, GFS2_DIF_SYSTEM); + + hgt = calc_tree_height(ip, (blocks + 1) * sdp->bsize); + build_height(ip, hgt);
for (x = 0; x < blocks; x++) { - struct gfs2_buffer_head *bh = get_file_buf(ip, ip->i_di.di_size >> sdp->sd_sb.sb_bsize_shift, FALSE); + bh = get_file_buf(ip, x, FALSE); if (!bh) return -1;
+ memset(bh->b_data, 0, sdp->bsize); gfs2_meta_header_out(&mh, bh); - brelse(bh); }
@@ -302,8 +307,7 @@ int build_rindex(struct gfs2_sbd *sdp) ip->i_di.di_payload_format = GFS2_FORMAT_RI; bmodified(ip->i_bh);
- for (head = &sdp->rglist, tmp = head->next; - tmp != head; + for (head = &sdp->rglist, tmp = head->next; tmp != head; tmp = tmp->next) { rl = osi_list_entry(tmp, struct rgrp_list, list);
diff --git a/gfs2/mkfs/main_grow.c b/gfs2/mkfs/main_grow.c index 4245155..e622b3b 100644 --- a/gfs2/mkfs/main_grow.c +++ b/gfs2/mkfs/main_grow.c @@ -206,6 +206,8 @@ static void fix_rindex(struct gfs2_sbd *sdp, int rindex_fd, int old_rg_count) gfs2_rindex_out(&rl->ri, bufptr); bufptr += sizeof(struct gfs2_rindex); } + gfs2_rgrp_free(&sdp->rglist); + fsync(sdp->device_fd); if (!test) { /* Now write the new RGs to the end of the rindex */ lseek(rindex_fd, 0, SEEK_END); diff --git a/gfs2/mkfs/main_mkfs.c b/gfs2/mkfs/main_mkfs.c index ceff0dc..50e3550 100644 --- a/gfs2/mkfs/main_mkfs.c +++ b/gfs2/mkfs/main_mkfs.c @@ -639,6 +639,7 @@ void main_mkfs(int argc, char *argv[]) inode_put(&sdp->md.inum); inode_put(&sdp->md.statfs);
+ gfs2_rgrp_free(&sdp->rglist); error = fsync(sdp->device_fd); if (error) die( _("can't fsync device (%d): %s\n"),
cluster-commits@lists.stg.fedorahosted.org