Gitweb: http://git.fedorahosted.org/git/gfs2-utils.git?p=gfs2-utils.git;a=commitdiff... Commit: d67c1edbb7711f17d7967ff4072ac05bb77b74b9 Parent: b1eca171e483b4b37cd64d78c884649471701467 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:23:27 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 3e34281..d89b137 100644 --- a/gfs2/edit/hexedit.c +++ b/gfs2/edit/hexedit.c @@ -2538,7 +2538,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 45c9cb7..bc1976c 100644 --- a/gfs2/edit/savemeta.c +++ b/gfs2/edit/savemeta.c @@ -135,7 +135,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); @@ -301,6 +301,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 4a6d7e9..4590409 100644 --- a/gfs2/libgfs2/fs_ops.c +++ b/gfs2/libgfs2/fs_ops.c @@ -676,14 +676,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 704bf00..c0a9832 100644 --- a/gfs2/libgfs2/structures.c +++ b/gfs2/libgfs2/structures.c @@ -107,6 +107,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); @@ -207,6 +208,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; @@ -214,16 +217,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); }
@@ -304,8 +309,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 9e9f91a..ed3d07c 100644 --- a/gfs2/mkfs/main_grow.c +++ b/gfs2/mkfs/main_grow.c @@ -208,6 +208,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 306a480..80a718c 100644 --- a/gfs2/mkfs/main_mkfs.c +++ b/gfs2/mkfs/main_mkfs.c @@ -641,6 +641,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