Gitweb:
http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=4a1e4d8c...
Commit: 4a1e4d8c2a9ab5eff3f3f54364c2d482a9e783c8
Parent: e662521a03290bd5542a65b0191cdf75c0e46139
Author: Bob Peterson <rpeterso(a)redhat.com>
AuthorDate: Tue Mar 15 14:54:34 2016 -0400
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Mon May 9 10:48:39 2016 -0500
fsck.gfs2: Eliminate astate code
Since all the passes after pass1 now use the rgrp bitmaps for the
definitive state of a block, there's no more need to re-sync the
blockmap with the bitmap. Therefore, we can completely eliminate
the astate save/restore and reprocessing code.
Signed-off-by: Bob Peterson <rpeterso(a)redhat.com>
---
gfs2/fsck/metawalk.c | 6 ------
gfs2/fsck/pass2.c | 21 ---------------------
gfs2/fsck/pass3.c | 18 ------------------
gfs2/fsck/pass4.c | 5 -----
gfs2/fsck/util.h | 20 --------------------
5 files changed, 0 insertions(+), 70 deletions(-)
diff --git a/gfs2/fsck/metawalk.c b/gfs2/fsck/metawalk.c
index c37110f..cbc73e9 100644
--- a/gfs2/fsck/metawalk.c
+++ b/gfs2/fsck/metawalk.c
@@ -1718,9 +1718,6 @@ int check_linear_dir(struct gfs2_inode *ip, struct gfs2_buffer_head
*bh,
int check_dir(struct gfs2_sbd *sdp, struct gfs2_inode *ip, struct metawalk_fxns *pass)
{
int error = 0;
- struct alloc_state as;
-
- astate_save(ip, &as);
if (ip->i_di.di_flags & GFS2_DIF_EXHASH)
error = check_leaf_blks(ip, pass);
@@ -1730,9 +1727,6 @@ int check_dir(struct gfs2_sbd *sdp, struct gfs2_inode *ip, struct
metawalk_fxns
if (error < 0)
stack;
- if (astate_changed(ip, &as))
- reprocess_inode(ip, _("Current"));
-
return error;
}
diff --git a/gfs2/fsck/pass2.c b/gfs2/fsck/pass2.c
index 96074d2..a215b3c 100644
--- a/gfs2/fsck/pass2.c
+++ b/gfs2/fsck/pass2.c
@@ -1837,7 +1837,6 @@ build_it:
return -1;
}
fsck_bitmap_set(ip, ip->i_di.di_num.no_addr, fn, GFS2_BLKST_DINODE);
- reprocess_inode(ip, fn);
log_err(_("System file %s rebuilt.\n"), fn);
goto out_good;
}
@@ -1848,7 +1847,6 @@ static int check_system_dir(struct gfs2_inode *sysinode, const char
*dirname,
int builder(struct gfs2_sbd *sdp))
{
uint64_t iblock = 0;
- struct alloc_state as;
struct dir_status ds = {0};
int error = 0;
@@ -1865,15 +1863,12 @@ static int check_system_dir(struct gfs2_inode *sysinode, const
char *dirname,
pass2_fxns.private = (void *) &ds;
if (ds.q == GFS2_BLKST_UNLINKED) {
- astate_save(sysinode, &as);
/* First check that the directory's metatree is valid */
error = check_metatree(sysinode, &pass2_fxns);
if (error < 0) {
stack;
return error;
}
- if (astate_changed(sysinode, &as))
- reprocess_inode(sysinode, _("System inode"));
}
error = check_dir(sysinode->i_sbd, sysinode, &pass2_fxns);
if (skip_this_pass || fsck_abort) /* if asked to skip the rest */
@@ -1892,7 +1887,6 @@ static int check_system_dir(struct gfs2_inode *sysinode, const char
*dirname,
if (!ds.dotdir) {
log_err( _("No '.' entry found for %s directory.\n"), dirname);
if (query( _("Is it okay to add '.' entry? (y/n) "))) {
- astate_save(sysinode, &as);
log_warn( _("Adding '.' entry\n"));
error = dir_add(sysinode, ".", 1, &(sysinode->i_di.di_num),
(sysinode->i_sbd->gfs1 ? GFS_FILE_DIR : DT_DIR));
@@ -1901,8 +1895,6 @@ static int check_system_dir(struct gfs2_inode *sysinode, const char
*dirname,
strerror(errno));
return -errno;
}
- if (astate_changed(sysinode, &as))
- reprocess_inode(sysinode, dirname);
/* This system inode is linked to itself via '.' */
incr_link_count(sysinode->i_di.di_num, sysinode,
"sysinode \".\"");
@@ -1974,20 +1966,16 @@ static int pass2_check_dir(struct gfs2_sbd *sdp, struct gfs2_inode
*ip)
{
uint64_t dirblk = ip->i_di.di_num.no_addr;
struct dir_status ds = {0};
- struct alloc_state as;
int error;
pass2_fxns.private = &ds;
if (ds.q == GFS2_BLKST_UNLINKED) {
/* First check that the directory's metatree is valid */
- astate_save(ip, &as);
error = check_metatree(ip, &pass2_fxns);
if (error < 0) {
stack;
return error;
}
- if (astate_changed(ip, &as))
- reprocess_inode(ip, "current");
}
error = check_dir(sdp, ip, &pass2_fxns);
if (skip_this_pass || fsck_abort) /* if asked to skip the rest */
@@ -2037,7 +2025,6 @@ static int pass2_check_dir(struct gfs2_sbd *sdp, struct gfs2_inode
*ip)
(unsigned long long)dirblk, (unsigned long long)dirblk);
if (query( _("Is it okay to add '.' entry? (y/n) "))) {
- astate_save(ip, &as);
error = dir_add(ip, ".", 1, &(ip->i_di.di_num),
(sdp->gfs1 ? GFS_FILE_DIR : DT_DIR));
if (error) {
@@ -2045,14 +2032,6 @@ static int pass2_check_dir(struct gfs2_sbd *sdp, struct gfs2_inode
*ip)
strerror(errno));
return -errno;
}
- if (astate_changed(ip, &as)) {
- char dirname[80];
-
- sprintf(dirname, _("Directory at %lld (0x%llx)"),
- (unsigned long long)dirblk,
- (unsigned long long)dirblk);
- reprocess_inode(ip, dirname);
- }
/* directory links to itself via '.' */
incr_link_count(ip->i_di.di_num, ip, _("\". (itself)\""));
ds.entry_count++;
diff --git a/gfs2/fsck/pass3.c b/gfs2/fsck/pass3.c
index dad1f5c..0df427d 100644
--- a/gfs2/fsck/pass3.c
+++ b/gfs2/fsck/pass3.c
@@ -24,7 +24,6 @@ static int attach_dotdot_to(struct gfs2_sbd *sdp, uint64_t newdotdot,
int filename_len = 2;
int err;
struct gfs2_inode *ip, *pip;
- struct alloc_state as;
ip = fsck_load_inode(sdp, block);
pip = fsck_load_inode(sdp, newdotdot);
@@ -39,7 +38,6 @@ static int attach_dotdot_to(struct gfs2_sbd *sdp, uint64_t newdotdot,
log_warn( _("Unable to remove \"..\" directory entry.\n"));
else
decr_link_count(olddotdot, block, _("old \"..\""));
- astate_save(ip, &as);
err = dir_add(ip, filename, filename_len, &pip->i_di.di_num,
(sdp->gfs1 ? GFS_FILE_DIR : DT_DIR));
if (err) {
@@ -47,14 +45,6 @@ static int attach_dotdot_to(struct gfs2_sbd *sdp, uint64_t newdotdot,
filename, strerror(errno));
exit(FSCK_ERROR);
}
- if (astate_changed(ip, &as)) {
- char dirname[80];
-
- sprintf(dirname, _("Directory at %lld (0x%llx)"),
- (unsigned long long)ip->i_di.di_num.no_addr,
- (unsigned long long)ip->i_di.di_num.no_addr);
- reprocess_inode(ip, dirname);
- }
incr_link_count(pip->i_di.di_num, ip, _("new \"..\""));
fsck_inode_put(&ip);
fsck_inode_put(&pip);
@@ -182,7 +172,6 @@ int pass3(struct gfs2_sbd *sdp)
struct dir_info *di, *tdi;
struct gfs2_inode *ip;
int q;
- struct alloc_state lf_as = {.as_blocks = 0, .as_meta_goal = 0};
di = dirtree_find(sdp->md.rooti->i_di.di_num.no_addr);
if (di) {
@@ -229,8 +218,6 @@ int pass3(struct gfs2_sbd *sdp)
*/
log_info( _("Checking directory linkage.\n"));
for (tmp = osi_first(&dirtree); tmp; tmp = next) {
- if (lf_dip && lf_as.as_blocks == 0)
- astate_save(lf_dip, &lf_as);
next = osi_next(tmp);
di = (struct dir_info *)tmp;
while (!di->checked) {
@@ -328,11 +315,6 @@ int pass3(struct gfs2_sbd *sdp)
}
}
if (lf_dip) {
- /* If the lf directory had new blocks added we have to mark
- them properly in the blockmap so they're not freed. */
- if (astate_changed(lf_dip, &lf_as))
- reprocess_inode(lf_dip, "lost+found");
-
log_debug( _("At end of pass3, lost+found entries is %u\n"),
lf_dip->i_di.di_entries);
}
diff --git a/gfs2/fsck/pass4.c b/gfs2/fsck/pass4.c
index 25c63b7..ba38e8c 100644
--- a/gfs2/fsck/pass4.c
+++ b/gfs2/fsck/pass4.c
@@ -48,15 +48,12 @@ static int scan_inode_list(struct gfs2_sbd *sdp) {
struct gfs2_inode *ip;
int lf_addition = 0;
int q;
- struct alloc_state lf_as = {.as_blocks = 0, .as_meta_goal = 0};
/* FIXME: should probably factor this out into a generic
* scanning fxn */
for (tmp = osi_first(&inodetree); tmp; tmp = next) {
if (skip_this_pass || fsck_abort) /* if asked to skip the rest */
return 0;
- if (lf_dip && lf_as.as_blocks == 0)
- astate_save(lf_dip, &lf_as);
next = osi_next(tmp);
ii = (struct inode_info *)tmp;
/* Don't check reference counts on the special gfs files */
@@ -179,8 +176,6 @@ static int scan_inode_list(struct gfs2_sbd *sdp) {
if (lf_dip == NULL)
return 0;
- if (astate_changed(lf_dip, &lf_as))
- reprocess_inode(lf_dip, "lost+found");
if (lf_addition) {
if (!(ii = inodetree_find(lf_dip->i_di.di_num.no_addr))) {
diff --git a/gfs2/fsck/util.h b/gfs2/fsck/util.h
index 45a9000..7753daf 100644
--- a/gfs2/fsck/util.h
+++ b/gfs2/fsck/util.h
@@ -12,11 +12,6 @@
#define INODE_VALID 1
#define INODE_INVALID 0
-struct alloc_state {
- uint64_t as_blocks;
- uint64_t as_meta_goal;
-};
-
struct di_info *search_list(osi_list_t *list, uint64_t addr);
void big_file_comfort(struct gfs2_inode *ip, uint64_t blks_checked);
void warm_fuzzy_stuff(uint64_t block);
@@ -32,21 +27,6 @@ extern const char *reftypes[ref_types + 1];
#define BLOCKMAP_BYTE_OFFSET2(x) ((x & 0x0000000000000003) << 1)
#define BLOCKMAP_MASK2 (0x3)
-static inline void astate_save(struct gfs2_inode *ip, struct alloc_state *as)
-{
- as->as_blocks = ip->i_di.di_blocks;
- as->as_meta_goal = ip->i_di.di_goal_meta;
-}
-
-static inline int astate_changed(struct gfs2_inode *ip, struct alloc_state *as)
-{
- if (as->as_blocks != ip->i_di.di_blocks)
- return 1;
- if (as->as_meta_goal != ip->i_di.di_goal_meta)
- return 1;
- return 0;
-}
-
static inline int block_type(uint64_t bblock)
{
static unsigned char *byte;