[Cluster-devel] [Patch 28/44] fsck.gfs2: misc cosmetic changes
Bob Peterson
rpeterso at redhat.com
Thu Aug 11 21:11:16 UTC 2011
>From d60a5514fd59bb5f29af684a4fe3958fee597ca5 Mon Sep 17 00:00:00 2001
From: Bob Peterson <rpeterso at redhat.com>
Date: Tue, 9 Aug 2011 14:07:21 -0500
Subject: [PATCH 28/44] fsck.gfs2: misc cosmetic changes
This patch is just cosmetic changes. It cleans up comments and code
but there should be no logic changes.
rhbz#675723
---
gfs2/fsck/metawalk.c | 17 +++++++----------
gfs2/fsck/pass1.c | 8 ++++----
gfs2/fsck/pass1b.c | 4 ++--
gfs2/fsck/pass2.c | 2 +-
gfs2/fsck/pass5.c | 10 ++++++----
5 files changed, 20 insertions(+), 21 deletions(-)
diff --git a/gfs2/fsck/metawalk.c b/gfs2/fsck/metawalk.c
index de67d23..fe1ae25 100644
--- a/gfs2/fsck/metawalk.c
+++ b/gfs2/fsck/metawalk.c
@@ -452,15 +452,14 @@ static int warn_and_patch(struct gfs2_inode *ip, uint64_t *leaf_no,
}
if (*leaf_no == *bad_leaf ||
(okay_to_fix = query( _("Attempt to patch around it? (y/n) ")))) {
- if (!valid_block(ip->i_sbd, old_leaf) == 0)
+ if (valid_block(ip->i_sbd, old_leaf))
gfs2_put_leaf_nr(ip, pindex, old_leaf);
else
gfs2_put_leaf_nr(ip, pindex, first_ok_leaf);
log_err( _("Directory Inode %llu (0x%llx) repaired.\n"),
(unsigned long long)ip->i_di.di_num.no_addr,
(unsigned long long)ip->i_di.di_num.no_addr);
- }
- else
+ } else
log_err( _("Bad leaf left in place.\n"));
*bad_leaf = *leaf_no;
*leaf_no = old_leaf;
@@ -609,9 +608,9 @@ static int check_leaf_blks(struct gfs2_inode *ip, struct metawalk_fxns *pass)
leaf. That way, bad blocks at the beginning will be overwritten
with the first valid leaf. */
first_ok_leaf = leaf_no = -1;
- for(lindex = 0; lindex < (1 << ip->i_di.di_depth); lindex++) {
+ for (lindex = 0; lindex < (1 << ip->i_di.di_depth); lindex++) {
gfs2_get_leaf_nr(ip, lindex, &leaf_no);
- if (!valid_block(ip->i_sbd, leaf_no) == 0) {
+ if (valid_block(ip->i_sbd, leaf_no)) {
lbh = bread(sdp, leaf_no);
/* Make sure it's really a valid leaf block. */
if (gfs2_check_meta(lbh, GFS2_METATYPE_LF) == 0) {
@@ -637,11 +636,9 @@ static int check_leaf_blks(struct gfs2_inode *ip, struct metawalk_fxns *pass)
gfs2_get_leaf_nr(ip, lindex, &leaf_no);
/* GFS has multiple indirect pointers to the same leaf
- * until those extra pointers are needed, so skip the
- * dups */
+ * until those extra pointers are needed, so skip the dups */
if (leaf_no == bad_leaf) {
- gfs2_put_leaf_nr(ip, lindex, old_leaf); /* fill w/old
- leaf info */
+ gfs2_put_leaf_nr(ip, lindex, old_leaf);
ref_count++;
continue;
} else if (old_leaf == leaf_no) {
@@ -812,7 +809,7 @@ int delete_block(struct gfs2_inode *ip, uint64_t block,
struct gfs2_buffer_head **bh, const char *btype,
void *private)
{
- if (!valid_block(ip->i_sbd, block) == 0) {
+ if (valid_block(ip->i_sbd, block)) {
fsck_blockmap_set(ip, block, btype, gfs2_block_free);
return 0;
}
diff --git a/gfs2/fsck/pass1.c b/gfs2/fsck/pass1.c
index 350fb12..3683550 100644
--- a/gfs2/fsck/pass1.c
+++ b/gfs2/fsck/pass1.c
@@ -367,7 +367,7 @@ static int check_metalist(struct gfs2_inode *ip, uint64_t block,
*bh = NULL;
- if (!valid_block(ip->i_sbd, block)){ /* blk outside of FS */
+ if (!valid_block(ip->i_sbd, block)) { /* blk outside of FS */
fsck_blockmap_set(ip, ip->i_di.di_num.no_addr,
_("itself"), gfs2_bad_block);
log_debug( _("Bad indirect block (invalid/out of range) "
@@ -441,7 +441,7 @@ static int undo_check_metalist(struct gfs2_inode *ip, uint64_t block,
*bh = NULL;
- if (!valid_block(ip->i_sbd, block)){ /* blk outside of FS */
+ if (!valid_block(ip->i_sbd, block)) { /* blk outside of FS */
fsck_blockmap_set(ip, ip->i_di.di_num.no_addr,
_("itself"), gfs2_block_free);
return 1;
@@ -862,7 +862,7 @@ static int check_extended_leaf_eattr(struct gfs2_inode *ip, uint64_t *data_ptr,
struct gfs2_buffer_head *bh = NULL;
int error;
- if (!valid_block(sdp, el_blk)){
+ if (!valid_block(sdp, el_blk)) {
log_err( _("Inode #%llu (0x%llx): Extended Attribute block "
"%llu (0x%llx) has an extended leaf block #%llu "
"(0x%llx) that is invalid or out of range.\n"),
@@ -1054,7 +1054,7 @@ static int rangecheck_block(struct gfs2_inode *ip, uint64_t block,
long *bad_pointers = (long *)private;
uint8_t q;
- if (!valid_block(ip->i_sbd, block) != 0) {
+ if (!valid_block(ip->i_sbd, block)) {
(*bad_pointers)++;
log_info( _("Bad %s block pointer (invalid or out of range "
"#%ld) found in inode %lld (0x%llx).\n"),
diff --git a/gfs2/fsck/pass1b.c b/gfs2/fsck/pass1b.c
index 452fb93..cabf641 100644
--- a/gfs2/fsck/pass1b.c
+++ b/gfs2/fsck/pass1b.c
@@ -211,7 +211,7 @@ static int clear_dup_metalist(struct gfs2_inode *ip, uint64_t block,
struct dup_handler *dh = (struct dup_handler *) private;
struct duptree *d;
- if (!valid_block(ip->i_sbd, block) != 0)
+ if (!valid_block(ip->i_sbd, block))
return 0;
/* This gets tricky. We're traversing a metadata tree trying to
@@ -631,7 +631,7 @@ int pass1b(struct gfs2_sbd *sdp)
log_debug( _("Filesystem has %llu (0x%llx) blocks total\n"),
(unsigned long long)last_fs_block,
(unsigned long long)last_fs_block);
- for(i = 0; i < last_fs_block; i++) {
+ for (i = 0; i < last_fs_block; i++) {
if (skip_this_pass || fsck_abort) /* if asked to skip the rest */
goto out;
diff --git a/gfs2/fsck/pass2.c b/gfs2/fsck/pass2.c
index 4a6073a..83172af 100644
--- a/gfs2/fsck/pass2.c
+++ b/gfs2/fsck/pass2.c
@@ -776,7 +776,7 @@ int pass2(struct gfs2_sbd *sdp)
return FSCK_OK;
log_info( _("Checking directory inodes.\n"));
/* Grab each directory inode, and run checks on it */
- for(dirblk = 0; dirblk < last_fs_block; dirblk++) {
+ for (dirblk = 0; dirblk < last_fs_block; dirblk++) {
warm_fuzzy_stuff(dirblk);
if (skip_this_pass || fsck_abort) /* if asked to skip the rest */
return FSCK_OK;
diff --git a/gfs2/fsck/pass5.c b/gfs2/fsck/pass5.c
index b83777b..191935f 100644
--- a/gfs2/fsck/pass5.c
+++ b/gfs2/fsck/pass5.c
@@ -45,13 +45,14 @@ static int convert_mark(uint8_t q, uint32_t *count)
default:
log_err( _("Invalid block type %d found\n"), q);
- return -1;
}
return -1;
}
-static int check_block_status(struct gfs2_sbd *sdp, char *buffer, unsigned int buflen,
- uint64_t *rg_block, uint64_t rg_data, uint32_t *count)
+
+static int check_block_status(struct gfs2_sbd *sdp, char *buffer,
+ unsigned int buflen, uint64_t *rg_block,
+ uint64_t rg_data, uint32_t *count)
{
unsigned char *byte, *end;
unsigned int bit;
@@ -154,7 +155,8 @@ static void update_rgrp(struct gfs2_sbd *sdp, struct rgrp_list *rgp,
/* update the bitmaps */
check_block_status(sdp, rgp->bh[i]->b_data + bits->bi_offset,
- bits->bi_len, &rg_block, rgp->ri.ri_data0, count);
+ bits->bi_len, &rg_block, rgp->ri.ri_data0,
+ count);
if (skip_this_pass || fsck_abort) /* if asked to skip the rest */
return;
}
--
1.7.4.4
More information about the Cluster-devel
mailing list