gfs2-utils: master - gfs2: remove update_flags everywhere
Bob Peterson
rpeterso at fedoraproject.org
Tue Jan 26 21:08:36 UTC 2010
Gitweb: http://git.fedorahosted.org/git/gfs2-utils.git?p=gfs2-utils.git;a=commitdiff;h=214e9cc0c2d37eced8ee9c58f4fd3334969d43b4
Commit: 214e9cc0c2d37eced8ee9c58f4fd3334969d43b4
Parent: 7bdb3e896076f544aa570df3c053f0cea6a7c8ae
Author: Bob Peterson <bob at ganesha.peterson>
AuthorDate: Mon Nov 30 15:16:07 2009 -0600
Committer: Bob Peterson <rpeterso at redhat.com>
CommitterDate: Tue Jan 26 15:09:40 2010 -0600
gfs2: remove update_flags everywhere
This patch removes the update_flags from all the gfs2-utils code.
This help to untangle the buffer_head mess and helps solve
issues where file systems were being updated even when no errors
are found.
rhbz#455300
---
gfs2/convert/gfs2_convert.c | 47 ++++++++------
gfs2/edit/gfs2hex.c | 2 +-
gfs2/edit/hexedit.c | 47 +++++++------
gfs2/edit/savemeta.c | 18 +++---
gfs2/fsck/eattr.c | 10 +--
gfs2/fsck/eattr.h | 9 +--
gfs2/fsck/fs_recovery.c | 56 +++++++++-------
gfs2/fsck/fsck.h | 2 +-
gfs2/fsck/main.c | 22 +++----
gfs2/fsck/metawalk.c | 152 ++++++++++++++++---------------------------
gfs2/fsck/metawalk.h | 19 ++----
gfs2/fsck/pass1.c | 129 +++++++++++++++++--------------------
gfs2/fsck/pass1b.c | 37 ++++-------
gfs2/fsck/pass1c.c | 34 ++++------
gfs2/fsck/pass2.c | 95 ++++++++++++---------------
gfs2/fsck/pass3.c | 23 ++++---
gfs2/fsck/pass4.c | 25 ++++----
gfs2/fsck/pass5.c | 16 ++---
gfs2/fsck/rgrepair.c | 16 ++--
gfs2/libgfs2/buf.c | 9 ++-
gfs2/libgfs2/fs_bits.c | 8 +-
gfs2/libgfs2/fs_geometry.c | 3 +-
gfs2/libgfs2/fs_ops.c | 117 ++++++++++++++++++++-------------
gfs2/libgfs2/gfs1.c | 11 +--
gfs2/libgfs2/libgfs2.h | 26 ++------
gfs2/libgfs2/recovery.c | 10 ++--
gfs2/libgfs2/rgrp.c | 7 +-
gfs2/libgfs2/structures.c | 47 +++++++++-----
gfs2/libgfs2/super.c | 10 +--
gfs2/mkfs/main_grow.c | 4 +-
gfs2/mkfs/main_mkfs.c | 12 ++-
31 files changed, 488 insertions(+), 535 deletions(-)
diff --git a/gfs2/convert/gfs2_convert.c b/gfs2/convert/gfs2_convert.c
index 5af01c4..a7e211e 100644
--- a/gfs2/convert/gfs2_convert.c
+++ b/gfs2/convert/gfs2_convert.c
@@ -337,7 +337,7 @@ static void fix_metatree(struct gfs2_sbd *sbp, struct gfs2_inode *ip,
/* First, build up the metatree */
for (h = 0; h < blk->height; h++) {
lookup_block(ip, bh, h, &blk->mp, 1, &new, &block);
- brelse(bh, updated);
+ brelse(bh);
if (!block)
break;
@@ -355,7 +355,8 @@ static void fix_metatree(struct gfs2_sbd *sbp, struct gfs2_inode *ip,
memcpy(bh->b_data + hdrsize + ptramt,
(char *)srcptr, amount);
srcptr += amount;
- brelse(bh, updated);
+ bmodified(bh);
+ brelse(bh);
copied += amount;
@@ -518,7 +519,8 @@ static int adjust_indirect_blocks(struct gfs2_sbd *sbp, struct gfs2_buffer_head
/* Zero the buffer so we can fill it in later */
memset(bh->b_data + sizeof(struct gfs_indirect), 0,
bufsize);
- brelse(bh, updated);
+ bmodified(bh);
+ brelse(bh);
/* Free the metadata block so we can reuse it.
This allows us to convert a "full" file system. */
ip->i_di.di_blocks--;
@@ -780,12 +782,13 @@ static int inode_renumber(struct gfs2_sbd *sbp, uint64_t root_inode_addr)
break;
}
bitmap_byte -= (sbp->bsize - buf_offset);
+ bmodified(bh);
}
}
- brelse(bh, updated);
+ brelse(bh);
first = 0;
} /* while 1 */
- gfs2_rgrp_relse(rgd, updated, rgbh);
+ gfs2_rgrp_relse(rgd, rgbh);
free(rgbh);
} /* for all rgs */
log_notice("\r%" PRIu64" inodes from %d rgs converted.",
@@ -807,7 +810,8 @@ static int fetch_inum(struct gfs2_sbd *sbp, uint64_t iblock,
fix_inode = inode_get(sbp, bh_fix);
inum->no_formal_ino = fix_inode->i_di.di_num.no_formal_ino;
inum->no_addr = fix_inode->i_di.di_num.no_addr;
- brelse(bh_fix, updated);
+ bmodified(bh_fix);
+ brelse(bh_fix);
return 0;
}/* fetch_inum */
@@ -946,7 +950,8 @@ static int fix_one_directory_exhash(struct gfs2_sbd *sbp, struct gfs2_inode *dip
}
gfs2_leaf_in(&leaf, (char *)bh_leaf->b_data); /* buffer to structure */
error = process_dirent_info(dip, sbp, bh_leaf, leaf.lf_entries);
- brelse(bh_leaf, updated);
+ bmodified(bh_leaf);
+ brelse(bh_leaf);
} /* for leaf_num */
return 0;
}/* fix_one_directory_exhash */
@@ -989,18 +994,21 @@ static int fix_directory_info(struct gfs2_sbd *sbp, osi_list_t *dir_to_fix)
if (dip->i_di.di_flags & GFS2_DIF_EXHASH) {
if (fix_one_directory_exhash(sbp, dip)) {
log_crit("Error fixing exhash directory.\n");
- brelse(bh_dir, updated);
+ bmodified(bh_dir);
+ brelse(bh_dir);
return -1;
}
}
else {
if (process_dirent_info(dip, sbp, bh_dir, dip->i_di.di_entries)) {
log_crit("Error fixing linear directory.\n");
- brelse(bh_dir, updated);
+ bmodified(bh_dir);
+ brelse(bh_dir);
return -1;
}
}
- brelse(bh_dir, updated);
+ bmodified(bh_dir);
+ brelse(bh_dir);
}
/* Free the last entry in memory: */
if (tmp) {
@@ -1128,7 +1136,7 @@ static int init(struct gfs2_sbd *sbp)
sbp->sd_diptrs = (sbp->bsize - sizeof(struct gfs_dinode)) /
sizeof(uint64_t);
sbp->sd_jbsize = sbp->bsize - sizeof(struct gfs2_meta_header);
- brelse(bh, not_updated);
+ brelse(bh);
if (compute_heightsize(sbp, sbp->sd_heightsize, &sbp->sd_max_height,
sbp->bsize, sbp->sd_diptrs, sbp->sd_inptrs)) {
log_crit("Error: Bad constants (1)\n");
@@ -1195,8 +1203,8 @@ static int init(struct gfs2_sbd *sbp)
}
printf("\n");
fflush(stdout);
- inode_put(sbp->md.riinode, updated);
- inode_put(sbp->md.jiinode, updated);
+ inode_put(sbp->md.riinode);
+ inode_put(sbp->md.jiinode);
log_debug("%d rgs found.\n", rgcount);
return 0;
}/* fill_super_block */
@@ -1510,7 +1518,7 @@ static void conv_build_jindex(struct gfs2_sbd *sdp)
ip = createi(jindex, name, S_IFREG | 0600, GFS2_DIF_SYSTEM);
write_journal(sdp, ip, j,
sdp->jsize << 20 >> sdp->sd_sb.sb_bsize_shift);
- inode_put(ip, updated);
+ inode_put(ip);
printf("done.\n");
fflush(stdout);
}
@@ -1520,7 +1528,7 @@ static void conv_build_jindex(struct gfs2_sbd *sdp)
gfs2_dinode_print(&jindex->i_di);
}
- inode_put(jindex, updated);
+ inode_put(jindex);
}
/* ------------------------------------------------------------------------- */
@@ -1625,9 +1633,9 @@ int main(int argc, char **argv)
update_inode_file(&sb2);
write_statfs_file(&sb2);
- inode_put(sb2.master_dir, updated);
- inode_put(sb2.md.inum, updated);
- inode_put(sb2.md.statfs, updated);
+ inode_put(sb2.master_dir);
+ inode_put(sb2.md.inum);
+ inode_put(sb2.md.statfs);
bcommit(&sb2.buf_list); /* write the buffers to disk */
@@ -1645,7 +1653,8 @@ int main(int argc, char **argv)
sb2.sd_sb.sb_fs_format = GFS2_FORMAT_FS;
sb2.sd_sb.sb_multihost_format = GFS2_FORMAT_MULTI;
gfs2_sb_out(&sb2.sd_sb, bh->b_data);
- brelse(bh, updated);
+ bmodified(bh);
+ brelse(bh);
bsync(&sb2.buf_list); /* write the buffers to disk */
error = fsync(sb2.device_fd);
diff --git a/gfs2/edit/gfs2hex.c b/gfs2/edit/gfs2hex.c
index 3bc1294..b557b7e 100644
--- a/gfs2/edit/gfs2hex.c
+++ b/gfs2/edit/gfs2hex.c
@@ -349,7 +349,7 @@ void do_dinode_extended(struct gfs2_dinode *dine, char *dinebuf)
if (skip <= 0)
break;
}
- brelse(tmp_bh, not_updated);
+ brelse(tmp_bh);
indirect->ii[indirect_blocks].block = last;
indirect_blocks++;
last = p;
diff --git a/gfs2/edit/hexedit.c b/gfs2/edit/hexedit.c
index 1e75889..13917fd 100644
--- a/gfs2/edit/hexedit.c
+++ b/gfs2/edit/hexedit.c
@@ -784,7 +784,7 @@ static void rgcount(void)
{
printf("%lld RGs in this file system.\n",
(unsigned long long)sbd.md.riinode->i_di.di_size / risize());
- inode_put(sbd.md.riinode, not_updated);
+ inode_put(sbd.md.riinode);
gfs2_rgrp_free(&sbd.rglist);
exit(EXIT_SUCCESS);
}
@@ -883,7 +883,7 @@ static uint64_t get_rg_addr(int rgnum)
else
fprintf(stderr, "Error: File system only has %lld RGs.\n",
(unsigned long long)riinode->i_di.di_size / risize());
- inode_put(riinode, not_updated);
+ inode_put(riinode);
return rgblk;
}
@@ -918,7 +918,8 @@ static void set_rgrp_flags(int rgnum, uint32_t new_flags, int modify, int full)
gfs_rgrp_out(&rg.rg1, bh->b_data);
else
gfs2_rgrp_out(&rg.rg2, bh->b_data);
- brelse(bh, updated);
+ bmodified(bh);
+ brelse(bh);
} else {
if (full) {
print_gfs2("RG #%d", rgnum);
@@ -933,7 +934,7 @@ static void set_rgrp_flags(int rgnum, uint32_t new_flags, int modify, int full)
printf("RG #%d (block %llu / 0x%llx) rg_flags = 0x%08x\n",
rgnum, (unsigned long long)rgblk,
(unsigned long long)rgblk, rg.rg2.rg_flags);
- brelse(bh, not_updated);
+ brelse(bh);
}
if (modify)
bsync(&sbd.buf_list);
@@ -998,7 +999,7 @@ static int parse_rindex(struct gfs2_inode *dip, int print_rindex)
gfs2_rgrp_in(&rg, tmp_bh->b_data);
gfs2_rgrp_print(&rg);
}
- brelse(tmp_bh, not_updated);
+ brelse(tmp_bh);
}
last_entry_onscreen[dmode] = print_entry_ndx;
}
@@ -1604,7 +1605,7 @@ int block_is_in_per_node(void)
gfs2_dinode_in(&per_node_di, per_node_bh->b_data);
do_dinode_extended(&per_node_di, per_node_bh->b_data);
- brelse(per_node_bh, not_updated);
+ brelse(per_node_bh);
for (d = 0; d < indirect->ii[0].dirents; d++) {
if (block == indirect->ii[0].dirent[d].block)
@@ -1642,7 +1643,7 @@ static int display_extended(void)
tmp_bh = bread(&sbd.buf_list, block);
tmp_inode = inode_get(&sbd, tmp_bh);
parse_rindex(tmp_inode, TRUE);
- brelse(tmp_bh, not_updated);
+ brelse(tmp_bh);
}
else if (has_indirect_blocks() && !indirect_blocks &&
!display_leaf(indirect))
@@ -1657,31 +1658,31 @@ static int display_extended(void)
tmp_bh = bread(&sbd.buf_list, masterblock("rindex"));
tmp_inode = inode_get(&sbd, tmp_bh);
parse_rindex(tmp_inode, FALSE);
- brelse(tmp_bh, not_updated);
+ brelse(tmp_bh);
}
else if (block_is_jindex()) {
tmp_bh = bread(&sbd.buf_list, block);
tmp_inode = inode_get(&sbd, tmp_bh);
print_jindex(tmp_inode);
- brelse(tmp_bh, not_updated);
+ brelse(tmp_bh);
}
else if (block_is_inum_file()) {
tmp_bh = bread(&sbd.buf_list, block);
tmp_inode = inode_get(&sbd, tmp_bh);
print_inum(tmp_inode);
- brelse(tmp_bh, not_updated);
+ brelse(tmp_bh);
}
else if (block_is_statfs_file()) {
tmp_bh = bread(&sbd.buf_list, block);
tmp_inode = inode_get(&sbd, tmp_bh);
print_statfs(tmp_inode);
- brelse(tmp_bh, not_updated);
+ brelse(tmp_bh);
}
else if (block_is_quota_file()) {
tmp_bh = bread(&sbd.buf_list, block);
tmp_inode = inode_get(&sbd, tmp_bh);
print_quota(tmp_inode);
- brelse(tmp_bh, not_updated);
+ brelse(tmp_bh);
}
return 0;
}
@@ -1970,7 +1971,7 @@ static uint64_t find_journal_block(const char *journal, uint64_t *j_size)
if (!gfs1)
do_dinode_extended(&di, jindex_bh->b_data); /* parse dir. */
- brelse(jindex_bh, not_updated);
+ brelse(jindex_bh);
if (gfs1) {
struct gfs2_inode *jiinode;
@@ -1993,7 +1994,7 @@ static uint64_t find_journal_block(const char *journal, uint64_t *j_size)
j_inode = inode_get(&sbd, j_bh);
gfs2_dinode_in(&jdi, j_bh->b_data);/* parse dinode to struct */
*j_size = jdi.di_size;
- brelse(j_bh, not_updated);
+ brelse(j_bh);
}
return jblock;
}
@@ -2019,10 +2020,10 @@ static uint64_t find_metablockoftype_slow(uint64_t startblk, int metatype, int p
bh->b_data[4] == 0x00 && bh->b_data[5] == 0x00 &&
bh->b_data[6] == 0x00 && bh->b_data[7] == metatype) {
found = 1;
- brelse(bh, not_updated);
+ brelse(bh);
break;
}
- brelse(bh, not_updated);
+ brelse(bh);
}
if (!found)
blk = 0;
@@ -2439,7 +2440,7 @@ static void find_print_block_type(void)
bh = bread(&sbd.buf_list, tblock);
type = get_block_type(bh->b_data);
print_block_type(tblock, type, "");
- brelse(bh, NOT_UPDATED);
+ brelse(bh);
gfs2_rgrp_free(&sbd.rglist);
exit(0);
}
@@ -2597,7 +2598,9 @@ static void process_field(const char *field, uint64_t *newval, int print_field)
" which is not implemented");
break;
}
- brelse(bh, newval ? UPDATED : NOT_UPDATED);
+ if (newval)
+ bmodified(bh);
+ brelse(bh);
bcommit(&sbd.buf_list);
}
@@ -2977,7 +2980,7 @@ static int fsck_readi(struct gfs2_inode *ip, void *rbuf, uint64_t roffset,
amount = sdp->bsize - o;
if (!extlen)
block_map(ip, lblock, ¬_new, &dblock, &extlen,
- FALSE, not_updated);
+ FALSE);
if (dblock) {
bh = bread(&sdp->buf_list, dblock);
if (*abs_block == 0)
@@ -2988,7 +2991,7 @@ static int fsck_readi(struct gfs2_inode *ip, void *rbuf, uint64_t roffset,
bh = NULL;
if (bh) {
memcpy(rbuf, bh->b_data + o, amount);
- brelse(bh, not_updated);
+ brelse(bh);
} else {
memset(rbuf, 0, amount);
}
@@ -3044,7 +3047,7 @@ static void dump_journal(const char *journal)
for (jb = 0; jb < j_size; jb += (gfs1 ? 1:sbd.bsize)) {
if (gfs1) {
if (j_bh)
- brelse(j_bh, not_updated);
+ brelse(j_bh);
j_bh = bread(&sbd.buf_list, jblock + jb);
abs_block = jblock + jb;
memcpy(jbuf, j_bh->b_data, sbd.bsize);
@@ -3135,7 +3138,7 @@ static void dump_journal(const char *journal)
start_line);
}
}
- brelse(j_bh, not_updated);
+ brelse(j_bh);
blockhist = -1; /* So we don't print anything else */
}
diff --git a/gfs2/edit/savemeta.c b/gfs2/edit/savemeta.c
index 17b6a6c..0def846 100644
--- a/gfs2/edit/savemeta.c
+++ b/gfs2/edit/savemeta.c
@@ -309,13 +309,13 @@ static void save_indirect_blocks(int out_fd, osi_list_t *cur_list,
if (blktype == GFS2_METATYPE_EA) {
nbh = bread(&sbd.buf_list, indir_block);
save_ea_block(out_fd, nbh);
- brelse(nbh, not_updated);
+ brelse(nbh);
}
if (height != hgt) { /* If not at max height */
nbh = bread(&sbd.buf_list, indir_block);
osi_list_add_prev(&nbh->b_altlist,
cur_list);
- brelse(nbh, not_updated);
+ brelse(nbh);
}
} /* for all data on the indirect block */
}
@@ -418,9 +418,9 @@ static void save_inode_data(int out_fd)
(unsigned long long)block,
(unsigned long long)block);
}
- brelse(metabh, not_updated);
+ brelse(metabh);
}
- inode_put(inode, not_updated);
+ inode_put(inode);
}
static void get_journal_inode_blocks(void)
@@ -454,7 +454,7 @@ static void get_journal_inode_blocks(void)
amt = gfs2_readi(j_inode, (void *)&jbuf,
journal * sizeof(struct gfs_jindex),
sizeof(struct gfs_jindex));
- brelse(bh, not_updated);
+ brelse(bh);
if (!amt)
break;
gfs_jindex_in(&ji, jbuf);
@@ -467,7 +467,7 @@ static void get_journal_inode_blocks(void)
bh = bread(&sbd.buf_list, jblock);
j_inode = inode_get(&sbd, bh);
gfs2_dinode_in(&jdi, bh->b_data);
- inode_put(j_inode, not_updated);
+ inode_put(j_inode);
}
journal_blocks[journals_found++] = jblock;
}
@@ -499,7 +499,7 @@ static int next_rg_freemeta(struct gfs2_sbd *sdp, struct rgrp_list *rgd,
blk = gfs2_bitfit((unsigned char *)bh->b_data +
bits->bi_offset, bits->bi_len, blk,
GFS2_BLKST_UNLINKED);
- brelse(bh, not_updated);
+ brelse(bh);
if(blk != BFITNOENT){
*nrfblock = blk + (bits->bi_start * GFS2_NBBY) +
rgd->ri.ri_data0;
@@ -609,7 +609,7 @@ void savemeta(char *out_fn, int saveoption)
gfs2_dinode_in(&di, bh->b_data);
if (!gfs1)
do_dinode_extended(&di, bh->b_data);
- brelse(bh, not_updated);
+ brelse(bh);
}
if (!slow) {
printf("Reading resource groups...");
@@ -708,7 +708,7 @@ void savemeta(char *out_fn, int saveoption)
first = 0;
}
}
- gfs2_rgrp_relse(rgd, not_updated, rgbh);
+ gfs2_rgrp_relse(rgd, rgbh);
free(rgbh);
}
}
diff --git a/gfs2/fsck/eattr.c b/gfs2/fsck/eattr.c
index 23c12d2..eaa0b55 100644
--- a/gfs2/fsck/eattr.c
+++ b/gfs2/fsck/eattr.c
@@ -31,17 +31,15 @@ static int clear_blk_nodup(struct gfs2_sbd *sbp, uint64_t block)
int clear_eattr_indir(struct gfs2_inode *ip, uint64_t block,
uint64_t parent, struct gfs2_buffer_head **bh,
- enum update_flags *want_updated, void *private)
+ void *private)
{
- *want_updated = not_updated;
return clear_blk_nodup(ip->i_sbd, block);
}
int clear_eattr_leaf(struct gfs2_inode *ip, uint64_t block,
uint64_t parent, struct gfs2_buffer_head **bh,
- enum update_flags *want_updated, void *private)
+ void *private)
{
- *want_updated = not_updated;
return clear_blk_nodup(ip->i_sbd, block);
}
@@ -93,12 +91,10 @@ int clear_eattr_entry (struct gfs2_inode *ip,
int clear_eattr_extentry(struct gfs2_inode *ip, uint64_t *ea_data_ptr,
struct gfs2_buffer_head *leaf_bh,
struct gfs2_ea_header *ea_hdr,
- struct gfs2_ea_header *ea_hdr_prev,
- enum update_flags *want_updated, void *private)
+ struct gfs2_ea_header *ea_hdr_prev, void *private)
{
uint64_t block = be64_to_cpu(*ea_data_ptr);
- *want_updated = not_updated;
return clear_blk_nodup(ip->i_sbd, block);
}
diff --git a/gfs2/fsck/eattr.h b/gfs2/fsck/eattr.h
index b93b50b..f4264b0 100644
--- a/gfs2/fsck/eattr.h
+++ b/gfs2/fsck/eattr.h
@@ -2,11 +2,9 @@
#define _EATTR_H
int clear_eattr_indir(struct gfs2_inode *ip, uint64_t block, uint64_t parent,
- struct gfs2_buffer_head **bh,
- enum update_flags *want_updated, void *private);
+ struct gfs2_buffer_head **bh, void *private);
int clear_eattr_leaf(struct gfs2_inode *ip, uint64_t block, uint64_t parent,
- struct gfs2_buffer_head **bh,
- enum update_flags *want_updated, void *private);
+ struct gfs2_buffer_head **bh, void *private);
int clear_eattr_entry (struct gfs2_inode *ip,
struct gfs2_buffer_head *leaf_bh,
struct gfs2_ea_header *ea_hdr,
@@ -15,7 +13,6 @@ int clear_eattr_entry (struct gfs2_inode *ip,
int clear_eattr_extentry(struct gfs2_inode *ip, uint64_t *ea_data_ptr,
struct gfs2_buffer_head *leaf_bh,
struct gfs2_ea_header *ea_hdr,
- struct gfs2_ea_header *ea_hdr_prev,
- enum update_flags *want_updated, void *private);
+ struct gfs2_ea_header *ea_hdr_prev, void *private);
#endif /* _EATTR_H */
diff --git a/gfs2/fsck/fs_recovery.c b/gfs2/fsck/fs_recovery.c
index 6944f68..59a8443 100644
--- a/gfs2/fsck/fs_recovery.c
+++ b/gfs2/fsck/fs_recovery.c
@@ -100,7 +100,6 @@ static int buf_lo_scan_elements(struct gfs2_inode *ip, unsigned int start,
struct gfs2_buffer_head *bh_log, *bh_ip;
uint64_t blkno;
int error = 0;
- enum update_flags if_modified;
if (pass != 1 || be32_to_cpu(ld->ld_type) != GFS2_LOG_DESC_METADATA)
return 0;
@@ -127,14 +126,13 @@ static int buf_lo_scan_elements(struct gfs2_inode *ip, unsigned int start,
check_magic = ((struct gfs2_meta_header *)
(bh_ip->b_data))->mh_magic;
check_magic = be32_to_cpu(check_magic);
- if (check_magic != GFS2_MAGIC) {
- if_modified = not_updated;
+ if (check_magic != GFS2_MAGIC)
error = -EIO;
- } else
- if_modified = updated;
+ else
+ bmodified(bh_ip);
- brelse(bh_log, not_updated);
- brelse(bh_ip, if_modified);
+ brelse(bh_log);
+ brelse(bh_ip);
if (error)
break;
@@ -183,7 +181,8 @@ static int revoke_lo_scan_elements(struct gfs2_inode *ip, unsigned int start,
offset += sizeof(uint64_t);
}
- brelse(bh, updated);
+ bmodified(bh);
+ brelse(bh);
offset = sizeof(struct gfs2_meta_header);
first = 0;
}
@@ -229,8 +228,9 @@ static int databuf_lo_scan_elements(struct gfs2_inode *ip, unsigned int start,
*eptr = cpu_to_be32(GFS2_MAGIC);
}
- brelse(bh_log, not_updated);
- brelse(bh_ip, updated);
+ brelse(bh_log);
+ bmodified(bh_ip);
+ brelse(bh_ip);
sd_replayed_jblocks++;
}
@@ -271,7 +271,8 @@ static int foreach_descriptor(struct gfs2_inode *ip, unsigned int start,
(bh->b_data))->mh_magic;
check_magic = be32_to_cpu(check_magic);
if (check_magic != GFS2_MAGIC) {
- brelse(bh, updated);
+ bmodified(bh);
+ brelse(bh);
return -EIO;
}
ld = (struct gfs2_log_descriptor *)bh->b_data;
@@ -283,38 +284,45 @@ static int foreach_descriptor(struct gfs2_inode *ip, unsigned int start,
error = get_log_header(ip, start, &lh);
if (!error) {
gfs2_replay_incr_blk(ip, &start);
- brelse(bh, updated);
+ bmodified(bh);
+ brelse(bh);
continue;
}
if (error == 1)
error = -EIO;
- brelse(bh, updated);
+ bmodified(bh);
+ brelse(bh);
return error;
} else if (gfs2_check_meta(bh, GFS2_METATYPE_LD)) {
- brelse(bh, updated);
+ bmodified(bh);
+ brelse(bh);
return -EIO;
}
ptr = (__be64 *)(bh->b_data + offset);
error = databuf_lo_scan_elements(ip, start, ld, ptr, pass);
if (error) {
- brelse(bh, updated);
+ bmodified(bh);
+ brelse(bh);
return error;
}
error = buf_lo_scan_elements(ip, start, ld, ptr, pass);
if (error) {
- brelse(bh, updated);
+ bmodified(bh);
+ brelse(bh);
return error;
}
error = revoke_lo_scan_elements(ip, start, ld, ptr, pass);
if (error) {
- brelse(bh, updated);
+ bmodified(bh);
+ brelse(bh);
return error;
}
while (length--)
gfs2_replay_incr_blk(ip, &start);
- brelse(bh, updated);
+ bmodified(bh);
+ brelse(bh);
}
return 0;
@@ -365,10 +373,11 @@ static int fix_journal_seq_no(struct gfs2_inode *ip)
lh.lh_sequence = highest_seq;
prev_seq = lh.lh_sequence;
log_warn( _("Renumbering it as 0x%llx\n"), lh.lh_sequence);
- block_map(ip, blk, &new, &dblock, &extlen, FALSE, not_updated);
+ block_map(ip, blk, &new, &dblock, &extlen, FALSE);
bh = bread(&ip->i_sbd->buf_list, dblock);
gfs2_log_header_out(&lh, bh->b_data);
- brelse(bh, updated);
+ bmodified(bh);
+ brelse(bh);
}
return 0;
}
@@ -571,11 +580,10 @@ int replay_journals(struct gfs2_sbd *sdp, int preen, int force_check,
}
*clean_journals += clean;
}
- inode_put(sdp->md.journal[i],
- (opts.no ? not_updated : updated));
+ inode_put(sdp->md.journal[i]);
}
- inode_put(sdp->master_dir, not_updated);
- inode_put(sdp->md.jiinode, not_updated);
+ inode_put(sdp->master_dir);
+ inode_put(sdp->md.jiinode);
/* Sync the buffers to disk so we get a fresh start. */
bsync(&sdp->buf_list);
return error;
diff --git a/gfs2/fsck/fsck.h b/gfs2/fsck/fsck.h
index dae785c..9c9a3fe 100644
--- a/gfs2/fsck/fsck.h
+++ b/gfs2/fsck/fsck.h
@@ -62,7 +62,7 @@ enum rgindex_trust_level { /* how far can we trust our RG index? */
struct gfs2_inode *fsck_load_inode(struct gfs2_sbd *sbp, uint64_t block);
struct gfs2_inode *fsck_inode_get(struct gfs2_sbd *sdp,
struct gfs2_buffer_head *bh);
-void fsck_inode_put(struct gfs2_inode *ip, enum update_flags update);
+void fsck_inode_put(struct gfs2_inode *ip);
int initialize(struct gfs2_sbd *sbp, int force_check, int preen,
int *all_clean);
diff --git a/gfs2/fsck/main.c b/gfs2/fsck/main.c
index 450bbb3..b630f7c 100644
--- a/gfs2/fsck/main.c
+++ b/gfs2/fsck/main.c
@@ -330,7 +330,6 @@ int main(int argc, char **argv)
struct gfs2_sbd sb;
struct gfs2_sbd *sbp = &sb;
int j;
- enum update_flags update_sys_files;
int error = 0;
int all_clean = 0;
@@ -449,23 +448,22 @@ int main(int argc, char **argv)
} else {
error = FSCK_CANCELED;
}
- update_sys_files = (opts.no ? not_updated : updated);
check_statfs(sbp);
/* Free up our system inodes */
- inode_put(sbp->md.inum, update_sys_files);
- inode_put(sbp->md.statfs, update_sys_files);
+ inode_put(sbp->md.inum);
+ inode_put(sbp->md.statfs);
for (j = 0; j < sbp->md.journals; j++)
- inode_put(sbp->md.journal[j], update_sys_files);
- inode_put(sbp->md.jiinode, update_sys_files);
- inode_put(sbp->md.riinode, update_sys_files);
- inode_put(sbp->md.qinode, update_sys_files);
- inode_put(sbp->md.pinode, update_sys_files);
- inode_put(sbp->md.rooti, update_sys_files);
- inode_put(sbp->master_dir, update_sys_files);
+ inode_put(sbp->md.journal[j]);
+ inode_put(sbp->md.jiinode);
+ inode_put(sbp->md.riinode);
+ inode_put(sbp->md.qinode);
+ inode_put(sbp->md.pinode);
+ inode_put(sbp->md.rooti);
+ inode_put(sbp->master_dir);
if (lf_dip)
- inode_put(lf_dip, update_sys_files);
+ inode_put(lf_dip);
if (!opts.no && errors_corrected)
log_notice( _("Writing changes to disk\n"));
diff --git a/gfs2/fsck/metawalk.c b/gfs2/fsck/metawalk.c
index 6b6a7bb..833424c 100644
--- a/gfs2/fsck/metawalk.c
+++ b/gfs2/fsck/metawalk.c
@@ -85,17 +85,17 @@ struct gfs2_inode *fsck_inode_get(struct gfs2_sbd *sdp,
/* fsck_inode_put - same as inode_put() in libgfs2 but system inodes
get special treatment. */
-void fsck_inode_put(struct gfs2_inode *ip, enum update_flags update)
+void fsck_inode_put(struct gfs2_inode *ip)
{
struct gfs2_inode *sysip;
sysip = get_system_inode(ip->i_sbd, ip->i_di.di_num.no_addr);
if (sysip) {
- if (update)
+ if (ip->i_bh->b_changed)
gfs2_dinode_out(&ip->i_di, ip->i_bh->b_data);
- brelse(ip->i_bh, update);
+ brelse(ip->i_bh);
} else {
- inode_put(ip, update);
+ inode_put(ip);
}
}
@@ -165,6 +165,7 @@ static void dirblk_truncate(struct gfs2_inode *ip, struct gfs2_dirent *fixb,
old_rec_len = de.de_rec_len;
de.de_rec_len = bh_end - (char *)fixb;
gfs2_dirent_out(&de, (char *)fixb);
+ bmodified(bh);
}
/*
@@ -173,7 +174,6 @@ static void dirblk_truncate(struct gfs2_inode *ip, struct gfs2_dirent *fixb,
* @ip - dinode associated with this leaf block
* bh - buffer for the leaf block
* type - type of block this is (linear or exhash)
- * @update - set to 1 if the block was updated
* @count - set to the count entries
* @pass - structure pointing to pass-specific functions
*
@@ -181,8 +181,7 @@ static void dirblk_truncate(struct gfs2_inode *ip, struct gfs2_dirent *fixb,
* -1 - error occurred
*/
static int check_entries(struct gfs2_inode *ip, struct gfs2_buffer_head *bh,
- int type, enum update_flags *update,
- uint16_t *count, struct metawalk_fxns *pass)
+ int type, uint16_t *count, struct metawalk_fxns *pass)
{
struct gfs2_leaf *leaf = NULL;
struct gfs2_dirent *dent;
@@ -238,7 +237,6 @@ static int check_entries(struct gfs2_inode *ip, struct gfs2_buffer_head *bh,
dirblk_truncate(ip, dent, bh);
else
dirblk_truncate(ip, prev, bh);
- *update = updated;
log_err( _("Unable to repair corrupt "
"directory entry; the "
"entry was removed "
@@ -248,7 +246,7 @@ static int check_entries(struct gfs2_inode *ip, struct gfs2_buffer_head *bh,
log_err( _("Corrupt directory entry "
"repaired.\n"));
errors_corrected++;
- *update = updated;
+ bmodified(bh);
/* keep looping through dentries */
}
} else {
@@ -274,7 +272,6 @@ static int check_entries(struct gfs2_inode *ip, struct gfs2_buffer_head *bh,
if (query(&opts,
_("Attempt to remove it? (y/n) "))) {
dirblk_truncate(ip, prev, bh);
- *update = 1;
log_err(_("The corrupt directory "
"entry was removed.\n"));
} else {
@@ -292,14 +289,13 @@ static int check_entries(struct gfs2_inode *ip, struct gfs2_buffer_head *bh,
de.de_inum.no_addr = de.de_inum.no_formal_ino;
de.de_inum.no_formal_ino = 0;
gfs2_dirent_out(&de, (char *)dent);
- *update = (opts.no ? not_updated : updated);
+ bmodified(bh);
/* Mark dirent buffer as modified */
first = 0;
}
else {
error = pass->check_dentry(ip, dent, prev, bh,
- filename, update,
- count,
+ filename, count,
pass->private);
if(error < 0) {
stack;
@@ -359,8 +355,7 @@ static void warn_and_patch(struct gfs2_inode *ip, uint64_t *leaf_no,
}
/* Checks exhash directory entries */
-static int check_leaf_blks(struct gfs2_inode *ip, enum update_flags *update,
- struct metawalk_fxns *pass)
+static int check_leaf_blks(struct gfs2_inode *ip, struct metawalk_fxns *pass)
{
int error;
struct gfs2_leaf leaf, oldleaf;
@@ -384,10 +379,10 @@ static int check_leaf_blks(struct gfs2_inode *ip, enum update_flags *update,
lbh = bread(&sbp->buf_list, first_ok_leaf);
/* Make sure it's really a valid leaf block. */
if (gfs2_check_meta(lbh, GFS2_METATYPE_LF) == 0) {
- brelse(lbh, not_updated);
+ brelse(lbh);
break;
}
- brelse(lbh, not_updated);
+ brelse(lbh);
}
}
old_leaf = -1;
@@ -435,7 +430,8 @@ static int check_leaf_blks(struct gfs2_inode *ip, enum update_flags *update,
gfs2_leaf_in(&oldleaf, lbh->b_data);
oldleaf.lf_depth = ip->i_di.di_depth - factor;
gfs2_leaf_out(&oldleaf, lbh->b_data);
- brelse(lbh, updated);
+ bmodified(lbh);
+ brelse(lbh);
}
else
return 1;
@@ -463,7 +459,6 @@ static int check_leaf_blks(struct gfs2_inode *ip, enum update_flags *update,
break;
}
- *update = not_updated;
/* Try to read in the leaf block. */
lbh = bread(&sbp->buf_list, leaf_no);
/* Make sure it's really a valid leaf block. */
@@ -472,7 +467,8 @@ static int check_leaf_blks(struct gfs2_inode *ip, enum update_flags *update,
old_leaf, first_ok_leaf, lindex,
_("that is not really a leaf"));
memcpy(&leaf, &oldleaf, sizeof(oldleaf));
- brelse(lbh, not_updated);
+ bmodified(lbh);
+ brelse(lbh);
break;
}
gfs2_leaf_in(&leaf, lbh->b_data);
@@ -493,7 +489,7 @@ static int check_leaf_blks(struct gfs2_inode *ip, enum update_flags *update,
leaf.lf_dirent_format = GFS2_FORMAT_DE;
gfs2_leaf_out(&leaf, lbh->b_data);
log_debug( _("Fixing lf_dirent_format.\n"));
- *update = (opts.no ? not_updated : updated);
+ bmodified(lbh);
}
/* Make sure it's really a leaf. */
@@ -507,7 +503,7 @@ static int check_leaf_blks(struct gfs2_inode *ip, enum update_flags *update,
ip->i_di.di_num.no_addr,
(unsigned long long)leaf_no,
(unsigned long long)leaf_no);
- brelse(lbh, *update);
+ brelse(lbh);
break;
}
exp_count = (1 << (ip->i_di.di_depth - leaf.lf_depth));
@@ -517,22 +513,20 @@ static int check_leaf_blks(struct gfs2_inode *ip, enum update_flags *update,
if(pass->check_dentry &&
S_ISDIR(ip->i_di.di_mode)) {
error = check_entries(ip, lbh, DIR_EXHASH,
- update, &count, pass);
+ &count, pass);
/* Since the buffer possibly got
* updated directly, release it now,
* and grab it again later if we need it. */
- brelse(lbh, *update);
+ brelse(lbh);
if(error < 0) {
stack;
return -1;
}
- if(update && (count != leaf.lf_entries)) {
- enum update_flags f = not_updated;
-
+ if(count != leaf.lf_entries) {
lbh = bread(&sbp->buf_list, leaf_no);
gfs2_leaf_in(&leaf, lbh->b_data);
@@ -554,16 +548,16 @@ static int check_leaf_blks(struct gfs2_inode *ip, enum update_flags *update,
leaf.lf_entries = count;
gfs2_leaf_out(&leaf, lbh->b_data);
log_warn( _("Leaf entry count updated\n"));
- f = updated;
+ bmodified(lbh);
} else
log_err( _("Leaf entry count left in inconsistant state\n"));
- brelse(lbh, f);
+ brelse(lbh);
}
/* FIXME: Need to get entry count and
* compare it against leaf->lf_entries */
break; /* not a chain; go back to outer loop */
} else {
- brelse(lbh, *update);
+ brelse(lbh);
if(!leaf.lf_next)
break;
leaf_no = leaf.lf_next;
@@ -578,8 +572,7 @@ static int check_leaf_blks(struct gfs2_inode *ip, enum update_flags *update,
static int check_eattr_entries(struct gfs2_inode *ip,
struct gfs2_buffer_head *bh,
- struct metawalk_fxns *pass,
- enum update_flags *update_it)
+ struct metawalk_fxns *pass)
{
struct gfs2_ea_header *ea_hdr, *ea_hdr_prev = NULL;
uint64_t *ea_data_ptr = NULL;
@@ -587,7 +580,6 @@ static int check_eattr_entries(struct gfs2_inode *ip,
int error = 0;
uint32_t offset = (uint32_t)sizeof(struct gfs2_meta_header);
- *update_it = 0;
if(!pass->check_eattr_entry) {
return 0;
}
@@ -606,8 +598,6 @@ static int check_eattr_entries(struct gfs2_inode *ip,
stack;
return -1;
}
- if (error > 0)
- *update_it = updated;
if(error == 0 && pass->check_eattr_extentry &&
ea_hdr->ea_num_ptrs) {
uint32_t tot_ealen = 0;
@@ -629,7 +619,6 @@ static int check_eattr_entries(struct gfs2_inode *ip,
ea_data_ptr,
bh, ea_hdr,
ea_hdr_prev,
- update_it,
pass->private)) {
errors_found++;
if (query(&opts, _("Repair the bad "
@@ -640,7 +629,7 @@ static int check_eattr_entries(struct gfs2_inode *ip,
ea_hdr->ea_data_len =
cpu_to_be32(tot_ealen);
*ea_data_ptr = 0;
- *update_it = 1;
+ bmodified(bh);
/* Endianness doesn't matter
in this case because it's
a single byte. */
@@ -682,38 +671,29 @@ static int check_eattr_entries(struct gfs2_inode *ip,
* Returns: 0 on success, 1 if removal is needed, -1 on error
*/
static int check_leaf_eattr(struct gfs2_inode *ip, uint64_t block,
- uint64_t parent, enum update_flags *want_updated,
- struct metawalk_fxns *pass)
+ uint64_t parent, struct metawalk_fxns *pass)
{
struct gfs2_buffer_head *bh = NULL;
int error = 0;
- enum update_flags updated_this_leaf = not_updated;
log_debug( _("Checking EA leaf block #%"PRIu64" (0x%" PRIx64 ").\n"),
block, block);
if(pass->check_eattr_leaf) {
error = pass->check_eattr_leaf(ip, block, parent, &bh,
- &updated_this_leaf,
pass->private);
- if (updated_this_leaf) /* if this leaf was updated */
- *want_updated = updated; /* signal it for the parent */
if(error < 0) {
stack;
return -1;
}
if(error > 0) {
if (bh)
- brelse(bh, updated_this_leaf);
+ brelse(bh);
return 1;
}
if (bh) {
- error = check_eattr_entries(ip, bh, pass,
- &updated_this_leaf);
- brelse(bh, updated_this_leaf);
- if (updated_this_leaf) /* if this leaf was updated */
- *want_updated = updated; /* signal it for
- the parent */
+ error = check_eattr_entries(ip, bh, pass);
+ brelse(bh);
}
return error;
}
@@ -729,7 +709,6 @@ static int check_leaf_eattr(struct gfs2_inode *ip, uint64_t block,
* Returns: 0 on success -1 on error
*/
static int check_indirect_eattr(struct gfs2_inode *ip, uint64_t indirect,
- enum update_flags *want_updated,
struct metawalk_fxns *pass)
{
int error = 0;
@@ -737,19 +716,16 @@ static int check_indirect_eattr(struct gfs2_inode *ip, uint64_t indirect,
uint64_t block;
struct gfs2_buffer_head *indirect_buf = NULL;
struct gfs2_sbd *sdp = ip->i_sbd;
- enum update_flags update_indir_block = not_updated;
int first_ea_is_bad = 0;
uint64_t di_eattr_save = ip->i_di.di_eattr;
- *want_updated = not_updated;
log_debug( _("Checking EA indirect block #%"PRIu64" (0x%" PRIx64 ").\n"),
indirect, indirect);
if (!pass->check_eattr_indir)
return 0;
error = pass->check_eattr_indir(ip, indirect, ip->i_di.di_num.no_addr,
- &indirect_buf, want_updated,
- pass->private);
+ &indirect_buf, pass->private);
if (!error) {
int leaf_pointers = 0, leaf_pointer_errors = 0;
@@ -761,20 +737,16 @@ static int check_indirect_eattr(struct gfs2_inode *ip, uint64_t indirect,
while(*ea_leaf_ptr && (ea_leaf_ptr < end)){
block = be64_to_cpu(*ea_leaf_ptr);
leaf_pointers++;
- error = check_leaf_eattr(ip, block, indirect,
- want_updated, pass);
+ error = check_leaf_eattr(ip, block, indirect, pass);
if (error) {
leaf_pointer_errors++;
- if (update_indir_block == not_updated) {
- errors_found++;
- if (query(&opts, _("Fix the indirect "
- "block too? (y/n) "))) {
- update_indir_block = updated;
- errors_corrected++;
- *ea_leaf_ptr = 0;
- }
- } else
+ errors_found++;
+ if (query(&opts, _("Fix the indirect "
+ "block too? (y/n) "))) {
+ bmodified(indirect_buf);
+ errors_corrected++;
*ea_leaf_ptr = 0;
+ }
}
/* If the first eattr lead is bad, we can't have
a hole, so we have to treat this as an unrecoverable
@@ -790,7 +762,6 @@ static int check_indirect_eattr(struct gfs2_inode *ip, uint64_t indirect,
pass->finish_eattr_indir(ip,
leaf_pointers,
leaf_pointer_errors,
- want_updated,
pass->private);
} else if (leaf_pointer_errors) {
/* This is a bit tricky. We can't have eattr
@@ -813,11 +784,10 @@ static int check_indirect_eattr(struct gfs2_inode *ip, uint64_t indirect,
ip->i_di.di_eattr = di_eattr_save;
pass->finish_eattr_indir(ip, leaf_pointers,
leaf_pointer_errors,
- want_updated,
pass->private);
}
if (leaf_pointer_errors == leaf_pointers) {
- if (*want_updated)
+ if (indirect_buf->b_changed)
gfs2_set_bitmap(sdp, indirect,
GFS2_BLKST_FREE);
gfs2_block_set(sdp, bl, indirect,
@@ -827,7 +797,7 @@ static int check_indirect_eattr(struct gfs2_inode *ip, uint64_t indirect,
}
}
if (indirect_buf)
- brelse(indirect_buf, update_indir_block);
+ brelse(indirect_buf);
return error;
}
@@ -838,8 +808,7 @@ static int check_indirect_eattr(struct gfs2_inode *ip, uint64_t indirect,
*
* Returns: 0 on success, -1 on error
*/
-int check_inode_eattr(struct gfs2_inode *ip, enum update_flags *want_updated,
- struct metawalk_fxns *pass)
+int check_inode_eattr(struct gfs2_inode *ip, struct metawalk_fxns *pass)
{
int error = 0;
@@ -852,12 +821,11 @@ int check_inode_eattr(struct gfs2_inode *ip, enum update_flags *want_updated,
if(ip->i_di.di_flags & GFS2_DIF_EA_INDIRECT){
if((error = check_indirect_eattr(ip, ip->i_di.di_eattr,
- want_updated, pass)))
+ pass)))
stack;
} else {
error = check_leaf_eattr(ip, ip->i_di.di_eattr,
- ip->i_di.di_num.no_addr,
- want_updated, pass);
+ ip->i_di.di_num.no_addr, pass);
if (error)
stack;
}
@@ -948,12 +916,12 @@ fail:
while (!osi_list_empty(list)) {
nbh = osi_list_entry(list->next,
struct gfs2_buffer_head, b_altlist);
- brelse(nbh, not_updated);
+ brelse(nbh);
osi_list_del(&nbh->b_altlist);
}
}
/* This is an error path, so we need to release the buffer here: */
- brelse(metabh, not_updated);
+ brelse(metabh);
return -1;
}
@@ -971,7 +939,6 @@ int check_metatree(struct gfs2_inode *ip, struct metawalk_fxns *pass)
uint64_t block, *ptr;
uint32_t height = ip->i_di.di_height;
int i, head_size;
- enum update_flags update = not_updated;
int error = 0;
if (!height)
@@ -1034,7 +1001,7 @@ int check_metatree(struct gfs2_inode *ip, struct metawalk_fxns *pass)
{
bh = osi_list_entry(list->next,
struct gfs2_buffer_head, b_altlist);
- brelse(bh, not_updated);
+ brelse(bh);
osi_list_del(&bh->b_altlist);
}
}
@@ -1043,7 +1010,7 @@ end:
if (S_ISDIR(ip->i_di.di_mode)) {
/* check validity of leaf blocks and leaf chains */
if (ip->i_di.di_flags & GFS2_DIF_EXHASH) {
- error = check_leaf_blks(ip, &update, pass);
+ error = check_leaf_blks(ip, pass);
if(error < 0)
return -1;
if(error > 0)
@@ -1056,12 +1023,12 @@ end:
/* Checks stuffed inode directories */
static int check_linear_dir(struct gfs2_inode *ip, struct gfs2_buffer_head *bh,
- enum update_flags *update, struct metawalk_fxns *pass)
+ struct metawalk_fxns *pass)
{
int error = 0;
uint16_t count = 0;
- error = check_entries(ip, bh, DIR_LINEAR, update, &count, pass);
+ error = check_entries(ip, bh, DIR_LINEAR, &count, pass);
if(error < 0) {
stack;
return -1;
@@ -1075,38 +1042,36 @@ int check_dir(struct gfs2_sbd *sbp, uint64_t block, struct metawalk_fxns *pass)
{
struct gfs2_buffer_head *bh;
struct gfs2_inode *ip;
- enum update_flags update = not_updated;
int error = 0;
bh = bread(&sbp->buf_list, block);
ip = fsck_inode_get(sbp, bh);
if(ip->i_di.di_flags & GFS2_DIF_EXHASH) {
- error = check_leaf_blks(ip, &update, pass);
+ error = check_leaf_blks(ip, pass);
if(error < 0) {
stack;
- fsck_inode_put(ip, not_updated); /* does brelse(bh); */
+ fsck_inode_put(ip); /* does brelse(bh); */
return -1;
}
}
else {
- error = check_linear_dir(ip, bh, &update, pass);
+ error = check_linear_dir(ip, bh, pass);
if(error < 0) {
stack;
- fsck_inode_put(ip, not_updated); /* does brelse(bh); */
+ fsck_inode_put(ip); /* does brelse(bh); */
return -1;
}
}
- fsck_inode_put(ip, opts.no ? not_updated : update); /* does a brelse */
+ fsck_inode_put(ip); /* does a brelse */
return error;
}
static int remove_dentry(struct gfs2_inode *ip, struct gfs2_dirent *dent,
struct gfs2_dirent *prev_de,
struct gfs2_buffer_head *bh,
- char *filename, enum update_flags *update,
- uint16_t *count, void *private)
+ char *filename, uint16_t *count, void *private)
{
/* the metawalk_fxn's private field must be set to the dentry
* block we want to clear */
@@ -1116,7 +1081,6 @@ static int remove_dentry(struct gfs2_inode *ip, struct gfs2_dirent *dent,
memset(&dentry, 0, sizeof(struct gfs2_dirent));
gfs2_dirent_in(&dentry, (char *)dent);
de = &dentry;
- *update = (opts.no ? not_updated : updated);
if(de->de_inum.no_addr == *dentryblock)
dirent2_del(ip, bh, prev_de, dent);
@@ -1269,16 +1233,14 @@ int delete_data(struct gfs2_inode *ip, uint64_t block, void *private)
}
int delete_eattr_indir(struct gfs2_inode *ip, uint64_t block, uint64_t parent,
- struct gfs2_buffer_head **bh,
- enum update_flags *want_updated, void *private)
+ struct gfs2_buffer_head **bh, void *private)
{
return delete_blocks(ip, block, NULL, _("indirect extended attribute"),
private);
}
int delete_eattr_leaf(struct gfs2_inode *ip, uint64_t block, uint64_t parent,
- struct gfs2_buffer_head **bh,
- enum update_flags *want_updated, void *private)
+ struct gfs2_buffer_head **bh, void *private)
{
return delete_blocks(ip, block, NULL, _("extended attribute"),
private);
diff --git a/gfs2/fsck/metawalk.h b/gfs2/fsck/metawalk.h
index 0721ed1..b720516 100644
--- a/gfs2/fsck/metawalk.h
+++ b/gfs2/fsck/metawalk.h
@@ -6,8 +6,7 @@
struct metawalk_fxns;
-int check_inode_eattr(struct gfs2_inode *ip, enum update_flags *want_updated,
- struct metawalk_fxns *pass);
+int check_inode_eattr(struct gfs2_inode *ip, struct metawalk_fxns *pass);
int check_metatree(struct gfs2_inode *ip, struct metawalk_fxns *pass);
int check_dir(struct gfs2_sbd *sbp, uint64_t block,
struct metawalk_fxns *pass);
@@ -23,11 +22,9 @@ int delete_metadata(struct gfs2_inode *ip, uint64_t block,
struct gfs2_buffer_head **bh, void *private);
int delete_data(struct gfs2_inode *ip, uint64_t block, void *private);
int delete_eattr_indir(struct gfs2_inode *ip, uint64_t block, uint64_t parent,
- struct gfs2_buffer_head **bh,
- enum update_flags *want_updated, void *private);
+ struct gfs2_buffer_head **bh, void *private);
int delete_eattr_leaf(struct gfs2_inode *ip, uint64_t block, uint64_t parent,
- struct gfs2_buffer_head **bh,
- enum update_flags *want_updated, void *private);
+ struct gfs2_buffer_head **bh, void *private);
/* metawalk_fxns: function pointers to check various parts of the fs
*
@@ -54,18 +51,14 @@ struct metawalk_fxns {
void *private);
int (*check_eattr_indir) (struct gfs2_inode *ip, uint64_t block,
uint64_t parent,
- struct gfs2_buffer_head **bh,
- enum update_flags *want_updated,
- void *private);
+ struct gfs2_buffer_head **bh, void *private);
int (*check_eattr_leaf) (struct gfs2_inode *ip, uint64_t block,
uint64_t parent, struct gfs2_buffer_head **bh,
- enum update_flags *want_updated,
void *private);
int (*check_dentry) (struct gfs2_inode *ip, struct gfs2_dirent *de,
struct gfs2_dirent *prev,
struct gfs2_buffer_head *bh,
- char *filename, enum update_flags *update,
- uint16_t *count, void *private);
+ char *filename, uint16_t *count, void *private);
int (*check_eattr_entry) (struct gfs2_inode *ip,
struct gfs2_buffer_head *leaf_bh,
struct gfs2_ea_header *ea_hdr,
@@ -76,11 +69,9 @@ struct metawalk_fxns {
struct gfs2_buffer_head *leaf_bh,
struct gfs2_ea_header *ea_hdr,
struct gfs2_ea_header *ea_hdr_prev,
- enum update_flags *want_updated,
void *private);
int (*finish_eattr_indir) (struct gfs2_inode *ip, int leaf_pointers,
int leaf_pointer_errors,
- enum update_flags *want_updated,
void *private);
};
diff --git a/gfs2/fsck/pass1.c b/gfs2/fsck/pass1.c
index 351a47c..267028e 100644
--- a/gfs2/fsck/pass1.c
+++ b/gfs2/fsck/pass1.c
@@ -40,10 +40,10 @@ static int check_metalist(struct gfs2_inode *ip, uint64_t block,
static int check_data(struct gfs2_inode *ip, uint64_t block, void *private);
static int check_eattr_indir(struct gfs2_inode *ip, uint64_t indirect,
uint64_t parent, struct gfs2_buffer_head **bh,
- enum update_flags *want_updated, void *private);
+ void *private);
static int check_eattr_leaf(struct gfs2_inode *ip, uint64_t block,
uint64_t parent, struct gfs2_buffer_head **bh,
- enum update_flags *want_updated, void *private);
+ void *private);
static int check_eattr_entries(struct gfs2_inode *ip,
struct gfs2_buffer_head *leaf_bh,
struct gfs2_ea_header *ea_hdr,
@@ -53,11 +53,9 @@ static int check_extended_leaf_eattr(struct gfs2_inode *ip, uint64_t *data_ptr,
struct gfs2_buffer_head *leaf_bh,
struct gfs2_ea_header *ea_hdr,
struct gfs2_ea_header *ea_hdr_prev,
- enum update_flags *want_updated,
void *private);
static int finish_eattr_indir(struct gfs2_inode *ip, int leaf_pointers,
- int leaf_pointer_errors,
- enum update_flags *want_updated, void *private);
+ int leaf_pointer_errors, void *private);
struct metawalk_fxns pass1_fxns = {
.private = NULL,
@@ -118,10 +116,10 @@ static int check_metalist(struct gfs2_inode *ip, uint64_t block,
"something that is not an indirect block).\n"));
if(!found_dup) {
gfs2_block_set(ip->i_sbd, bl, block, gfs2_meta_inval);
- brelse(nbh, not_updated);
+ brelse(nbh);
return 1;
}
- brelse(nbh, not_updated);
+ brelse(nbh);
} else /* blk check ok */
*bh = nbh;
@@ -226,7 +224,7 @@ static int check_data(struct gfs2_inode *ip, uint64_t block, void *private)
}
static int remove_inode_eattr(struct gfs2_inode *ip, struct block_count *bc,
- int duplicate, enum update_flags *want_updated)
+ int duplicate)
{
if (!duplicate) {
gfs2_set_bitmap(ip->i_sbd, ip->i_di.di_eattr,
@@ -238,13 +236,12 @@ static int remove_inode_eattr(struct gfs2_inode *ip, struct block_count *bc,
bc->ea_count = 0;
ip->i_di.di_blocks = 1 + bc->indir_count + bc->data_count;
ip->i_di.di_flags &= ~GFS2_DIF_EA_INDIRECT;
- *want_updated = updated;
+ bmodified(ip->i_bh);
return 0;
}
static int ask_remove_inode_eattr(struct gfs2_inode *ip,
- struct block_count *bc,
- enum update_flags *want_updated)
+ struct block_count *bc)
{
log_err( _("Inode %lld (0x%llx) has unrecoverable Extended Attribute "
"errors.\n"), (unsigned long long)ip->i_di.di_num.no_addr,
@@ -259,7 +256,7 @@ static int ask_remove_inode_eattr(struct gfs2_inode *ip,
stack;
return -1;
}
- if (!remove_inode_eattr(ip, bc, q.dup_block, want_updated))
+ if (!remove_inode_eattr(ip, bc, q.dup_block))
log_err( _("Extended attributes were removed.\n"));
else
log_err( _("Unable to remove inode eattr pointer; "
@@ -280,12 +277,10 @@ static int ask_remove_inode_eattr(struct gfs2_inode *ip,
* Returns: 1 if the EA is fixed, else 0 if it was not fixed.
*/
static int clear_eas(struct gfs2_inode *ip, struct block_count *bc,
- uint64_t block, int duplicate,
- enum update_flags *want_updated, const char *emsg)
+ uint64_t block, int duplicate, const char *emsg)
{
struct gfs2_sbd *sdp = ip->i_sbd;
- *want_updated = not_updated;
log_err( _("Inode #%llu (0x%llx): %s"),
(unsigned long long)ip->i_di.di_num.no_addr,
(unsigned long long)ip->i_di.di_num.no_addr, emsg);
@@ -295,7 +290,7 @@ static int clear_eas(struct gfs2_inode *ip, struct block_count *bc,
if (query(&opts, _("Clear the bad Extended Attribute? (y/n) "))) {
errors_corrected++;
if (block == ip->i_di.di_eattr) {
- remove_inode_eattr(ip, bc, duplicate, want_updated);
+ remove_inode_eattr(ip, bc, duplicate);
log_err( _("The bad extended attribute was "
"removed.\n"));
} else if (!duplicate) {
@@ -304,7 +299,6 @@ static int clear_eas(struct gfs2_inode *ip, struct block_count *bc,
log_err( _("The bad Extended Attribute was "
"removed.\n"));
}
- *want_updated = updated;
return 1;
} else {
log_err( _("The bad Extended Attribute was not fixed.\n"));
@@ -315,7 +309,7 @@ static int clear_eas(struct gfs2_inode *ip, struct block_count *bc,
static int check_eattr_indir(struct gfs2_inode *ip, uint64_t indirect,
uint64_t parent, struct gfs2_buffer_head **bh,
- enum update_flags *want_updated, void *private)
+ void *private)
{
struct gfs2_sbd *sdp = ip->i_sbd;
int ret = 0;
@@ -344,7 +338,7 @@ static int check_eattr_indir(struct gfs2_inode *ip, uint64_t indirect,
*bh = bread(&sdp->buf_list, indirect);
if(gfs2_check_meta(*bh, GFS2_METATYPE_IN)) {
if(q.block_type != gfs2_block_free) { /* Duplicate? */
- if (!clear_eas(ip, bc, indirect, 1, want_updated,
+ if (!clear_eas(ip, bc, indirect, 1,
_("Bad indirect Extended Attribute "
"duplicate found"))) {
gfs2_block_mark(sdp, bl, indirect,
@@ -353,7 +347,7 @@ static int check_eattr_indir(struct gfs2_inode *ip, uint64_t indirect,
}
return 1;
}
- clear_eas(ip, bc, indirect, 0, want_updated,
+ clear_eas(ip, bc, indirect, 0,
_("Extended Attribute indirect block has incorrect "
"type"));
return 1;
@@ -380,13 +374,12 @@ static int check_eattr_indir(struct gfs2_inode *ip, uint64_t indirect,
}
static int finish_eattr_indir(struct gfs2_inode *ip, int leaf_pointers,
- int leaf_pointer_errors,
- enum update_flags *want_updated, void *private)
+ int leaf_pointer_errors, void *private)
{
struct block_count *bc = (struct block_count *) private;
if (leaf_pointer_errors == leaf_pointers) /* All eas were bad */
- return ask_remove_inode_eattr(ip, bc, want_updated);
+ return ask_remove_inode_eattr(ip, bc);
log_debug( _("Marking inode #%llu (0x%llx) with extended "
"attribute block\n"),
(unsigned long long)ip->i_di.di_num.no_addr,
@@ -406,7 +399,7 @@ static int finish_eattr_indir(struct gfs2_inode *ip, int leaf_pointers,
errors_corrected++;
ip->i_di.di_blocks = 1 + bc->indir_count +
bc->data_count + bc->ea_count;
- *want_updated = updated;
+ bmodified(ip->i_bh);
log_err( _("Block count fixed.\n"));
return 1;
}
@@ -415,8 +408,7 @@ static int finish_eattr_indir(struct gfs2_inode *ip, int leaf_pointers,
}
static int check_leaf_block(struct gfs2_inode *ip, uint64_t block, int btype,
- struct gfs2_buffer_head **bh,
- enum update_flags *want_updated, void *private)
+ struct gfs2_buffer_head **bh, void *private)
{
struct gfs2_buffer_head *leaf_bh = NULL;
struct gfs2_sbd *sdp = ip->i_sbd;
@@ -433,14 +425,15 @@ static int check_leaf_block(struct gfs2_inode *ip, uint64_t block, int btype,
leaf_bh = bread(&sdp->buf_list, block);
if(gfs2_check_meta(leaf_bh, btype)) {
if(q.block_type != gfs2_block_free) { /* Duplicate? */
- clear_eas(ip, bc, block, 1, want_updated,
+ clear_eas(ip, bc, block, 1,
_("Bad Extended Attribute duplicate found"));
} else {
- clear_eas(ip, bc, block, 0, want_updated,
+ clear_eas(ip, bc, block, 0,
_("Extended Attribute leaf block "
"has incorrect type"));
}
- brelse(leaf_bh, *want_updated);
+ bmodified(leaf_bh);
+ brelse(leaf_bh);
return 1;
}
if(q.block_type != gfs2_block_free) { /* Duplicate? */
@@ -449,17 +442,18 @@ static int check_leaf_block(struct gfs2_inode *ip, uint64_t block, int btype,
(unsigned long long)block);
gfs2_block_mark(sdp, bl, block, gfs2_dup_block);
bc->ea_count++;
- brelse(leaf_bh, not_updated);
+ brelse(leaf_bh);
return 1;
}
if (ip->i_di.di_eattr == 0) {
/* Can only get in here if there were unrecoverable ea
errors that caused clear_eas to be called. What we
need to do here is remove the subsequent ea blocks. */
- clear_eas(ip, bc, block, 0, want_updated,
+ clear_eas(ip, bc, block, 0,
_("Extended Attribute block removed due to "
"previous errors.\n"));
- brelse(leaf_bh, *want_updated);
+ bmodified(leaf_bh);
+ brelse(leaf_bh);
return 1;
}
log_debug( _("Setting block #%lld (0x%llx) to eattr block\n"),
@@ -488,7 +482,6 @@ static int check_extended_leaf_eattr(struct gfs2_inode *ip, uint64_t *data_ptr,
struct gfs2_buffer_head *leaf_bh,
struct gfs2_ea_header *ea_hdr,
struct gfs2_ea_header *ea_hdr_prev,
- enum update_flags *want_updated,
void *private)
{
uint64_t el_blk = be64_to_cpu(*data_ptr);
@@ -509,16 +502,15 @@ static int check_extended_leaf_eattr(struct gfs2_inode *ip, uint64_t *data_ptr,
gfs2_block_set(sdp, bl, ip->i_di.di_eattr, gfs2_bad_block);
return 1;
}
- error = check_leaf_block(ip, el_blk, GFS2_METATYPE_ED, &bh,
- want_updated, private);
+ error = check_leaf_block(ip, el_blk, GFS2_METATYPE_ED, &bh, private);
if (bh)
- brelse(bh, not_updated);
+ brelse(bh);
return error;
}
static int check_eattr_leaf(struct gfs2_inode *ip, uint64_t block,
uint64_t parent, struct gfs2_buffer_head **bh,
- enum update_flags *want_updated, void *private)
+ void *private)
{
struct gfs2_sbd *sdp = ip->i_sbd;
@@ -541,8 +533,7 @@ static int check_eattr_leaf(struct gfs2_inode *ip, uint64_t block,
gfs2_block_set(sdp, bl, ip->i_di.di_eattr, gfs2_bad_block);
return 1;
}
- return check_leaf_block(ip, block, GFS2_METATYPE_EA, bh, want_updated,
- private);
+ return check_leaf_block(ip, block, GFS2_METATYPE_EA, bh, private);
}
static int check_eattr_entries(struct gfs2_inode *ip,
@@ -682,9 +673,7 @@ static int handle_di(struct gfs2_sbd *sdp, struct gfs2_buffer_head *bh,
int error;
struct block_count bc = {0};
struct metawalk_fxns invalidate_metatree = {0};
- enum update_flags f;
- f = not_updated;
invalidate_metatree.check_metalist = clear_metalist;
invalidate_metatree.check_data = clear_data;
invalidate_metatree.check_leaf = clear_leaf;
@@ -703,7 +692,7 @@ static int handle_di(struct gfs2_sbd *sdp, struct gfs2_buffer_head *bh,
errors_corrected++;
ip->i_di.di_num.no_addr = ip->i_di.di_num.no_formal_ino = block;
gfs2_dinode_out(&ip->i_di, ip->i_bh->b_data);
- f = updated;
+ bmodified(ip->i_bh);
} else
log_err( _("Address in inode at block #%" PRIu64
" (0x%" PRIx64 ") not fixed\n"), block, block);
@@ -711,7 +700,7 @@ static int handle_di(struct gfs2_sbd *sdp, struct gfs2_buffer_head *bh,
if(gfs2_block_check(sdp, bl, block, &q)) {
stack;
- fsck_inode_put(ip, f);
+ fsck_inode_put(ip);
return -1;
}
if(q.block_type != gfs2_block_free) {
@@ -719,10 +708,10 @@ static int handle_di(struct gfs2_sbd *sdp, struct gfs2_buffer_head *bh,
"#%" PRIu64 " (0x%" PRIx64 ")\n"), block, block);
if(gfs2_block_mark(sdp, bl, block, gfs2_dup_block)) {
stack;
- fsck_inode_put(ip, f);
+ fsck_inode_put(ip);
return -1;
}
- fsck_inode_put(ip, f);
+ fsck_inode_put(ip);
return 0;
}
@@ -733,12 +722,12 @@ static int handle_di(struct gfs2_sbd *sdp, struct gfs2_buffer_head *bh,
block, block);
if(gfs2_block_set(sdp, bl, block, gfs2_inode_dir)) {
stack;
- fsck_inode_put(ip, f);
+ fsck_inode_put(ip);
return -1;
}
if(add_to_dir_list(sdp, block)) {
stack;
- fsck_inode_put(ip, f);
+ fsck_inode_put(ip);
return -1;
}
break;
@@ -747,7 +736,7 @@ static int handle_di(struct gfs2_sbd *sdp, struct gfs2_buffer_head *bh,
block, block);
if(gfs2_block_set(sdp, bl, block, gfs2_inode_file)) {
stack;
- fsck_inode_put(ip, f);
+ fsck_inode_put(ip);
return -1;
}
break;
@@ -756,7 +745,7 @@ static int handle_di(struct gfs2_sbd *sdp, struct gfs2_buffer_head *bh,
block, block);
if(gfs2_block_set(sdp, bl, block, gfs2_inode_lnk)) {
stack;
- fsck_inode_put(ip, f);
+ fsck_inode_put(ip);
return -1;
}
break;
@@ -765,7 +754,7 @@ static int handle_di(struct gfs2_sbd *sdp, struct gfs2_buffer_head *bh,
block, block);
if(gfs2_block_set(sdp, bl, block, gfs2_inode_blk)) {
stack;
- fsck_inode_put(ip, f);
+ fsck_inode_put(ip);
return -1;
}
break;
@@ -774,7 +763,7 @@ static int handle_di(struct gfs2_sbd *sdp, struct gfs2_buffer_head *bh,
block, block);
if(gfs2_block_set(sdp, bl, block, gfs2_inode_chr)) {
stack;
- fsck_inode_put(ip, f);
+ fsck_inode_put(ip);
return -1;
}
break;
@@ -783,7 +772,7 @@ static int handle_di(struct gfs2_sbd *sdp, struct gfs2_buffer_head *bh,
block, block);
if(gfs2_block_set(sdp, bl, block, gfs2_inode_fifo)) {
stack;
- fsck_inode_put(ip, f);
+ fsck_inode_put(ip);
return -1;
}
break;
@@ -792,7 +781,7 @@ static int handle_di(struct gfs2_sbd *sdp, struct gfs2_buffer_head *bh,
block, block);
if(gfs2_block_set(sdp, bl, block, gfs2_inode_sock)) {
stack;
- fsck_inode_put(ip, f);
+ fsck_inode_put(ip);
return -1;
}
break;
@@ -801,16 +790,16 @@ static int handle_di(struct gfs2_sbd *sdp, struct gfs2_buffer_head *bh,
block, block);
if(gfs2_block_set(sdp, bl, block, gfs2_meta_inval)) {
stack;
- fsck_inode_put(ip, f);
+ fsck_inode_put(ip);
return -1;
}
gfs2_set_bitmap(sdp, block, GFS2_BLKST_FREE);
- fsck_inode_put(ip, f);
+ fsck_inode_put(ip);
return 0;
}
if(set_link_count(ip->i_sbd, ip->i_di.di_num.no_addr, ip->i_di.di_nlink)) {
stack;
- fsck_inode_put(ip, f);
+ fsck_inode_put(ip);
return -1;
}
@@ -827,11 +816,11 @@ static int handle_di(struct gfs2_sbd *sdp, struct gfs2_buffer_head *bh,
log_warn( _("Marking inode invalid\n"));
if(gfs2_block_set(sdp, bl, block, gfs2_meta_inval)) {
stack;
- fsck_inode_put(ip, f);
+ fsck_inode_put(ip);
return -1;
}
gfs2_set_bitmap(sdp, block, GFS2_BLKST_FREE);
- fsck_inode_put(ip, f);
+ fsck_inode_put(ip);
return 0;
}
}
@@ -840,7 +829,7 @@ static int handle_di(struct gfs2_sbd *sdp, struct gfs2_buffer_head *bh,
error = check_metatree(ip, &pass1_fxns);
if (fsck_abort || error < 0) {
- fsck_inode_put(ip, f);
+ fsck_inode_put(ip);
return 0;
}
if(error > 0) {
@@ -852,15 +841,15 @@ static int handle_di(struct gfs2_sbd *sdp, struct gfs2_buffer_head *bh,
gfs2_block_set(sdp, bl, ip->i_di.di_num.no_addr,
gfs2_meta_inval);
gfs2_set_bitmap(sdp, ip->i_di.di_num.no_addr, GFS2_BLKST_FREE);
- fsck_inode_put(ip, f);
+ fsck_inode_put(ip);
return 0;
}
- error = check_inode_eattr(ip, &f, &pass1_fxns);
+ error = check_inode_eattr(ip, &pass1_fxns);
- if (error && f == updated &&
+ if (error &&
!(ip->i_di.di_flags & GFS2_DIF_EA_INDIRECT))
- ask_remove_inode_eattr(ip, &bc, &f);
+ ask_remove_inode_eattr(ip, &bc);
if (ip->i_di.di_blocks !=
(1 + bc.indir_count + bc.data_count + bc.ea_count)) {
@@ -882,8 +871,8 @@ static int handle_di(struct gfs2_sbd *sdp, struct gfs2_buffer_head *bh,
errors_corrected++;
ip->i_di.di_blocks = 1 + bc.indir_count + bc.data_count +
bc.ea_count;
+ bmodified(ip->i_bh);
gfs2_dinode_out(&ip->i_di, ip->i_bh->b_data);
- f = updated;
} else
log_err( _("Bad block count for #%llu (0x%llx"
") not fixed\n"),
@@ -891,7 +880,7 @@ static int handle_di(struct gfs2_sbd *sdp, struct gfs2_buffer_head *bh,
(unsigned long long)ip->i_di.di_num.no_addr);
}
- fsck_inode_put(ip, f);
+ fsck_inode_put(ip);
return 0;
}
@@ -1024,7 +1013,7 @@ int pass1(struct gfs2_sbd *sbp)
break;
warm_fuzzy_stuff(block);
if (fsck_abort) { /* if asked to abort */
- gfs2_rgrp_relse(rgd, not_updated, rgbh);
+ gfs2_rgrp_relse(rgd, rgbh);
free(rgbh);
return FSCK_OK;
}
@@ -1037,15 +1026,15 @@ int pass1(struct gfs2_sbd *sbp)
if (scan_meta(sbp, bh, block)) {
stack;
- brelse(bh, not_updated);
- gfs2_rgrp_relse(rgd, not_updated, rgbh);
+ brelse(bh);
+ gfs2_rgrp_relse(rgd, rgbh);
free(rgbh);
return FSCK_ERROR;
}
- brelse(bh, not_updated);
+ brelse(bh);
first = 0;
}
- gfs2_rgrp_relse(rgd, not_updated, rgbh);
+ gfs2_rgrp_relse(rgd, rgbh);
free(rgbh);
}
return FSCK_OK;
diff --git a/gfs2/fsck/pass1b.c b/gfs2/fsck/pass1b.c
index 2372dc8..218878b 100644
--- a/gfs2/fsck/pass1b.c
+++ b/gfs2/fsck/pass1b.c
@@ -62,12 +62,11 @@ static int check_data(struct gfs2_inode *ip, uint64_t block, void *private)
static int check_eattr_indir(struct gfs2_inode *ip, uint64_t block,
uint64_t parent, struct gfs2_buffer_head **bh,
- enum update_flags *want_updated, void *private)
+ void *private)
{
struct gfs2_sbd *sbp = ip->i_sbd;
struct gfs2_buffer_head *indir_bh = NULL;
- *want_updated = not_updated;
inc_if_found(block, 0, private);
indir_bh = bread(&sbp->buf_list, block);
*bh = indir_bh;
@@ -77,12 +76,11 @@ static int check_eattr_indir(struct gfs2_inode *ip, uint64_t block,
static int check_eattr_leaf(struct gfs2_inode *ip, uint64_t block,
uint64_t parent, struct gfs2_buffer_head **bh,
- enum update_flags *want_updated, void *private)
+ void *private)
{
struct gfs2_sbd *sbp = ip->i_sbd;
struct gfs2_buffer_head *leaf_bh = NULL;
- *want_updated = not_updated;
inc_if_found(block, 0, private);
leaf_bh = bread(&sbp->buf_list, block);
@@ -102,11 +100,10 @@ static int check_eattr_extentry(struct gfs2_inode *ip, uint64_t *ea_data_ptr,
struct gfs2_buffer_head *leaf_bh,
struct gfs2_ea_header *ea_hdr,
struct gfs2_ea_header *ea_hdr_prev,
- enum update_flags *want_updated, void *private)
+ void *private)
{
uint64_t block = be64_to_cpu(*ea_data_ptr);
- *want_updated = not_updated;
inc_if_found(block, 0, private);
return 0;
@@ -115,7 +112,7 @@ static int check_eattr_extentry(struct gfs2_inode *ip, uint64_t *ea_data_ptr,
static int find_dentry(struct gfs2_inode *ip, struct gfs2_dirent *de,
struct gfs2_dirent *prev,
struct gfs2_buffer_head *bh, char *filename,
- enum update_flags *update, uint16_t *count, void *priv)
+ uint16_t *count, void *priv)
{
osi_list_t *tmp1, *tmp2;
struct dup_blocks *b;
@@ -192,14 +189,12 @@ static int clear_dup_data(struct gfs2_inode *ip, uint64_t block, void *private)
static int clear_dup_eattr_indir(struct gfs2_inode *ip, uint64_t block,
uint64_t parent, struct gfs2_buffer_head **bh,
- enum update_flags *want_updated,
void *private)
{
struct dup_handler *dh = (struct dup_handler *) private;
/* Can't use fxns from eattr.c since we need to check the ref
* count */
*bh = NULL;
- *want_updated = not_updated;
if(dh->ref_count == 1)
return 1;
if(block == dh->b->block_no) {
@@ -222,11 +217,10 @@ static int clear_dup_eattr_indir(struct gfs2_inode *ip, uint64_t block,
static int clear_dup_eattr_leaf(struct gfs2_inode *ip, uint64_t block,
uint64_t parent, struct gfs2_buffer_head **bh,
- enum update_flags *want_updated, void *private)
+ void *private)
{
struct dup_handler *dh = (struct dup_handler *) private;
- *want_updated = not_updated;
if(dh->ref_count == 1)
return 1;
if(block == dh->b->block_no) {
@@ -294,13 +288,11 @@ static int clear_eattr_extentry(struct gfs2_inode *ip, uint64_t *ea_data_ptr,
struct gfs2_buffer_head *leaf_bh,
struct gfs2_ea_header *ea_hdr,
struct gfs2_ea_header *ea_hdr_prev,
- enum update_flags *want_updated,
void *private)
{
uint64_t block = be64_to_cpu(*ea_data_ptr);
struct dup_handler *dh = (struct dup_handler *) private;
- *want_updated = not_updated;
if(dh->ref_count == 1)
return 1;
if(block == dh->b->block_no) {
@@ -339,7 +331,6 @@ static int find_block_ref(struct gfs2_sbd *sbp, uint64_t inode, struct dup_block
.check_eattr_entry = check_eattr_entry,
.check_eattr_extentry = check_eattr_extentry,
};
- enum update_flags update;
ip = fsck_load_inode(sbp, inode); /* bread, inode_get */
log_debug( _("Checking inode %" PRIu64 " (0x%" PRIx64 ")'s "
@@ -347,14 +338,14 @@ static int find_block_ref(struct gfs2_sbd *sbp, uint64_t inode, struct dup_block
")\n"), inode, inode, b->block_no, b->block_no);
if(check_metatree(ip, &find_refs)) {
stack;
- fsck_inode_put(ip, not_updated); /* out, brelse, free */
+ fsck_inode_put(ip); /* out, brelse, free */
return -1;
}
log_debug( _("Done checking metatree\n"));
/* Check for ea references in the inode */
- if(check_inode_eattr(ip, &update, &find_refs) < 0){
+ if(check_inode_eattr(ip, &find_refs) < 0){
stack;
- fsck_inode_put(ip, not_updated); /* out, brelse, free */
+ fsck_inode_put(ip); /* out, brelse, free */
return -1;
}
if (myfi.found) {
@@ -374,7 +365,7 @@ static int find_block_ref(struct gfs2_sbd *sbp, uint64_t inode, struct dup_block
id->ea_only = myfi.ea_only;
osi_list_add_prev(&id->list, &b->ref_inode_list);
}
- fsck_inode_put(ip, (opts.no ? not_updated : updated)); /* out, brelse, free */
+ fsck_inode_put(ip); /* out, brelse, free */
return 0;
}
@@ -395,7 +386,6 @@ static int handle_dup_blk(struct gfs2_sbd *sbp, struct dup_blocks *b)
};
struct gfs2_inode *ip;
struct dup_handler dh = {0};
- enum update_flags update;
osi_list_foreach(tmp, &b->ref_inode_list) {
id = osi_list_entry(tmp, struct inode_with_dups, list);
@@ -416,7 +406,7 @@ static int handle_dup_blk(struct gfs2_sbd *sbp, struct dup_blocks *b)
bh = bread(&sbp->buf_list, b->block_no);
cmagic = ((struct gfs2_meta_header *)(bh->b_data))->mh_magic;
- brelse(bh, not_updated);
+ brelse(bh);
if (be32_to_cpu(cmagic) == GFS2_MAGIC) {
tmp = b->ref_inode_list.next;
id = osi_list_entry(tmp, struct inode_with_dups, list);
@@ -441,7 +431,8 @@ static int handle_dup_blk(struct gfs2_sbd *sbp, struct dup_blocks *b)
gfs2_block_set(ip->i_sbd, bl,
ip->i_di.di_num.no_addr,
gfs2_meta_inval);
- fsck_inode_put(ip, updated);
+ bmodified(ip->i_bh);
+ fsck_inode_put(ip);
} else {
log_warn( _("The bad inode was not cleared."));
}
@@ -483,14 +474,14 @@ static int handle_dup_blk(struct gfs2_sbd *sbp, struct dup_blocks *b)
dh.id = id;
clear_dup_fxns.private = (void *) &dh;
/* Clear the EAs for the inode first */
- check_inode_eattr(ip, &update, &clear_dup_fxns);
+ check_inode_eattr(ip, &clear_dup_fxns);
/* If the dup wasn't only in the EA, clear the inode */
if(!id->ea_only)
check_metatree(ip, &clear_dup_fxns);
gfs2_block_set(ip->i_sbd, bl, ip->i_di.di_num.no_addr,
gfs2_meta_inval);
- fsck_inode_put(ip, updated); /* out, brelse, free */
+ fsck_inode_put(ip); /* out, brelse, free */
dh.ref_inode_count--;
if(dh.ref_inode_count == 1)
break;
diff --git a/gfs2/fsck/pass1c.c b/gfs2/fsck/pass1c.c
index 2aa5bc0..e9784c4 100644
--- a/gfs2/fsck/pass1c.c
+++ b/gfs2/fsck/pass1c.c
@@ -29,6 +29,7 @@ static int remove_eattr_entry(struct gfs2_sbd *sdp,
log_err( _("Bad Extended Attribute at block #%"PRIu64
" (0x%" PRIx64 ") removed.\n"),
leaf_bh->b_blocknr, leaf_bh->b_blocknr);
+ bmodified(leaf_bh);
return 0;
}
@@ -60,14 +61,13 @@ static int ask_remove_eattr_entry(struct gfs2_sbd *sdp,
return 1;
}
-static int ask_remove_eattr(struct gfs2_inode *ip,
- enum update_flags *need_update)
+static int ask_remove_eattr(struct gfs2_inode *ip)
{
errors_found++;
if (query(&opts, _("Remove the bad Extended Attribute? (y/n) "))) {
errors_corrected++;
ip->i_di.di_eattr = 0;
- *need_update = updated;
+ bmodified(ip->i_bh);
log_err( _("Bad Extended Attribute removed.\n"));
} else
log_err( _("Bad Extended Attribute not removed.\n"));
@@ -76,13 +76,12 @@ static int ask_remove_eattr(struct gfs2_inode *ip,
static int check_eattr_indir(struct gfs2_inode *ip, uint64_t block,
uint64_t parent, struct gfs2_buffer_head **bh,
- enum update_flags *need_update, void *private)
+ void *private)
{
struct gfs2_sbd *sbp = ip->i_sbd;
struct gfs2_block_query q;
struct gfs2_buffer_head *indir_bh = NULL;
- *need_update = not_updated;
if(gfs2_check_range(sbp, block)) {
log_err( _("Extended attributes indirect block #%llu"
" (0x%llx) for inode #%llu"
@@ -91,7 +90,7 @@ static int check_eattr_indir(struct gfs2_inode *ip, uint64_t block,
(unsigned long long)block,
(unsigned long long)ip->i_di.di_num.no_addr,
(unsigned long long)ip->i_di.di_num.no_addr);
- return ask_remove_eattr(ip, need_update);
+ return ask_remove_eattr(ip);
}
else if (gfs2_block_check(sbp, bl, block, &q)) {
stack;
@@ -105,7 +104,7 @@ static int check_eattr_indir(struct gfs2_inode *ip, uint64_t block,
(unsigned long long)block,
(unsigned long long)ip->i_di.di_num.no_addr,
(unsigned long long)ip->i_di.di_num.no_addr);
- return ask_remove_eattr(ip, need_update);
+ return ask_remove_eattr(ip);
}
else
indir_bh = bread(&sbp->buf_list, block);
@@ -116,7 +115,7 @@ static int check_eattr_indir(struct gfs2_inode *ip, uint64_t block,
static int check_eattr_leaf(struct gfs2_inode *ip, uint64_t block,
uint64_t parent, struct gfs2_buffer_head **bh,
- enum update_flags *need_update, void *private)
+ void *private)
{
struct gfs2_sbd *sbp = ip->i_sbd;
struct gfs2_block_query q;
@@ -126,7 +125,7 @@ static int check_eattr_leaf(struct gfs2_inode *ip, uint64_t block,
" (0x%llx) out of range.\n"),
(unsigned long long)ip->i_di.di_num.no_addr,
(unsigned long long)ip->i_di.di_num.no_addr);
- return ask_remove_eattr(ip, need_update);
+ return ask_remove_eattr(ip);
}
else if (gfs2_block_check(sbp, bl, block, &q)) {
stack;
@@ -137,7 +136,7 @@ static int check_eattr_leaf(struct gfs2_inode *ip, uint64_t block,
" (0x%llx) invalid.\n"),
(unsigned long long)ip->i_di.di_num.no_addr,
(unsigned long long)ip->i_di.di_num.no_addr);
- return ask_remove_eattr(ip, need_update);
+ return ask_remove_eattr(ip);
}
else
*bh = bread(&sbp->buf_list, block);
@@ -215,8 +214,7 @@ static int check_eattr_entry(struct gfs2_inode *ip,
static int check_eattr_extentry(struct gfs2_inode *ip, uint64_t *ea_ptr,
struct gfs2_buffer_head *leaf_bh,
struct gfs2_ea_header *ea_hdr,
- struct gfs2_ea_header *ea_hdr_prev,
- enum update_flags *want_updated, void *private)
+ struct gfs2_ea_header *ea_hdr_prev, void *private)
{
struct gfs2_block_query q;
struct gfs2_sbd *sbp = ip->i_sbd;
@@ -246,7 +244,6 @@ int pass1c(struct gfs2_sbd *sbp)
int error = 0;
osi_list_t *tmp, *x;
struct special_blocks *ea_block;
- enum update_flags want_updated = not_updated;
pass1c_fxns.check_eattr_indir = &check_eattr_indir;
pass1c_fxns.check_eattr_leaf = &check_eattr_leaf;
@@ -273,18 +270,15 @@ int pass1c(struct gfs2_sbd *sbp)
(unsigned long long)ip->i_di.di_eattr,
(unsigned long long)ip->i_di.di_eattr);
/* FIXME: Handle walking the eattr here */
- error = check_inode_eattr(ip, &want_updated,
- &pass1c_fxns);
+ error = check_inode_eattr(ip, &pass1c_fxns);
if(error < 0) {
stack;
- brelse(bh, not_updated);
+ brelse(bh);
return FSCK_ERROR;
}
-
- fsck_inode_put(ip, want_updated); /* dinode_out,
- brelse, free */
+ fsck_inode_put(ip); /* dinode_out, brelse, free */
} else {
- brelse(bh, want_updated);
+ brelse(bh);
}
}
return FSCK_OK;
diff --git a/gfs2/fsck/pass2.c b/gfs2/fsck/pass2.c
index a7ac70e..e9c49c6 100644
--- a/gfs2/fsck/pass2.c
+++ b/gfs2/fsck/pass2.c
@@ -78,18 +78,16 @@ static int set_dotdot_dir(struct gfs2_sbd *sbp, uint64_t childblock,
}
static int check_eattr_indir(struct gfs2_inode *ip, uint64_t block,
- uint64_t parent, struct gfs2_buffer_head **bh,
- enum update_flags *want_updated, void *private)
+ uint64_t parent, struct gfs2_buffer_head **bh,
+ void *private)
{
- *want_updated = not_updated;
*bh = bread(&ip->i_sbd->buf_list, block);
return 0;
}
static int check_eattr_leaf(struct gfs2_inode *ip, uint64_t block,
uint64_t parent, struct gfs2_buffer_head **bh,
- enum update_flags *want_updated, void *private)
+ void *private)
{
- *want_updated = not_updated;
*bh = bread(&ip->i_sbd->buf_list, block);
return 0;
}
@@ -157,7 +155,7 @@ struct metawalk_fxns pass2_fxns_delete = {
static int check_dentry(struct gfs2_inode *ip, struct gfs2_dirent *dent,
struct gfs2_dirent *prev_de,
struct gfs2_buffer_head *bh, char *filename,
- enum update_flags *update, uint16_t *count, void *priv)
+ uint16_t *count, void *priv)
{
struct gfs2_sbd *sbp = ip->i_sbd;
struct gfs2_block_query q = {0};
@@ -234,7 +232,7 @@ static int check_dentry(struct gfs2_inode *ip, struct gfs2_dirent *dent,
errors_corrected++;
log_err( _("Clearing %s\n"), tmp_name);
dirent2_del(ip, bh, prev_de, dent);
- *update = updated;
+ bmodified(bh);
return 1;
} else {
log_err( _("Directory entry to out of range block remains\n"));
@@ -258,14 +256,14 @@ static int check_dentry(struct gfs2_inode *ip, struct gfs2_dirent *dent,
if(query(&opts, _("Delete inode containing bad blocks? (y/n)"))) {
errors_corrected++;
entry_ip = fsck_load_inode(sbp, de->de_inum.no_addr);
- check_inode_eattr(entry_ip, update,
- &pass2_fxns_delete);
+ check_inode_eattr(entry_ip, &pass2_fxns_delete);
check_metatree(entry_ip, &pass2_fxns_delete);
- fsck_inode_put(entry_ip, updated);
+ bmodified(entry_ip->i_bh);
+ fsck_inode_put(entry_ip);
dirent2_del(ip, bh, prev_de, dent);
gfs2_block_set(sbp, bl, de->de_inum.no_addr,
gfs2_block_free);
- *update = updated;
+ bmodified(bh);
log_warn( _("The inode containing bad blocks was "
"deleted.\n"));
return 1;
@@ -299,7 +297,7 @@ static int check_dentry(struct gfs2_inode *ip, struct gfs2_dirent *dent,
errors_corrected++;
dirent2_del(ip, bh, prev_de, dent);
- *update = updated;
+ bmodified(bh);
log_warn( _("Directory entry '%s' cleared\n"), tmp_name);
/* If it was previously marked invalid (i.e. known
to be bad, not just a free block, etc.) then
@@ -310,15 +308,16 @@ static int check_dentry(struct gfs2_inode *ip, struct gfs2_dirent *dent,
/* Now try to clear the dinode, if it is an dinode */
bhi = bread(&sbp->buf_list, de->de_inum.no_addr);
error = gfs2_check_meta(bhi, GFS2_METATYPE_DI);
- brelse(bhi, updated);
+ bmodified(bhi);
+ brelse(bhi);
if (error)
return 1; /* not a dinode: nothing to delete */
entry_ip = fsck_load_inode(sbp, de->de_inum.no_addr);
- check_inode_eattr(entry_ip, update,
- &pass2_fxns_delete);
+ check_inode_eattr(entry_ip, &pass2_fxns_delete);
check_metatree(entry_ip, &pass2_fxns_delete);
- fsck_inode_put(entry_ip, updated);
+ bmodified(entry_ip->i_bh);
+ fsck_inode_put(entry_ip);
gfs2_block_set(sbp, bl, de->de_inum.no_addr,
gfs2_block_free);
@@ -347,11 +346,11 @@ static int check_dentry(struct gfs2_inode *ip, struct gfs2_dirent *dent,
if(query(&opts, _("Clear stale directory entry? (y/n) "))) {
errors_corrected++;
entry_ip = fsck_load_inode(sbp, de->de_inum.no_addr);
- check_inode_eattr(entry_ip, update, &clear_eattrs);
- fsck_inode_put(entry_ip, not_updated);
+ check_inode_eattr(entry_ip, &clear_eattrs);
+ fsck_inode_put(entry_ip);
dirent2_del(ip, bh, prev_de, dent);
- *update = updated;
+ bmodified(bh);
log_err( _("Stale directory entry deleted\n"));
return 1;
} else {
@@ -375,12 +374,11 @@ static int check_dentry(struct gfs2_inode *ip, struct gfs2_dirent *dent,
errors_corrected++;
entry_ip = fsck_load_inode(sbp, de->de_inum.no_addr);
- check_inode_eattr(entry_ip, update,
- &clear_eattrs);
- fsck_inode_put(entry_ip, not_updated);
+ check_inode_eattr(entry_ip, &clear_eattrs);
+ fsck_inode_put(entry_ip);
dirent2_del(ip, bh, prev_de, dent);
- *update = updated;
+ bmodified(bh);
return 1;
} else {
log_err( _("Duplicate '.' entry remains\n"));
@@ -413,12 +411,11 @@ static int check_dentry(struct gfs2_inode *ip, struct gfs2_dirent *dent,
if(query(&opts, _("Remove '.' reference? (y/n) "))) {
errors_corrected++;
entry_ip = fsck_load_inode(sbp, de->de_inum.no_addr);
- check_inode_eattr(entry_ip, update,
- &clear_eattrs);
- fsck_inode_put(entry_ip, not_updated);
+ check_inode_eattr(entry_ip, &clear_eattrs);
+ fsck_inode_put(entry_ip);
dirent2_del(ip, bh, prev_de, dent);
- *update = updated;
+ bmodified(bh);
return 1;
} else {
@@ -451,12 +448,11 @@ static int check_dentry(struct gfs2_inode *ip, struct gfs2_dirent *dent,
errors_corrected++;
entry_ip = fsck_load_inode(sbp, de->de_inum.no_addr);
- check_inode_eattr(entry_ip, update,
- &clear_eattrs);
- fsck_inode_put(entry_ip, not_updated);
+ check_inode_eattr(entry_ip, &clear_eattrs);
+ fsck_inode_put(entry_ip);
dirent2_del(ip, bh, prev_de, dent);
- *update = 1;
+ bmodified(bh);
return 1;
} else {
log_err( _("Duplicate '..' entry remains\n"));
@@ -479,12 +475,11 @@ static int check_dentry(struct gfs2_inode *ip, struct gfs2_dirent *dent,
if(query(&opts, _("Clear bad '..' directory entry? (y/n) "))) {
errors_corrected++;
entry_ip = fsck_load_inode(sbp, de->de_inum.no_addr);
- check_inode_eattr(entry_ip, update,
- &clear_eattrs);
- fsck_inode_put(entry_ip, not_updated);
+ check_inode_eattr(entry_ip, &clear_eattrs);
+ fsck_inode_put(entry_ip);
dirent2_del(ip, bh, prev_de, dent);
- *update = 1;
+ bmodified(bh);
return 1;
} else {
log_err( _("Bad '..' directory entry remains\n"));
@@ -507,7 +502,6 @@ static int check_dentry(struct gfs2_inode *ip, struct gfs2_dirent *dent,
ds->dotdotdir = 1;
increment_link(sbp, de->de_inum.no_addr);
- *update = (opts.no ? not_updated : updated);
(*count)++;
ds->entry_count++;
return 0;
@@ -518,7 +512,6 @@ static int check_dentry(struct gfs2_inode *ip, struct gfs2_dirent *dent,
if(q.block_type != gfs2_inode_dir) {
log_debug( _("Found non-dir inode dentry\n"));
increment_link(sbp, de->de_inum.no_addr);
- *update = (opts.no ? not_updated : updated);
(*count)++;
ds->entry_count++;
return 0;
@@ -533,8 +526,7 @@ static int check_dentry(struct gfs2_inode *ip, struct gfs2_dirent *dent,
errors_found++;
if(query(&opts, _("Clear hard link to directory? (y/n) "))) {
errors_corrected++;
- *update = 1;
-
+ bmodified(bh);
dirent2_del(ip, bh, prev_de, dent);
log_warn( _("Directory entry %s cleared\n"), filename);
@@ -551,7 +543,6 @@ static int check_dentry(struct gfs2_inode *ip, struct gfs2_dirent *dent,
return -1;
}
increment_link(sbp, de->de_inum.no_addr);
- *update = (opts.no ? not_updated : updated);
(*count)++;
ds->entry_count++;
/* End of checks */
@@ -581,7 +572,6 @@ static int check_system_dir(struct gfs2_inode *sysinode, const char *dirname,
char *filename;
int filename_len;
char tmp_name[256];
- enum update_flags update = not_updated;
int error = 0;
log_info( _("Checking system directory inode '%s'\n"), dirname);
@@ -609,7 +599,7 @@ static int check_system_dir(struct gfs2_inode *sysinode, const char *dirname,
gfs2_block_set(sysinode->i_sbd, bl, iblock, gfs2_meta_inval);
bh = bhold(sysinode->i_bh);
- if(check_inode_eattr(sysinode, &update, &pass2_fxns)) {
+ if(check_inode_eattr(sysinode, &pass2_fxns)) {
stack;
return -1;
}
@@ -639,7 +629,7 @@ static int check_system_dir(struct gfs2_inode *sysinode, const char *dirname,
sysinode->i_di.di_num.no_addr);
ds.entry_count++;
free(filename);
- update = 1;
+ bmodified(sysinode->i_bh);
} else
log_err( _("The directory was not fixed.\n"));
}
@@ -656,8 +646,8 @@ static int check_system_dir(struct gfs2_inode *sysinode, const char *dirname,
(unsigned long long)sysinode->i_di.di_num.no_addr)) {
errors_corrected++;
sysinode->i_di.di_entries = ds.entry_count;
+ bmodified(sysinode->i_bh);
log_warn( _("Entries updated\n"));
- update = 1;
} else {
log_err( _("Entries for inode %llu (0x%llx"
") left out of sync\n"),
@@ -668,7 +658,9 @@ static int check_system_dir(struct gfs2_inode *sysinode, const char *dirname,
}
}
- brelse(bh, opts.no ? not_updated : update);
+ if (!opts.no)
+ bmodified(bh);
+ brelse(bh);
return 0;
}
@@ -707,7 +699,6 @@ int pass2(struct gfs2_sbd *sbp)
int filename_len;
char tmp_name[256];
int error = 0;
- enum update_flags need_update = NOT_UPDATED;
struct dup_blocks *b;
/* Check all the system directory inodes. */
@@ -730,7 +721,6 @@ int pass2(struct gfs2_sbd *sbp)
log_info( _("Checking directory inodes.\n"));
/* Grab each directory inode, and run checks on it */
for(i = 0; i < last_fs_block; i++) {
- need_update = 0;
warm_fuzzy_stuff(i);
if (skip_this_pass || fsck_abort) /* if asked to skip the rest */
return FSCK_OK;
@@ -758,11 +748,11 @@ int pass2(struct gfs2_sbd *sbp)
* is valid */
ip = fsck_load_inode(sbp, i);
if(check_metatree(ip, &pass2_fxns)) {
- fsck_inode_put(ip, not_updated);
+ fsck_inode_put(ip);
stack;
return FSCK_ERROR;
}
- fsck_inode_put(ip, not_updated);
+ fsck_inode_put(ip);
}
error = check_dir(sbp, i, &pass2_fxns);
if(error < 0) {
@@ -836,7 +826,7 @@ int pass2(struct gfs2_sbd *sbp)
ds.entry_count++;
free(filename);
log_err( _("The directory was fixed.\n"));
- need_update = UPDATED;
+ bmodified(ip->i_bh);
} else {
log_err( _("The directory was not fixed.\n"));
}
@@ -853,13 +843,12 @@ int pass2(struct gfs2_sbd *sbp)
_("Fix the entry count? (y/n) "))) {
errors_corrected++;
ip->i_di.di_entries = ds.entry_count;
- need_update = UPDATED;
+ bmodified(ip->i_bh);
} else {
log_err( _("The entry count was not fixed.\n"));
}
}
- fsck_inode_put(ip, need_update); /* does a gfs2_dinode_out,
- brelse */
+ fsck_inode_put(ip); /* does a gfs2_dinode_out, brelse */
}
/* Now that we've deleted the inodes marked "bad" we can safely
get rid of the duplicate block list. If we do it any sooner,
diff --git a/gfs2/fsck/pass3.c b/gfs2/fsck/pass3.c
index 27d0594..09da4c6 100644
--- a/gfs2/fsck/pass3.c
+++ b/gfs2/fsck/pass3.c
@@ -34,15 +34,15 @@ static int attach_dotdot_to(struct gfs2_sbd *sbp, uint64_t newdotdot,
filename_len = strlen("..");
if(!(filename = malloc((sizeof(char) * filename_len) + 1))) {
log_err( _("Unable to allocate name\n"));
- fsck_inode_put(ip, not_updated);
- fsck_inode_put(pip, not_updated);
+ fsck_inode_put(ip);
+ fsck_inode_put(pip);
stack;
return -1;
}
if(!memset(filename, 0, (sizeof(char) * filename_len) + 1)) {
log_err( _("Unable to zero name\n"));
- fsck_inode_put(ip, not_updated);
- fsck_inode_put(pip, not_updated);
+ fsck_inode_put(ip);
+ fsck_inode_put(pip);
stack;
return -1;
}
@@ -53,8 +53,10 @@ static int attach_dotdot_to(struct gfs2_sbd *sbp, uint64_t newdotdot,
decrement_link(sbp, olddotdot);
dir_add(ip, filename, filename_len, &pip->i_di.di_num, DT_DIR);
increment_link(sbp, newdotdot);
- fsck_inode_put(ip, updated);
- fsck_inode_put(pip, updated);
+ bmodified(ip->i_bh);
+ fsck_inode_put(ip);
+ bmodified(pip->i_bh);
+ fsck_inode_put(pip);
return 0;
}
@@ -259,7 +261,7 @@ int pass3(struct gfs2_sbd *sbp)
gfs2_block_set(sbp, bl,
di->dinode,
gfs2_block_free);
- fsck_inode_put(ip, not_updated);
+ fsck_inode_put(ip);
break;
} else {
log_err( _("Zero-size unlinked directory remains\n"));
@@ -269,15 +271,16 @@ int pass3(struct gfs2_sbd *sbp)
if(query(&opts, _("Add unlinked directory to lost+found? (y/n) "))) {
errors_corrected++;
if(add_inode_to_lf(ip)) {
- fsck_inode_put(ip, not_updated);
+ fsck_inode_put(ip);
stack;
return FSCK_ERROR;
}
log_warn( _("Directory relinked to lost+found\n"));
- fsck_inode_put(ip, updated);
+ bmodified(ip->i_bh);
+ fsck_inode_put(ip);
} else {
log_err( _("Unlinked directory remains unlinked\n"));
- fsck_inode_put(ip, not_updated);
+ fsck_inode_put(ip);
}
break;
}
diff --git a/gfs2/fsck/pass4.c b/gfs2/fsck/pass4.c
index 5714a73..0ebb5ce 100644
--- a/gfs2/fsck/pass4.c
+++ b/gfs2/fsck/pass4.c
@@ -31,6 +31,7 @@ static int fix_inode_count(struct gfs2_sbd *sbp, struct inode_info *ii,
if(ip->i_di.di_nlink == ii->counted_links)
return 0;
ip->i_di.di_nlink = ii->counted_links;
+ bmodified(ip->i_bh);
log_debug( _("Changing inode %llu (0x%llx) to have %u links\n"),
(unsigned long long)ip->i_di.di_num.no_addr,
@@ -45,14 +46,12 @@ static int scan_inode_list(struct gfs2_sbd *sbp, osi_list_t *list) {
struct gfs2_inode *ip;
int lf_addition = 0;
struct gfs2_block_query q;
- enum update_flags f;
/* FIXME: should probably factor this out into a generic
* scanning fxn */
osi_list_foreach(tmp, list) {
if (skip_this_pass || fsck_abort) /* if asked to skip the rest */
return 0;
- f = not_updated;
if(!(ii = osi_list_entry(tmp, struct inode_info, list))) {
log_crit( _("osi_list_foreach broken in scan_info_list!!\n"));
exit(FSCK_ERROR);
@@ -76,10 +75,11 @@ static int scan_inode_list(struct gfs2_sbd *sbp, osi_list_t *list) {
_("Delete unlinked inode with bad blocks? (y/n) "))) {
errors_corrected++;
ip = fsck_load_inode(sbp, ii->inode);
- check_inode_eattr(ip, &f,
+ check_inode_eattr(ip,
&pass4_fxns_delete);
check_metatree(ip, &pass4_fxns_delete);
- fsck_inode_put(ip, updated);
+ bmodified(ip->i_bh);
+ fsck_inode_put(ip);
gfs2_block_set(sbp, bl, ii->inode,
gfs2_block_free);
continue;
@@ -99,17 +99,17 @@ static int scan_inode_list(struct gfs2_sbd *sbp, osi_list_t *list) {
ip = fsck_load_inode(sbp, ii->inode);
if(query(&opts, _("Delete unlinked inode "
"? (y/n) "))) {
- check_inode_eattr(ip, &f,
+ check_inode_eattr(ip,
&pass4_fxns_delete);
check_metatree(ip, &pass4_fxns_delete);
- fsck_inode_put(ip, updated);
+ bmodified(ip->i_bh);
gfs2_block_set(sbp, bl, ii->inode,
gfs2_block_free);
log_err( _("The inode was deleted\n"));
} else {
log_err( _("The inode was not "
"deleted\n"));
- fsck_inode_put(ip, not_updated);
+ fsck_inode_put(ip);
}
continue;
}
@@ -125,7 +125,7 @@ static int scan_inode_list(struct gfs2_sbd *sbp, osi_list_t *list) {
errors_corrected++;
gfs2_block_set(sbp, bl, ii->inode,
gfs2_block_free);
- fsck_inode_put(ip, not_updated);
+ fsck_inode_put(ip);
continue;
}
@@ -133,10 +133,10 @@ static int scan_inode_list(struct gfs2_sbd *sbp, osi_list_t *list) {
errors_found++;
if(query(&opts, _("Add unlinked inode to lost+found? (y/n)"))) {
errors_corrected++;
- f = updated;
+ bmodified(ip->i_bh);
if(add_inode_to_lf(ip)) {
stack;
- fsck_inode_put(ip, not_updated);
+ fsck_inode_put(ip);
return -1;
}
else {
@@ -145,7 +145,7 @@ static int scan_inode_list(struct gfs2_sbd *sbp, osi_list_t *list) {
}
} else
log_err( _("Unlinked inode left unlinked\n"));
- fsck_inode_put(ip, f);
+ fsck_inode_put(ip);
} /* if(ii->counted_links == 0) */
else if(ii->link_count != ii->counted_links) {
log_err( _("Link count inconsistent for inode %" PRIu64
@@ -159,7 +159,8 @@ static int scan_inode_list(struct gfs2_sbd *sbp, osi_list_t *list) {
errors_corrected++;
ip = fsck_load_inode(sbp, ii->inode); /* bread, inode_get */
fix_inode_count(sbp, ii, ip);
- fsck_inode_put(ip, updated); /* out, brelse, free */
+ bmodified(ip->i_bh);
+ fsck_inode_put(ip); /* out, brelse, free */
log_warn( _("Link count updated for inode %"
PRIu64 " (0x%" PRIx64 ") \n"), ii->inode, ii->inode);
} else {
diff --git a/gfs2/fsck/pass5.c b/gfs2/fsck/pass5.c
index 3633d26..6d2fc33 100644
--- a/gfs2/fsck/pass5.c
+++ b/gfs2/fsck/pass5.c
@@ -150,9 +150,9 @@ static int check_block_status(struct gfs2_sbd *sbp, char *buffer, unsigned int b
return 0;
}
-static enum update_flags update_rgrp(struct gfs2_sbd *sbp, struct rgrp_list *rgp,
- uint32_t *count, struct gfs2_buffer_head **rgbh,
- struct gfs2_rgrp *rg)
+static void update_rgrp(struct gfs2_sbd *sbp, struct rgrp_list *rgp,
+ uint32_t *count, struct gfs2_buffer_head **rgbh,
+ struct gfs2_rgrp *rg)
{
uint32_t i;
struct gfs2_bitmap *bits;
@@ -166,7 +166,7 @@ static enum update_flags update_rgrp(struct gfs2_sbd *sbp, struct rgrp_list *rgp
check_block_status(sbp, rgbh[i]->b_data + bits->bi_offset,
bits->bi_len, &rg_block, rgp->ri.ri_data0, count);
if (skip_this_pass || fsck_abort) /* if asked to skip the rest */
- return 0;
+ return;
}
/* actually adjust counters and write out to disk */
@@ -199,11 +199,9 @@ static enum update_flags update_rgrp(struct gfs2_sbd *sbp, struct rgrp_list *rgp
log_warn( _("Resource group counts updated\n"));
/* write out the rgrp */
gfs2_rgrp_out(rg, rgbh[0]->b_data);
- return updated;
} else
log_err( _("Resource group counts left inconsistent\n"));
}
- return not_updated;
}
/**
@@ -223,8 +221,6 @@ int pass5(struct gfs2_sbd *sbp)
/* Reconcile RG bitmaps with fsck bitmap */
for(tmp = sbp->rglist.next; tmp != &sbp->rglist; tmp = tmp->next){
- enum update_flags f;
-
if (skip_this_pass || fsck_abort) /* if asked to skip the rest */
return FSCK_OK;
log_info( _("Verifying Resource Group #%" PRIu64 "\n"), rg_count);
@@ -247,8 +243,8 @@ int pass5(struct gfs2_sbd *sbp)
}
rg_count++;
/* Compare the bitmaps and report the differences */
- f = update_rgrp(sbp, rgd, count, rgbh, &rg);
- gfs2_rgrp_relse(rgd, f, rgbh);
+ update_rgrp(sbp, rgd, count, rgbh, &rg);
+ gfs2_rgrp_relse(rgd, rgbh);
free(rgbh);
}
/* Fix up superblock info based on this - don't think there's
diff --git a/gfs2/fsck/rgrepair.c b/gfs2/fsck/rgrepair.c
index 5d40a17..e835b84 100644
--- a/gfs2/fsck/rgrepair.c
+++ b/gfs2/fsck/rgrepair.c
@@ -53,8 +53,7 @@ static void find_journaled_rgs(struct gfs2_sbd *sdp)
ip = sdp->md.journal[j];
jblocks = ip->i_di.di_size / sdp->sd_sb.sb_bsize;
for (b = 0; b < jblocks; b++) {
- block_map(ip, b, &new, &dblock, &extlen, 0,
- not_updated);
+ block_map(ip, b, &new, &dblock, &extlen, 0);
if (!dblock)
break;
bh = bread(&sdp->buf_list, dblock);
@@ -63,7 +62,7 @@ static void find_journaled_rgs(struct gfs2_sbd *sdp)
"0x%" PRIx64 "\n"), dblock);
gfs2_special_set(&false_rgrps, dblock);
}
- brelse(bh, not_updated);
+ brelse(bh);
}
}
}
@@ -165,7 +164,7 @@ static int gfs2_rindex_rebuild(struct gfs2_sbd *sdp, osi_list_t *ret_list,
number_of_rgs++;
blk += 250; /* skip ahead for performance */
}
- brelse(bh, not_updated);
+ brelse(bh);
}
number_of_rgs = 0;
gfs2_special_free(&false_rgrps);
@@ -211,7 +210,7 @@ static int gfs2_rindex_rebuild(struct gfs2_sbd *sdp, osi_list_t *ret_list,
log_debug( _("Block 0x%" PRIx64 "\n"), blk);
bh = bread(&sdp->buf_list, blk);
rg_was_fnd = (!gfs2_check_meta(bh, GFS2_METATYPE_RG));
- brelse(bh, not_updated);
+ brelse(bh);
/* Allocate a new RG and index. */
calc_rgd = malloc(sizeof(struct rgrp_list));
if (!calc_rgd) {
@@ -246,7 +245,7 @@ static int gfs2_rindex_rebuild(struct gfs2_sbd *sdp, osi_list_t *ret_list,
bh = bread(&sdp->buf_list, fwd_block);
bitmap_was_fnd =
(!gfs2_check_meta(bh, GFS2_METATYPE_RB));
- brelse(bh, not_updated);
+ brelse(bh);
if (bitmap_was_fnd) /* if a bitmap */
calc_rgd->ri.ri_length++;
else
@@ -407,7 +406,8 @@ static int rewrite_rg_block(struct gfs2_sbd *sdp, struct rgrp_list *rgd,
rg->rg_free = rgd->ri.ri_data;
gfs2_rgrp_out(rg, rgbh[x]->b_data);
}
- brelse(rgbh[x], updated);
+ bmodified(rgbh[x]);
+ brelse(rgbh[x]);
return 0;
}
return 1;
@@ -586,7 +586,7 @@ int rg_repair(struct gfs2_sbd *sdp, int trust_lvl, int *rg_count)
&rgrp);
}
else {
- gfs2_rgrp_relse(rgd, not_updated, rgbh);
+ gfs2_rgrp_relse(rgd, rgbh);
free(rgbh);
break;
}
diff --git a/gfs2/libgfs2/buf.c b/gfs2/libgfs2/buf.c
index 5461239..ac15fd6 100644
--- a/gfs2/libgfs2/buf.c
+++ b/gfs2/libgfs2/buf.c
@@ -178,12 +178,15 @@ struct gfs2_buffer_head *bhold(struct gfs2_buffer_head *bh)
return bh;
}
-void brelse(struct gfs2_buffer_head *bh, enum update_flags is_updated)
+void bmodified(struct gfs2_buffer_head *bh)
+{
+ bh->b_changed = 1;
+}
+
+void brelse(struct gfs2_buffer_head *bh)
{
/* We can't just say b_changed = updated because we don't want to */
/* set it FALSE if it's TRUE until we write the changed data to disk. */
- if (is_updated)
- bh->b_changed = TRUE;
if (!bh->b_count) {
fprintf(stderr, "buffer count underflow for block %" PRIu64
" (0x%" PRIx64")\n", bh->b_blocknr, bh->b_blocknr);
diff --git a/gfs2/libgfs2/fs_bits.c b/gfs2/libgfs2/fs_bits.c
index 237010b..c097cd5 100644
--- a/gfs2/libgfs2/fs_bits.c
+++ b/gfs2/libgfs2/fs_bits.c
@@ -156,7 +156,8 @@ int gfs2_set_bitmap(struct gfs2_sbd *sdp, uint64_t blkno, int state)
*byte ^= cur_state << bit;
*byte |= state << bit;
- gfs2_rgrp_relse(rgd, updated, rgbh);
+ bmodified(rgbh[buf]);
+ gfs2_rgrp_relse(rgd, rgbh);
free(rgbh);
return 0;
}
@@ -219,7 +220,7 @@ int gfs2_get_bitmap(struct gfs2_sbd *sdp, uint64_t blkno,
}
if(i >= rgd->ri.ri_length){
- gfs2_rgrp_relse(rgd, not_updated, rgbh);
+ gfs2_rgrp_relse(rgd, rgbh);
return -1;
}
@@ -229,7 +230,6 @@ int gfs2_get_bitmap(struct gfs2_sbd *sdp, uint64_t blkno,
val = ((*byte >> bit) & GFS2_BIT_MASK);
if(local_rgd)
- gfs2_rgrp_relse(rgd, not_updated, rgbh);
-
+ gfs2_rgrp_relse(rgd, rgbh);
return val;
}
diff --git a/gfs2/libgfs2/fs_geometry.c b/gfs2/libgfs2/fs_geometry.c
index 12895cd..2248611 100644
--- a/gfs2/libgfs2/fs_geometry.c
+++ b/gfs2/libgfs2/fs_geometry.c
@@ -222,7 +222,8 @@ void build_rgrps(struct gfs2_sbd *sdp, int do_write)
gfs2_meta_header_out(&mh, bh->b_data);
else
gfs2_rgrp_out(&rg, bh->b_data);
- brelse(bh, updated);
+ bmodified(bh);
+ brelse(bh);
}
}
diff --git a/gfs2/libgfs2/fs_ops.c b/gfs2/libgfs2/fs_ops.c
index a8e63df..a8ba5bf 100644
--- a/gfs2/libgfs2/fs_ops.c
+++ b/gfs2/libgfs2/fs_ops.c
@@ -45,11 +45,11 @@ struct gfs2_inode *inode_get(struct gfs2_sbd *sdp, struct gfs2_buffer_head *bh)
return ip;
}
-void inode_put(struct gfs2_inode *ip, enum update_flags is_updated)
+void inode_put(struct gfs2_inode *ip)
{
- if (is_updated)
+ if (ip->i_bh->b_changed)
gfs2_dinode_out(&ip->i_di, ip->i_bh->b_data);
- brelse(ip->i_bh, is_updated);
+ brelse(ip->i_bh);
free(ip);
}
@@ -102,7 +102,7 @@ static uint64_t blk_alloc_i(struct gfs2_sbd *sdp, unsigned int type)
bn++;
}
- brelse(rgbh[block], FALSE);
+ brelse(rgbh[block]);
}
die("allocation is broken (1): %"PRIu64" %u\n",
@@ -132,11 +132,13 @@ found:
rg.rg_free--;
rl->rg_free--;
- brelse(rgbh[block], updated);
+ bmodified(rgbh[block]);
+ brelse(rgbh[block]);
rgbh[0] = bread(&sdp->buf_list, ri->ri_addr);
gfs2_rgrp_out(&rg, rgbh[0]->b_data);
- brelse(rgbh[0], updated);
+ bmodified(rgbh[0]);
+ brelse(rgbh[0]);
sdp->blks_alloced++;
free(rgbh);
@@ -169,6 +171,7 @@ static __inline__ void buffer_clear_tail(struct gfs2_sbd *sdp,
struct gfs2_buffer_head *bh, int head)
{
memset(bh->b_data + head, 0, sdp->bsize - head);
+ bmodified(bh);
}
static __inline__ void
@@ -180,6 +183,7 @@ buffer_copy_tail(struct gfs2_sbd *sdp,
sdp->bsize - from_head);
memset(to_bh->b_data + sdp->bsize + to_head - from_head, 0,
from_head - to_head);
+ bmodified(to_bh);
}
void unstuff_dinode(struct gfs2_inode *ip)
@@ -205,7 +209,8 @@ void unstuff_dinode(struct gfs2_inode *ip)
sizeof(struct gfs2_meta_header),
ip->i_bh, sizeof(struct gfs2_dinode));
- brelse(bh, updated);
+ bmodified(bh);
+ brelse(bh);
} else {
block = data_alloc(ip);
bh = bget(&sdp->buf_list, block);
@@ -213,7 +218,8 @@ void unstuff_dinode(struct gfs2_inode *ip)
buffer_copy_tail(sdp, bh, 0,
ip->i_bh, sizeof(struct gfs2_dinode));
- brelse(bh, updated);
+ bmodified(bh);
+ brelse(bh);
}
}
@@ -282,7 +288,8 @@ void build_height(struct gfs2_inode *ip, int height)
sizeof(struct gfs2_meta_header),
ip->i_bh, sizeof(struct gfs2_dinode));
- brelse(bh, updated);
+ bmodified(bh);
+ brelse(bh);
}
buffer_clear_tail(sdp, ip->i_bh, sizeof(struct gfs2_dinode));
@@ -339,14 +346,14 @@ void lookup_block(struct gfs2_inode *ip, struct gfs2_buffer_head *bh,
*block = meta_alloc(ip);
*ptr = cpu_to_be64(*block);
+ bmodified(bh);
ip->i_di.di_blocks++;
*new = 1;
}
void block_map(struct gfs2_inode *ip, uint64_t lblock, int *new,
- uint64_t *dblock, uint32_t *extlen, int prealloc,
- enum update_flags if_changed)
+ uint64_t *dblock, uint32_t *extlen, int prealloc)
{
struct gfs2_sbd *sdp = ip->i_sbd;
struct gfs2_buffer_head *bh;
@@ -388,7 +395,7 @@ void block_map(struct gfs2_inode *ip, uint64_t lblock, int *new,
for (x = 0; x < end_of_metadata; x++) {
lookup_block(ip, bh, x, mp, create, new, dblock);
- brelse(bh, if_changed);
+ brelse(bh);
if (!*dblock)
goto out;
@@ -398,6 +405,7 @@ void block_map(struct gfs2_inode *ip, uint64_t lblock, int *new,
mh.mh_magic = GFS2_MAGIC;
mh.mh_type = GFS2_METATYPE_IN;
mh.mh_format = GFS2_FORMAT_IN;
+ bmodified(bh);
gfs2_meta_header_out(&mh, bh->b_data);
} else
bh = bread(&sdp->buf_list, *dblock);
@@ -428,7 +436,7 @@ void block_map(struct gfs2_inode *ip, uint64_t lblock, int *new,
}
}
- brelse(bh, if_changed);
+ brelse(bh);
out:
free(mp);
@@ -491,7 +499,7 @@ int gfs2_readi(struct gfs2_inode *ip, void *buf,
if (!extlen)
block_map(ip, lblock, ¬_new, &dblock, &extlen,
- FALSE, not_updated);
+ FALSE);
if (dblock) {
bh = bread(&sdp->buf_list, dblock);
@@ -502,7 +510,7 @@ int gfs2_readi(struct gfs2_inode *ip, void *buf,
copy2mem(bh, &buf, o, amount);
if (bh)
- brelse(bh, not_updated);
+ brelse(bh);
copied += amount;
lblock++;
@@ -519,6 +527,7 @@ static void copy_from_mem(struct gfs2_buffer_head *bh, void **buf,
char **p = (char **)buf;
memcpy(bh->b_data + offset, *p, size);
+ bmodified(bh);
*p += size;
}
@@ -564,8 +573,7 @@ int gfs2_writei(struct gfs2_inode *ip, void *buf,
if (!extlen) {
new = TRUE;
- block_map(ip, lblock, &new, &dblock, &extlen, FALSE,
- updated);
+ block_map(ip, lblock, &new, &dblock, &extlen, FALSE);
}
if (new) {
@@ -580,7 +588,8 @@ int gfs2_writei(struct gfs2_inode *ip, void *buf,
} else
bh = bread(&sdp->buf_list, dblock);
copy_from_mem(bh, &buf, o, amount);
- brelse(bh, updated);
+ bmodified(bh);
+ brelse(bh);
copied += amount;
lblock++;
@@ -606,7 +615,7 @@ struct gfs2_buffer_head *get_file_buf(struct gfs2_inode *ip, uint64_t lbn,
if (inode_is_stuffed(ip))
unstuff_dinode(ip);
- block_map(ip, lbn, &new, &dbn, NULL, prealloc, updated);
+ block_map(ip, lbn, &new, &dbn, NULL, prealloc);
if (!dbn)
die("get_file_buf\n");
@@ -674,7 +683,7 @@ static int dirent_alloc(struct gfs2_inode *dip, struct gfs2_buffer_head *bh,
if (!entries) {
dent->de_rec_len = cpu_to_be16(dip->i_sbd->bsize - offset);
dent->de_name_len = cpu_to_be16(name_len);
-
+ bmodified(bh);
*dent_out = dent;
return 0;
}
@@ -703,12 +712,14 @@ static int dirent_alloc(struct gfs2_inode *dip, struct gfs2_buffer_head *bh,
dent->de_rec_len = cpu_to_be16(cur_rec_len - new_rec_len);
*dent_out = new;
+ bmodified(bh);
return 0;
}
dent->de_name_len = cpu_to_be16(name_len);
*dent_out = dent;
+ bmodified(bh);
return 0;
}
} while (gfs2_dirent_next(dip, bh, &dent) == 0);
@@ -721,6 +732,8 @@ void dirent2_del(struct gfs2_inode *dip, struct gfs2_buffer_head *bh,
{
uint16_t cur_rec_len, prev_rec_len;
+ bmodified(bh);
+ bmodified(dip->i_bh);
if (dip->i_di.di_entries)
dip->i_di.di_entries--;
if (!prev) {
@@ -863,8 +876,9 @@ static void dir_split_leaf(struct gfs2_inode *dip, uint32_t lindex, uint64_t lea
dip->i_di.di_blocks++;
- brelse(obh, not_updated);
- brelse(nbh, updated);
+ brelse(obh);
+ bmodified(nbh);
+ brelse(nbh);
}
static void dir_double_exhash(struct gfs2_inode *dip)
@@ -928,7 +942,7 @@ int gfs2_get_leaf(struct gfs2_inode *dip, uint64_t leaf_no,
return error;
error = gfs2_check_meta(*bhp, GFS2_METATYPE_LF);
if(error)
- brelse(*bhp, not_updated);
+ brelse(*bhp);
return error;
}
@@ -1000,18 +1014,18 @@ static void dir_e_add(struct gfs2_inode *dip, const char *filename, int len,
if (dirent_alloc(dip, bh, len, &dent)) {
if (be16_to_cpu(leaf->lf_depth) < dip->i_di.di_depth) {
- brelse(bh, not_updated);
+ brelse(bh);
dir_split_leaf(dip, lindex, leaf_no);
goto restart;
} else if (dip->i_di.di_depth < GFS2_DIR_MAX_DEPTH) {
- brelse(bh, not_updated);
+ brelse(bh);
dir_double_exhash(dip);
goto restart;
} else if (leaf->lf_next) {
leaf_no = be64_to_cpu(leaf->lf_next);
- brelse(bh, not_updated);
+ brelse(bh);
continue;
} else {
@@ -1033,7 +1047,8 @@ static void dir_e_add(struct gfs2_inode *dip, const char *filename, int len,
dirent_alloc(dip, nbh, len, &dent);
dip->i_di.di_blocks++;
- brelse(bh, updated);
+ bmodified(bh);
+ brelse(bh);
bh = nbh;
leaf = nleaf;
}
@@ -1047,10 +1062,11 @@ static void dir_e_add(struct gfs2_inode *dip, const char *filename, int len,
leaf->lf_entries = be16_to_cpu(leaf->lf_entries) + 1;
leaf->lf_entries = cpu_to_be16(leaf->lf_entries);
- brelse(bh, updated);
+ bmodified(bh);
+ brelse(bh);
dip->i_di.di_entries++;
-
+ bmodified(dip->i_bh);
return;
}
}
@@ -1096,7 +1112,8 @@ static void dir_make_exhash(struct gfs2_inode *dip)
dent->de_rec_len = cpu_to_be16(dent->de_rec_len +
sizeof(struct gfs2_dinode) - sizeof(struct gfs2_leaf));
- brelse(bh, updated);
+ /* no need to: bmodified(bh); (buffer_copy_tail does it) */
+ brelse(bh);
buffer_clear_tail(sdp, dip->i_bh, sizeof(struct gfs2_dinode));
@@ -1109,6 +1126,7 @@ static void dir_make_exhash(struct gfs2_inode *dip)
dip->i_di.di_blocks++;
dip->i_di.di_flags |= GFS2_DIF_EXHASH;
dip->i_di.di_payload_format = 0;
+ /* no need: bmodified(dip->i_bh); buffer_clear_tail does it. */
for (x = sdp->sd_hash_ptrs, y = -1; x; x >>= 1, y++) ;
dip->i_di.di_depth = y;
@@ -1132,6 +1150,7 @@ static void dir_l_add(struct gfs2_inode *dip, const char *filename, int len,
memcpy((char *)(dent + 1), filename, len);
dip->i_di.di_entries++;
+ bmodified(dip->i_bh);
}
void dir_add(struct gfs2_inode *dip, const char *filename, int len,
@@ -1228,6 +1247,7 @@ struct gfs2_inode *createi(struct gfs2_inode *dip, const char *filename,
bh = init_dinode(sdp, &inum, mode, flags, &dip->i_di.di_num);
ip = inode_get(sdp, bh);
+ bmodified(bh);
}
return ip;
}
@@ -1345,7 +1365,7 @@ static int linked_leaf_search(struct gfs2_inode *dip, const char *filename,
/* Find the entry */
do{
if (bh)
- brelse(bh, not_updated);
+ brelse(bh);
bh = bh_next;
@@ -1359,14 +1379,14 @@ static int linked_leaf_search(struct gfs2_inode *dip, const char *filename,
break;
default:
- brelse(bh, not_updated);
+ brelse(bh);
return error;
}
error = get_next_leaf(dip, bh, &bh_next);
} while (!error);
- brelse(bh, not_updated);
+ brelse(bh);
return error;
}
@@ -1394,7 +1414,7 @@ static int dir_e_search(struct gfs2_inode *dip, const char *filename,
if (type)
*type = be16_to_cpu(dent->de_type);
- brelse(bh, not_updated);
+ brelse(bh);
return 0;
}
@@ -1425,7 +1445,7 @@ static int dir_l_search(struct gfs2_inode *dip, const char *filename,
if(type)
*type = be16_to_cpu(dent->de_type);
}
- brelse(dibh, not_updated);
+ brelse(dibh);
return error;
}
@@ -1477,11 +1497,11 @@ static int dir_e_del(struct gfs2_inode *dip, const char *filename, int len)
error = leaf_search(dip, bh, filename, len, &cur, &prev);
if (error) {
if(error != -ENOENT){
- brelse(bh, updated);
+ brelse(bh);
return -1;
}
leaf_no = be64_to_cpu(((struct gfs2_leaf *)bh->b_data)->lf_next);
- brelse(bh, updated);
+ brelse(bh);
} else
found = 1;
}
@@ -1492,7 +1512,7 @@ static int dir_e_del(struct gfs2_inode *dip, const char *filename, int len)
if (bh) {
dirent2_del(dip, bh, prev, cur);
- brelse(bh, updated);
+ brelse(bh);
}
return 0;
}
@@ -1516,7 +1536,7 @@ static int dir_l_del(struct gfs2_inode *dip, struct gfs2_buffer_head *dibh,
error = leaf_search(dip, dibh, filename, len, &cur, &prev);
if (error) {
if (got_buf)
- brelse(dibh, not_updated);
+ brelse(dibh);
if (error == -ENOENT)
return 1;
else
@@ -1524,8 +1544,10 @@ static int dir_l_del(struct gfs2_inode *dip, struct gfs2_buffer_head *dibh,
}
dirent2_del(dip, dibh, prev, cur);
- if (got_buf)
- brelse(dibh, updated);
+ if (got_buf) {
+ bmodified(dibh);
+ brelse(dibh);
+ }
return 0;
}
@@ -1552,7 +1574,7 @@ int gfs2_dirent_del(struct gfs2_inode *dip, struct gfs2_buffer_head *bh,
error = dir_e_del(dip, filename, len);
else
error = dir_l_del(dip, bh, filename, len);
-
+ bmodified(dip->i_bh);
return error;
}
@@ -1607,7 +1629,8 @@ void gfs2_free_block(struct gfs2_sbd *sdp, uint64_t block)
rg.rg_free++; /* adjust the free count */
rgd->rg_free++;
gfs2_rgrp_out(&rg, bh->b_data); /* back to the buffer */
- brelse(bh, updated); /* release the buffer */
+ bmodified(bh);
+ brelse(bh); /* release the buffer */
}
/**
@@ -1656,13 +1679,14 @@ int gfs2_freedi(struct gfs2_sbd *sdp, uint64_t diblock)
/* Read the next metadata block in the chain */
nbh = bread(&sdp->buf_list, block);
osi_list_add(&nbh->b_altlist, next_list);
- brelse(nbh, not_updated);
+ brelse(nbh);
}
}
}
/* Set the bitmap type for inode to free space: */
gfs2_set_bitmap(sdp, ip->i_di.di_num.no_addr, GFS2_BLKST_FREE);
- inode_put(ip, updated);
+ bmodified(ip->i_bh);
+ inode_put(ip);
/* Now we have to adjust the rg freespace count and inode count: */
rgd = gfs2_blk2rgrpd(sdp, diblock);
bh = bread(&sdp->buf_list, rgd->ri.ri_addr); /* get the buffer */
@@ -1671,6 +1695,7 @@ int gfs2_freedi(struct gfs2_sbd *sdp, uint64_t diblock)
rgd->rg_free++;
rg.rg_dinodes--; /* one less inode in use */
gfs2_rgrp_out(&rg, bh->b_data);
- brelse(bh, updated); /* release the buffer */
+ bmodified(bh);
+ brelse(bh); /* release the buffer */
return 0;
}
diff --git a/gfs2/libgfs2/gfs1.c b/gfs2/libgfs2/gfs1.c
index 8a2b94a..356455b 100644
--- a/gfs2/libgfs2/gfs1.c
+++ b/gfs2/libgfs2/gfs1.c
@@ -72,9 +72,7 @@ void gfs1_block_map(struct gfs2_inode *ip, uint64_t lblock, int *new,
unsigned int height;
unsigned int end_of_metadata;
unsigned int x;
- enum update_flags f;
- f = not_updated;
*new = 0;
*dblock = 0;
if (extlen)
@@ -106,7 +104,7 @@ void gfs1_block_map(struct gfs2_inode *ip, uint64_t lblock, int *new,
for (x = 0; x < end_of_metadata; x++) {
gfs1_lookup_block(ip, bh, x, mp, create, new, dblock);
- brelse(bh, f);
+ brelse(bh);
if (!*dblock)
goto out;
@@ -118,10 +116,9 @@ void gfs1_block_map(struct gfs2_inode *ip, uint64_t lblock, int *new,
mh.mh_type = GFS2_METATYPE_IN;
mh.mh_format = GFS2_FORMAT_IN;
gfs2_meta_header_out(&mh, bh->b_data);
- f = updated;
+ bmodified(bh);
} else {
bh = bread(&sdp->buf_list, *dblock);
- f = not_updated;
}
}
@@ -152,7 +149,7 @@ void gfs1_block_map(struct gfs2_inode *ip, uint64_t lblock, int *new,
}
}
- brelse(bh, f);
+ brelse(bh);
out:
free(mp);
@@ -212,7 +209,7 @@ int gfs1_readi(struct gfs2_inode *ip, void *bufin,
if (bh) {
memcpy(buf+copied, bh->b_data + offset, amount);
- brelse(bh, not_updated);
+ brelse(bh);
} else
memset(buf+copied, 0, amount);
copied += amount;
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index 524c10b..0428481 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -271,20 +271,6 @@ struct metapath {
#define META (2)
#define DINODE (3)
-#define NOT_UPDATED (0)
-#define UPDATED (1)
-
-/* A bit of explanation is in order: */
-/* updated flag means the buffer was updated from THIS function before */
-/* brelse was called. */
-/* not_updated flag means the buffer may or may not have been updated */
-/* by a function called within this one, but it wasn't updated */
-/* by this function. */
-enum update_flags {
- not_updated = NOT_UPDATED,
- updated = UPDATED
-};
-
/* bitmap.c */
struct gfs2_bmap {
uint64_t size;
@@ -369,7 +355,8 @@ extern struct gfs2_buffer_head *__bget(struct buf_list *bl, uint64_t num,
extern struct gfs2_buffer_head *__bread(struct buf_list *bl, uint64_t num,
int line, const char *caller);
extern struct gfs2_buffer_head *bhold(struct gfs2_buffer_head *bh);
-extern void brelse(struct gfs2_buffer_head *bh, enum update_flags is_updated);
+extern void bmodified(struct gfs2_buffer_head *bh);
+extern void brelse(struct gfs2_buffer_head *bh);
extern void __bsync(struct buf_list *bl, int line, const char *caller);
extern void __bcommit(struct buf_list *bl, int line, const char *caller);
@@ -421,7 +408,7 @@ extern void lookup_block(struct gfs2_inode *ip, struct gfs2_buffer_head *bh,
int create, int *new, uint64_t *block);
extern struct gfs2_inode *inode_get(struct gfs2_sbd *sdp,
struct gfs2_buffer_head *bh);
-extern void inode_put(struct gfs2_inode *ip, enum update_flags updated);
+extern void inode_put(struct gfs2_inode *ip);
extern uint64_t data_alloc(struct gfs2_inode *ip);
extern uint64_t meta_alloc(struct gfs2_inode *ip);
extern uint64_t dinode_alloc(struct gfs2_sbd *sdp);
@@ -447,8 +434,7 @@ extern void dir_add(struct gfs2_inode *dip, const char *filename, int len,
extern int gfs2_dirent_del(struct gfs2_inode *dip, struct gfs2_buffer_head *bh,
const char *filename, int filename_len);
extern void block_map(struct gfs2_inode *ip, uint64_t lblock, int *new,
- uint64_t *dblock, uint32_t *extlen, int prealloc,
- enum update_flags if_changed);
+ uint64_t *dblock, uint32_t *extlen, int prealloc);
extern void gfs2_get_leaf_nr(struct gfs2_inode *dip, uint32_t index,
uint64_t *leaf_out);
extern void gfs2_put_leaf_nr(struct gfs2_inode *dip, uint32_t inx, uint64_t leaf_out);
@@ -651,8 +637,8 @@ extern struct rgrp_list *gfs2_blk2rgrpd(struct gfs2_sbd *sdp, uint64_t blk);
extern uint64_t gfs2_rgrp_read(struct gfs2_sbd *sdp, struct rgrp_list *rgd,
struct gfs2_buffer_head **bh,
struct gfs2_rgrp *rg);
-extern void gfs2_rgrp_relse(struct rgrp_list *rgd, enum update_flags updated,
- struct gfs2_buffer_head **bh);
+extern void gfs2_rgrp_relse(struct rgrp_list *rgd,
+ struct gfs2_buffer_head **bh);
extern void gfs2_rgrp_free(osi_list_t *rglist);
/* structures.c */
diff --git a/gfs2/libgfs2/recovery.c b/gfs2/libgfs2/recovery.c
index 3b95f8d..3df905c 100644
--- a/gfs2/libgfs2/recovery.c
+++ b/gfs2/libgfs2/recovery.c
@@ -29,7 +29,7 @@ int gfs2_replay_read_block(struct gfs2_inode *ip, unsigned int blk,
uint64_t dblock;
uint32_t extlen;
- block_map(ip, blk, &new, &dblock, &extlen, FALSE, not_updated);
+ block_map(ip, blk, &new, &dblock, &extlen, FALSE);
if (!dblock)
return -EIO;
@@ -69,7 +69,7 @@ int get_log_header(struct gfs2_inode *ip, unsigned int blk,
hash = gfs2_disk_hash(bh->b_data, sizeof(struct gfs2_log_header));
tmp->lh_hash = saved_hash;
gfs2_log_header_in(&lh, bh->b_data);
- brelse(bh, not_updated);
+ brelse(bh);
if (error || lh.lh_blkno != blk || lh.lh_hash != hash)
return 1;
@@ -221,7 +221,7 @@ int clean_journal(struct gfs2_inode *ip, struct gfs2_log_header *head)
lblock = head->lh_blkno;
gfs2_replay_incr_blk(ip, &lblock);
- block_map(ip, lblock, &new, &dblock, &extlen, 0, not_updated);
+ block_map(ip, lblock, &new, &dblock, &extlen, 0);
if (!dblock)
return -EIO;
@@ -238,8 +238,8 @@ int clean_journal(struct gfs2_inode *ip, struct gfs2_log_header *head)
lh->lh_blkno = cpu_to_be32(lblock);
hash = gfs2_disk_hash((const char *)lh, sizeof(struct gfs2_log_header));
lh->lh_hash = cpu_to_be32(hash);
-
- brelse(bh, updated);
+ bmodified(bh);
+ brelse(bh);
return 0;
}
diff --git a/gfs2/libgfs2/rgrp.c b/gfs2/libgfs2/rgrp.c
index a796666..6e73ff3 100644
--- a/gfs2/libgfs2/rgrp.c
+++ b/gfs2/libgfs2/rgrp.c
@@ -122,7 +122,7 @@ uint64_t gfs2_rgrp_read(struct gfs2_sbd *sdp, struct rgrp_list *rgd,
error = rgd->ri.ri_addr + x;
for (; x >= 0; x--)
- brelse(bh[x], not_updated);
+ brelse(bh[x]);
return error;
}
}
@@ -132,13 +132,12 @@ uint64_t gfs2_rgrp_read(struct gfs2_sbd *sdp, struct rgrp_list *rgd,
return 0;
}
-void gfs2_rgrp_relse(struct rgrp_list *rgd, enum update_flags is_updated,
- struct gfs2_buffer_head **bh)
+void gfs2_rgrp_relse(struct rgrp_list *rgd, struct gfs2_buffer_head **bh)
{
int x, length = rgd->ri.ri_length;
for (x = 0; x < length; x++)
- brelse(bh[x], is_updated);
+ brelse(bh[x]);
}
void gfs2_rgrp_free(osi_list_t *rglist)
diff --git a/gfs2/libgfs2/structures.c b/gfs2/libgfs2/structures.c
index cd632f9..d8f2b63 100644
--- a/gfs2/libgfs2/structures.c
+++ b/gfs2/libgfs2/structures.c
@@ -45,7 +45,8 @@ void build_sb(struct gfs2_sbd *sdp, const unsigned char *uuid)
for (x = 0; x < sdp->sb_addr; x++) {
bh = bget(&sdp->buf_list, x);
memset(bh->b_data, 0, sdp->bsize);
- brelse(bh, updated);
+ bmodified(bh);
+ brelse(bh);
}
memset(&sb, 0, sizeof(struct gfs2_sb));
@@ -65,7 +66,8 @@ void build_sb(struct gfs2_sbd *sdp, const unsigned char *uuid)
#endif
bh = bget(&sdp->buf_list, sdp->sb_addr);
gfs2_sb_out(&sb, bh->b_data);
- brelse(bh, updated);
+ bmodified(bh);
+ brelse(bh);
if (sdp->debug) {
printf("\nSuper Block:\n");
@@ -97,7 +99,8 @@ int write_journal(struct gfs2_sbd *sdp, struct gfs2_inode *ip, unsigned int j,
struct gfs2_buffer_head *bh = get_file_buf(ip, x, TRUE);
if (!bh)
return -1;
- brelse(bh, updated);
+ bmodified(bh);
+ brelse(bh);
}
for (x = 0; x < blocks; x++) {
struct gfs2_buffer_head *bh = get_file_buf(ip, x, FALSE);
@@ -110,7 +113,8 @@ int write_journal(struct gfs2_sbd *sdp, struct gfs2_inode *ip, unsigned int j,
hash = gfs2_disk_hash(bh->b_data, sizeof(struct gfs2_log_header));
((struct gfs2_log_header *)bh->b_data)->lh_hash = cpu_to_be32(hash);
- brelse(bh, updated);
+ bmodified(bh);
+ brelse(bh);
if (++seq == blocks)
seq = 0;
@@ -142,7 +146,8 @@ int build_jindex(struct gfs2_sbd *sdp)
sdp->jsize << 20 >> sdp->sd_sb.sb_bsize_shift);
if (ret)
return ret;
- inode_put(ip, updated);
+ bmodified(ip->i_bh);
+ inode_put(ip);
}
if (sdp->debug) {
@@ -150,7 +155,8 @@ int build_jindex(struct gfs2_sbd *sdp)
gfs2_dinode_print(&jindex->i_di);
}
- inode_put(jindex, updated);
+ bmodified(jindex->i_bh);
+ inode_put(jindex);
return 0;
}
@@ -170,7 +176,8 @@ static int build_inum_range(struct gfs2_inode *per_node, unsigned int j)
gfs2_dinode_print(&ip->i_di);
}
- inode_put(ip, updated);
+ bmodified(ip->i_bh);
+ inode_put(ip);
return 0;
}
@@ -190,7 +197,8 @@ static void build_statfs_change(struct gfs2_inode *per_node, unsigned int j)
gfs2_dinode_print(&ip->i_di);
}
- inode_put(ip, updated);
+ bmodified(ip->i_bh);
+ inode_put(ip);
}
static int build_quota_change(struct gfs2_inode *per_node, unsigned int j)
@@ -218,7 +226,8 @@ static int build_quota_change(struct gfs2_inode *per_node, unsigned int j)
gfs2_meta_header_out(&mh, bh->b_data);
- brelse(bh, updated);
+ bmodified(bh);
+ brelse(bh);
}
if (sdp->debug) {
@@ -226,7 +235,8 @@ static int build_quota_change(struct gfs2_inode *per_node, unsigned int j)
gfs2_dinode_print(&ip->i_di);
}
- inode_put(ip, updated);
+ bmodified(ip->i_bh);
+ inode_put(ip);
return 0;
}
@@ -249,7 +259,8 @@ int build_per_node(struct gfs2_sbd *sdp)
gfs2_dinode_print(&per_node->i_di);
}
- inode_put(per_node, updated);
+ bmodified(per_node->i_bh);
+ inode_put(per_node);
return 0;
}
@@ -315,7 +326,8 @@ int build_rindex(struct gfs2_sbd *sdp)
gfs2_dinode_print(&ip->i_di);
}
- inode_put(ip, updated);
+ bmodified(ip->i_bh);
+ inode_put(ip);
return 0;
}
@@ -346,7 +358,8 @@ int build_quota(struct gfs2_sbd *sdp)
gfs2_quota_print(&qu);
}
- inode_put(ip, updated);
+ bmodified(ip->i_bh);
+ inode_put(ip);
return 0;
}
@@ -470,11 +483,11 @@ int gfs2_next_rg_meta(struct gfs2_sbd *sdp, struct rgrp_list *rgd,
GFS2_BLKST_DINODE);
if(blk != BFITNOENT){
*block = blk + (bits->bi_start * GFS2_NBBY) + rgd->ri.ri_data0;
- brelse(bh, not_updated);
+ brelse(bh);
break;
}
blk=0;
- brelse(bh, not_updated);
+ brelse(bh);
}
if(i == length)
return -1;
@@ -497,12 +510,12 @@ int gfs2_next_rg_metatype(struct gfs2_sbd *sdp, struct rgrp_list *rgd,
do{
if (bh)
- brelse(bh, not_updated);
+ brelse(bh);
if (gfs2_next_rg_meta(sdp, rgd, block, first))
return -1;
bh = bread(&sdp->buf_list, *block);
first = 0;
} while(gfs2_check_meta(bh, type));
- brelse(bh, not_updated);
+ brelse(bh);
return 0;
}
diff --git a/gfs2/libgfs2/super.c b/gfs2/libgfs2/super.c
index ce429d9..4bcb0ef 100644
--- a/gfs2/libgfs2/super.c
+++ b/gfs2/libgfs2/super.c
@@ -62,7 +62,7 @@ int read_sb(struct gfs2_sbd *sdp)
bh = bread(&sdp->buf_list, GFS2_SB_ADDR >> sdp->sd_fsb2bb_shift);
gfs2_sb_in(&sdp->sd_sb, bh->b_data);
- brelse(bh, not_updated);
+ brelse(bh);
error = check_sb(&sdp->sd_sb);
if (error)
@@ -250,16 +250,13 @@ int ri_update(struct gfs2_sbd *sdp, int fd, int *rgcount)
}
for (tmp = sdp->rglist.next; tmp != &sdp->rglist; tmp = tmp->next) {
- enum update_flags f;
-
- f = not_updated;
rgd = osi_list_entry(tmp, struct rgrp_list, list);
errblock = gfs2_rgrp_read(sdp, rgd, rgbh, &rg);
if (errblock) {
free(rgbh);
return errblock;
} else
- gfs2_rgrp_relse(rgd, f, rgbh);
+ gfs2_rgrp_relse(rgd, rgbh);
count2++;
}
@@ -282,7 +279,8 @@ int write_sb(struct gfs2_sbd *sbp)
bh = bread(&sbp->buf_list, GFS2_SB_ADDR >> sbp->sd_fsb2bb_shift);
gfs2_sb_out(&sbp->sd_sb, bh->b_data);
- brelse(bh, updated);
+ bmodified(bh);
+ brelse(bh);
bcommit(&sbp->buf_list); /* make sure the change gets to disk ASAP */
return 0;
}
diff --git a/gfs2/mkfs/main_grow.c b/gfs2/mkfs/main_grow.c
index 74dd5c1..ef9d4bc 100644
--- a/gfs2/mkfs/main_grow.c
+++ b/gfs2/mkfs/main_grow.c
@@ -172,8 +172,8 @@ static void initialize_new_portion(struct gfs2_sbd *sdp, int *old_rg_count)
/* Note: We do inode_put with not_updated because we only updated */
/* the new RGs/bitmaps themselves on disk. The rindex file must */
/* be updated through the meta_fs so the gfs2 kernel is informed. */
- inode_put(sdp->md.riinode, not_updated);
- inode_put(sdp->master_dir, not_updated);
+ inode_put(sdp->md.riinode);
+ inode_put(sdp->master_dir);
/* We're done with the libgfs portion, so commit it to disk. */
bsync(&sdp->buf_list);
diff --git a/gfs2/mkfs/main_mkfs.c b/gfs2/mkfs/main_mkfs.c
index 67c94d0..02a8b55 100644
--- a/gfs2/mkfs/main_mkfs.c
+++ b/gfs2/mkfs/main_mkfs.c
@@ -639,10 +639,14 @@ void main_mkfs(int argc, char *argv[])
/* Cleanup */
- inode_put(sdp->md.rooti, updated);
- inode_put(sdp->master_dir, updated);
- inode_put(sdp->md.inum, updated);
- inode_put(sdp->md.statfs, updated);
+ bmodified(sdp->md.rooti->i_bh);
+ inode_put(sdp->md.rooti);
+ bmodified(sdp->master_dir->i_bh);
+ inode_put(sdp->master_dir);
+ bmodified(sdp->md.inum->i_bh);
+ inode_put(sdp->md.inum);
+ bmodified(sdp->md.statfs->i_bh);
+ inode_put(sdp->md.statfs);
bsync(&sdp->buf_list);
error = fsync(sdp->device_fd);
More information about the cluster-commits
mailing list