Gitweb: http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=612adec361…
Commit: 612adec361e2ad53cb7cfa4f5b9b197e84c39caf
Parent: 13206080308286fa6f801221eaca96c6a47b61b1
Author: Bob Peterson <rpeterso(a)redhat.com>
AuthorDate: Tue Jan 13 13:18:01 2015 -0600
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Thu Jan 22 14:19:16 2015 -0600
fsck.gfs2: rgrp block count reform
In the past, pass5 has kept track of different counts for the different
metadata types, but the counts did not correspond to the type in the
bitmap. This patch changes pass5 so that it makes a little more sense.
There should be a straightforward blockmap-to-bitmap conversion, and
the counts should be based on the bitmap type. For example, before the
patch, the rgrp's inode count would be kept in count[1], but in the
bitmap, dinodes are of type 3. So this patch reworks that system so
that the count of dinodes is kept in count[3] and so forth, and it
uses a simple blockmap-to-bitmap to figure out the index to "count".
This breaks down for GFS1 which keeps a few extra numbers in the rgrp,
however this patch compensates for that. This patch is being done
as a precursor to another patch that reduces fsck's memory requirements
by using a blockmap that's 1:1 with the bitmaps rather than today's
blockmap that's 4:1.
---
gfs2/fsck/pass5.c | 167 ++++++++++++++---------------------------------------
1 files changed, 44 insertions(+), 123 deletions(-)
diff --git a/gfs2/fsck/pass5.c b/gfs2/fsck/pass5.c
index b2e8adf..2b8536d 100644
--- a/gfs2/fsck/pass5.c
+++ b/gfs2/fsck/pass5.c
@@ -12,94 +12,6 @@
#include "fsck.h"
#include "util.h"
-static int gfs1_convert_mark(uint8_t q, uint32_t *count)
-{
- switch(q) {
-
- case gfs2_meta_inval:
- case gfs2_inode_invalid:
- /* Convert invalid metadata to free blocks */
- case gfs2_block_free:
- count[0]++;
- return GFS2_BLKST_FREE;
-
- case gfs2_block_used:
- count[2]++;
- return GFS2_BLKST_USED;
-
- case gfs2_inode_dir:
- case gfs2_inode_file:
- case gfs2_inode_lnk:
- case gfs2_inode_device:
- case gfs2_inode_fifo:
- case gfs2_inode_sock:
- count[1]++;
- return GFS2_BLKST_DINODE;
-
- case gfs2_indir_blk:
- case gfs2_leaf_blk:
- /*case gfs2_meta_rgrp:*/
- case gfs2_jdata: /* gfs1 jdata blocks count as "metadata" and gfs1
- metadata is marked the same as gfs2 inode in the
- bitmap. */
- case gfs2_meta_eattr:
- count[3]++;
- return GFS2_BLKST_DINODE;
-
- case gfs2_freemeta:
- count[4]++;
- return GFS2_BLKST_UNLINKED;
-
- default:
- log_err( _("Invalid block type %d found\n"), q);
- }
- return -1;
-}
-
-static int gfs2_convert_mark(uint8_t q, uint32_t *count)
-{
- switch(q) {
-
- case gfs2_meta_inval:
- case gfs2_inode_invalid:
- /* Convert invalid metadata to free blocks */
- case gfs2_block_free:
- count[0]++;
- return GFS2_BLKST_FREE;
-
- case gfs2_block_used:
- count[2]++;
- return GFS2_BLKST_USED;
-
- case gfs2_inode_dir:
- case gfs2_inode_file:
- case gfs2_inode_lnk:
- case gfs2_inode_device:
- case gfs2_jdata: /* gfs1 jdata blocks count as "metadata" and gfs1
- metadata is marked the same as gfs2 inode in the
- bitmap. */
- case gfs2_inode_fifo:
- case gfs2_inode_sock:
- count[1]++;
- return GFS2_BLKST_DINODE;
-
- case gfs2_indir_blk:
- case gfs2_leaf_blk:
- case gfs2_meta_eattr:
- count[2]++;
- return GFS2_BLKST_USED;
-
- case gfs2_freemeta:
- log_err( _("Invalid freemeta type %d found\n"), q);
- count[4]++;
- return -1;
-
- default:
- log_err( _("Invalid block type %d found\n"), q);
- }
- 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)
@@ -107,7 +19,6 @@ static int check_block_status(struct gfs2_sbd *sdp, char *buffer,
unsigned char *byte, *end;
unsigned int bit;
unsigned char rg_status;
- int block_status;
uint8_t q;
uint64_t block;
@@ -123,26 +34,33 @@ static int check_block_status(struct gfs2_sbd *sdp, char *buffer,
if (skip_this_pass || fsck_abort) /* if asked to skip the rest */
return 0;
- q = block_type(block);
-
- if (sdp->gfs1)
- block_status = gfs1_convert_mark(q, count);
- else
- block_status = gfs2_convert_mark(q, count);
-
- if (block_status < 0) {
- log_err( _("Invalid status for block %llu (0x%llx).\n"),
- (unsigned long long)block,
- (unsigned long long)block);
- return block_status;
+ q = blockmap_to_bitmap(block_type(block), sdp->gfs1);
+ /* GFS1 file systems will have to suffer from slower fsck run
+ * times because in GFS, there's no 1:1 relationship between
+ * bits and counts. If a bit is marked "dinode" in GFS1, it
+ * may be dinode -OR- any kind of metadata. I consider GFS1 to
+ * be a rare exception, so acceptable loss at this point. So
+ * we must determine whether it's really a dinode or other
+ * metadata by reading it in. */
+ if (sdp->gfs1 && q == GFS2_BLKST_DINODE) {
+ struct gfs2_buffer_head *bh;
+
+ bh = bread(sdp, block);
+ if (gfs2_check_meta(bh, GFS2_METATYPE_DI) == 0)
+ count[GFS2_BLKST_DINODE]++;
+ else
+ count[GFS2_BLKST_USED]++;
+ brelse(bh);
+ } else {
+ count[q]++;
}
+
/* If one node opens a file and another node deletes it, we
may be left with a block that appears to be "unlinked" in
the bitmap, but nothing links to it. This is a valid case
and should be cleaned up by the file system eventually.
So we ignore it. */
- if (rg_status == GFS2_BLKST_UNLINKED &&
- block_status == GFS2_BLKST_FREE) {
+ if (q == GFS2_BLKST_UNLINKED) {
log_err( _("Unlinked inode found at block %llu "
"(0x%llx).\n"),
(unsigned long long)block,
@@ -150,33 +68,33 @@ static int check_block_status(struct gfs2_sbd *sdp, char *buffer,
if (query(_("Do you want to reclaim the block? "
"(y/n) "))) {
lgfs2_rgrp_t rg = gfs2_blk2rgrpd(sdp, block);
- if (gfs2_set_bitmap(rg, block, block_status))
+ if (gfs2_set_bitmap(rg, block, GFS2_BLKST_FREE))
log_err(_("Unlinked block %llu "
"(0x%llx) bitmap not fixed."
"\n"),
(unsigned long long)block,
(unsigned long long)block);
- else
+ else {
log_err(_("Unlinked block %llu "
"(0x%llx) bitmap fixed.\n"),
(unsigned long long)block,
(unsigned long long)block);
+ count[GFS2_BLKST_UNLINKED]--;
+ count[GFS2_BLKST_FREE]++;
+ }
} else {
log_info( _("Unlinked block found at block %llu"
" (0x%llx), left unchanged.\n"),
(unsigned long long)block,
(unsigned long long)block);
}
- } else if (rg_status != block_status) {
- const char *blockstatus[] = {"Free", "Data",
- "Unlinked", "inode"};
-
+ } else if (rg_status != q) {
log_err( _("Block %llu (0x%llx) bitmap says %u (%s) "
"but FSCK saw %u (%s)\n"),
(unsigned long long)block,
(unsigned long long)block, rg_status,
- blockstatus[rg_status], block_status,
- blockstatus[block_status]);
+ block_type_string(rg_status), q,
+ block_type_string(q));
if (q) /* Don't print redundant "free" */
log_err( _("Metadata type is %u (%s)\n"), q,
block_type_string(q));
@@ -185,7 +103,7 @@ static int check_block_status(struct gfs2_sbd *sdp, char *buffer,
(unsigned long long)block,
(unsigned long long)block)) {
lgfs2_rgrp_t rg = gfs2_blk2rgrpd(sdp, block);
- if (gfs2_set_bitmap(rg, block, block_status))
+ if (gfs2_set_bitmap(rg, block, q))
log_err( _("Repair failed.\n"));
else
log_err( _("Fixed.\n"));
@@ -235,38 +153,41 @@ static void update_rgrp(struct gfs2_sbd *sdp, struct rgrp_tree *rgp,
rgp->rg.rg_free = count[0];
update = 1;
}
- if (rgp->rg.rg_dinodes != count[1]) {
+ if (rgp->rg.rg_dinodes != count[3]) {
log_err( _("RG #%llu (0x%llx) Inode count inconsistent: is "
"%u should be %u\n"),
(unsigned long long)rgp->ri.ri_addr,
(unsigned long long)rgp->ri.ri_addr,
- rgp->rg.rg_dinodes, count[1]);
- rgp->rg.rg_dinodes = count[1];
+ rgp->rg.rg_dinodes, count[3]);
+ rgp->rg.rg_dinodes = count[3];
update = 1;
}
- if (sdp->gfs1 && gfs1rg->rg_usedmeta != count[3]) {
+ if (sdp->gfs1 && gfs1rg->rg_usedmeta != count[1]) {
log_err( _("RG #%llu (0x%llx) Used metadata count "
"inconsistent: is %u should be %u\n"),
(unsigned long long)rgp->ri.ri_addr,
(unsigned long long)rgp->ri.ri_addr,
- gfs1rg->rg_usedmeta, count[3]);
- gfs1rg->rg_usedmeta = count[3];
+ gfs1rg->rg_usedmeta, count[1]);
+ gfs1rg->rg_usedmeta = count[1];
update = 1;
}
- if (sdp->gfs1 && gfs1rg->rg_freemeta != count[4]) {
+ if (sdp->gfs1 && gfs1rg->rg_freemeta != count[2]) {
log_err( _("RG #%llu (0x%llx) Free metadata count "
"inconsistent: is %u should be %u\n"),
(unsigned long long)rgp->ri.ri_addr,
(unsigned long long)rgp->ri.ri_addr,
- gfs1rg->rg_freemeta, count[4]);
- gfs1rg->rg_freemeta = count[4];
+ gfs1rg->rg_freemeta, count[2]);
+ gfs1rg->rg_freemeta = count[2];
update = 1;
}
- if (!sdp->gfs1 && (rgp->ri.ri_data - count[0] - count[1]) != count[2]) {
+ if (!sdp->gfs1 && (rgp->ri.ri_data != count[0] + count[1] +
+ count[2] + count[3])) {
/* FIXME not sure how to handle this case ATM - it
* means that the total number of blocks we've counted
* exceeds the blocks in the rg */
- log_err( _("Internal fsck error - AAHHH!\n"));
+ log_err( _("Internal fsck error: %u != %u + %u + %u + %u\n"),
+ rgp->ri.ri_data, count[0], count[1], count[2],
+ count[3]);
exit(FSCK_ERROR);
}
if (update) {
Gitweb: http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=7a54f62b69…
Commit: 7a54f62b693f4b9e89de20c29e5d8db6d8ced34d
Parent: 8cd4466f8f0518f74f74ecafb228cf2ea03c356d
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Wed Jan 14 12:30:04 2015 +0000
Committer: Andrew Price <anprice(a)redhat.com>
CommitterDate: Fri Jan 16 12:04:10 2015 +0000
gfs2-utils tests: Improve docs
Add a pointer to doc/README.tests in README.build and be more consistent
about how the test suite is run in doc/README.tests. Add example usage
and mention the TOPTS argument.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
README.build | 3 ++-
doc/README.tests | 32 ++++++++++++++++++++++++--------
2 files changed, 26 insertions(+), 9 deletions(-)
diff --git a/README.build b/README.build
index 2aad6ab..f4ebe53 100644
--- a/README.build
+++ b/README.build
@@ -29,4 +29,5 @@ To install gfs2-utils, run:
make install
-See also doc/README.contributing for details on submitting patches.
+See also doc/README.contributing for details on submitting patches and
+doc/README.tests for more details regarding the test suite.
diff --git a/doc/README.tests b/doc/README.tests
index 79f51f6..1b90a0c 100644
--- a/doc/README.tests
+++ b/doc/README.tests
@@ -1,16 +1,30 @@
Working with the gfs2-utils test suite
--------------------------------------
+Overview
+--------
The test suite in the tests directory of the gfs2-utils source tree is based on
the Autotest framework provided by Autoconf. The basic idea is that the
testsuite.at file is the main source file for the tests, written in m4 and
-generating a bourne shell script called testsuite.
+generating a bourne shell script called testsuite, which we run with 'make check'.
-When run, either using 'make check' or directly from within the tests
-directory, the testsuite script sources atconfig and atlocal for configuration
-and then runs the whole testsuite or a specified set of tests (see ./testsuite
--h for help).
+When run, the test suite sources tests/atconfig and tests/atlocal for
+configuration and then runs the whole suite or a specified set of tests,
+depending on options passed to the test suite using TOPTS. For example, to see
+a list of available options, use 'make check TOPTS=-h' and to see a numbered
+list of the available tests, use 'make check TOPTS=-l'.
+A subset of the available tests can be run using keywords and/or by specifying
+the test ID numbers in TOPTS, e.g. make check TOPTS='-k mkfs 24 25'
+
+Test output is captured and, if a test fails, a log is kept in
+tests/testsuite.dir/$n/testsuite.log where $n is the test's ID number. Failed
+tests can be re-run using make check TOPTS='--recheck' although it's better to
+re-run the entire suite after fixing tests as a fix for one test could break
+another.
+
+Writing tests
+-------------
A number of GFS2-specific convenience macros have been defined in testsuite.at
to make defining new tests quick and easy. Also, some variables have been
defined in atlocal.in so that full paths to programs do not have to be included
@@ -32,15 +46,17 @@ do not fit into an existing category, in which case AT_BANNER can be used to
group them, and they can be organised into a new .at file and sourced from
testsuite.at.
-Since the tests can be run individually (e.g. ./testsuite 15) any new tests
-which require the dummy volume $GFS_TGT to be present should call GFS_TGT_REGEN
-before attempting to use it.
+As the tests can be run individually, any new tests which require the dummy
+volume $GFS_TGT to be present should call GFS_TGT_REGEN before attempting to
+use it.
Documentation for Autotest, including the AT_* macros used to define tests, can
be found in the autoconf manual at:
http://www.gnu.org/software/autoconf/manual/index.html
+Generating coverage reports
+---------------------------
Test coverage instrumentation can be enabled using the --enable-gcov option at
the configure stage. Once the tools have been built and run with this option
enabled, coverage data will be written to files in the source directories for
Gitweb: http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=407dbe2a3df38…
Commit: 407dbe2a3df3882a1e936e37e7c0a8505a2d44ac
Parent: 9b64bf4d044d835d5c203e7ce8fbb5a683f84867
Author: Abhi Das <adas(a)redhat.com>
AuthorDate: Thu Jan 15 15:26:31 2015 -0600
Committer: Abhi Das <adas(a)redhat.com>
CommitterDate: Thu Jan 15 15:26:31 2015 -0600
fsck.gfs2: addendum to fix broken i_goal values in inodes - addendum 2 of 2
This patch moves some code around and fixes some corner cases that
the previous patches did not address.
This patch also fixes some trailing whitespace and removes a test
that is no longer valid from test/fsck.at
This patch is part 2 of 2 addendum fixes to make fsck fix i_goal
values correctly. The original two patches to fix this problem were
checked in against bz 1149516 as well. The complete fix contains
those two patches (de32500, 7933984) and this two-patch addendum
for a total of 4 patches.
Resolves: rhbz#1149516
Signed-off-by: Abhi Das <adas(a)redhat.com>
---
gfs2/fsck/metawalk.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++++
gfs2/fsck/metawalk.h | 2 +
gfs2/fsck/pass1.c | 54 +++---------------------------------
gfs2/libgfs2/libgfs2.h | 1 +
4 files changed, 78 insertions(+), 49 deletions(-)
diff --git a/gfs2/fsck/metawalk.c b/gfs2/fsck/metawalk.c
index 8dc59fb..07e5c18 100644
--- a/gfs2/fsck/metawalk.c
+++ b/gfs2/fsck/metawalk.c
@@ -1435,6 +1435,9 @@ int check_metatree(struct gfs2_inode *ip, struct metawalk_fxns *pass)
uint64_t error_blk = 0;
int hit_error_blk = 0;
+ if (!height && pass->check_i_goal)
+ pass->check_i_goal(ip, ip->i_di.di_num.no_addr,
+ pass->private);
if (!height && !is_dir(&ip->i_di, ip->i_sbd->gfs1))
return 0;
@@ -1830,6 +1833,72 @@ static int alloc_leaf(struct gfs2_inode *ip, uint64_t block, void *private)
return 0;
}
+/**
+ * rgrp_contains_block - Check if the rgrp provided contains the
+ * given block. Taken directly from the gfs2 kernel code
+ * @rgd: The rgrp to search within
+ * @block: The block to search for
+ *
+ * Returns: 1 if present, 0 if not.
+ */
+static inline int rgrp_contains_block(struct rgrp_tree *rgd, uint64_t block)
+{
+ uint64_t first = rgd->ri.ri_data0;
+ uint64_t last = first + rgd->ri.ri_data;
+ return first <= block && block < last;
+}
+
+/**
+ * check_i_goal
+ * @ip
+ * @goal_blk: What the goal block should be for this inode
+ *
+ * The goal block for a regular file is typically the last
+ * data block of the file. If we can't get the right value,
+ * the inode metadata block is the next best thing.
+ *
+ * Returns: 0 if corrected, 1 if not corrected
+ */
+int check_i_goal(struct gfs2_inode *ip, uint64_t goal_blk,
+ void *private)
+{
+ struct gfs2_sbd *sdp = ip->i_sbd;
+ uint64_t i_block = ip->i_di.di_num.no_addr;
+
+ /* Don't fix gfs1 inodes, system inodes or inodes whose goal blocks are
+ * set to the inode blocks themselves. */
+ if (sdp->gfs1 || ip->i_di.di_flags & GFS2_DIF_SYSTEM ||
+ ip->i_di.di_goal_meta == i_block)
+ return 0;
+ /* We default to the inode block */
+ if (!goal_blk)
+ goal_blk = i_block;
+
+ if (ip->i_di.di_goal_meta != goal_blk) {
+ /* If the existing goal block is in the same rgrp as the inode,
+ * we give the benefit of doubt and assume the value is correct */
+ if (ip->i_rgd &&
+ rgrp_contains_block(ip->i_rgd, ip->i_di.di_goal_meta))
+ goto skip;
+ log_err( _("Error: inode %llu (0x%llx) has invalid "
+ "allocation goal block %llu (0x%llx). Should"
+ " be %llu (0x%llx)\n"),
+ (unsigned long long)i_block, (unsigned long long)i_block,
+ (unsigned long long)ip->i_di.di_goal_meta,
+ (unsigned long long)ip->i_di.di_goal_meta,
+ (unsigned long long)goal_blk, (unsigned long long)goal_blk);
+ if (query( _("Fix the invalid goal block? (y/n) "))) {
+ ip->i_di.di_goal_meta = ip->i_di.di_goal_data = goal_blk;
+ bmodified(ip->i_bh);
+ } else {
+ log_err(_("Invalid goal block not fixed.\n"));
+ return 1;
+ }
+ }
+skip:
+ return 0;
+}
+
struct metawalk_fxns alloc_fxns = {
.private = NULL,
.check_leaf = alloc_leaf,
@@ -1840,6 +1909,7 @@ struct metawalk_fxns alloc_fxns = {
.check_dentry = NULL,
.check_eattr_entry = NULL,
.check_eattr_extentry = NULL,
+ .check_i_goal = check_i_goal,
.finish_eattr_indir = NULL,
};
diff --git a/gfs2/fsck/metawalk.h b/gfs2/fsck/metawalk.h
index d4ffc62..8bd604d 100644
--- a/gfs2/fsck/metawalk.h
+++ b/gfs2/fsck/metawalk.h
@@ -51,6 +51,8 @@ extern int _fsck_blockmap_set(struct gfs2_inode *ip, uint64_t bblock,
extern int check_n_fix_bitmap(struct gfs2_sbd *sdp, uint64_t blk,
int error_on_dinode,
enum gfs2_mark_block new_blockmap_state);
+extern int check_i_goal(struct gfs2_inode *ip, uint64_t goal_blk,
+ void *private);
extern void reprocess_inode(struct gfs2_inode *ip, const char *desc);
extern struct duptree *dupfind(uint64_t block);
extern struct gfs2_inode *fsck_system_inode(struct gfs2_sbd *sdp,
diff --git a/gfs2/fsck/pass1.c b/gfs2/fsck/pass1.c
index 9606101..1162066 100644
--- a/gfs2/fsck/pass1.c
+++ b/gfs2/fsck/pass1.c
@@ -60,7 +60,6 @@ static int check_extended_leaf_eattr(struct gfs2_inode *ip, uint64_t *data_ptr,
struct gfs2_ea_header *ea_hdr,
struct gfs2_ea_header *ea_hdr_prev,
void *private);
-static int check_i_goal(struct gfs2_inode *ip, uint64_t goal_blk, void *private);
static int finish_eattr_indir(struct gfs2_inode *ip, int leaf_pointers,
int leaf_pointer_errors, void *private);
static int invalidate_metadata(struct gfs2_inode *ip, uint64_t block,
@@ -98,7 +97,7 @@ struct metawalk_fxns pass1_fxns = {
.check_dentry = NULL,
.check_eattr_entry = check_eattr_entries,
.check_eattr_extentry = check_extended_leaf_eattr,
- .check_i_goal = NULL,
+ .check_i_goal = check_i_goal,
.finish_eattr_indir = finish_eattr_indir,
.big_file_msg = big_file_comfort,
.repair_leaf = pass1_repair_leaf,
@@ -792,48 +791,6 @@ static int check_extended_leaf_eattr(struct gfs2_inode *ip, uint64_t *data_ptr,
return error;
}
-/**
- * check_i_goal
- * @ip
- * @goal_blk: What the goal block should be for this inode
- *
- * The goal block for a regular file is typically the last
- * data block of the file. If we can't get the right value,
- * the inode metadata block is the next best thing.
- *
- * Returns: 0 if corrected, 1 if not corrected
- */
-static int check_i_goal(struct gfs2_inode *ip, uint64_t goal_blk,
- void *private)
-{
- struct gfs2_sbd *sdp = ip->i_sbd;
-
- if (fsck_system_inode(sdp, ip->i_di.di_num.no_addr))
- return 0;
- if (!goal_blk)
- goal_blk = ip->i_di.di_num.no_addr;
- if (ip->i_di.di_goal_meta != goal_blk ||
- ip->i_di.di_goal_data != goal_blk) {
- log_err( _("Error: inode %llu (0x%llx) has invalid "
- "allocation goal block %llu (0x%llx). Should"
- " be %llu (0x%llx)\n"),
- (unsigned long long)ip->i_di.di_num.no_addr,
- (unsigned long long)ip->i_di.di_num.no_addr,
- (unsigned long long)ip->i_di.di_goal_meta,
- (unsigned long long)ip->i_di.di_goal_meta,
- (unsigned long long)goal_blk,
- (unsigned long long)goal_blk);
- if (query( _("Fix the invalid goal block? (y/n) "))) {
- ip->i_di.di_goal_meta = ip->i_di.di_goal_data = goal_blk;
- bmodified(ip->i_bh);
- } else {
- log_err(_("Invalid goal block not fixed.\n"));
- return 1;
- }
- }
- return 0;
-}
-
static int check_eattr_leaf(struct gfs2_inode *ip, uint64_t block,
uint64_t parent, struct gfs2_buffer_head **bh,
void *private)
@@ -1214,7 +1171,8 @@ bad_dinode:
* handle_di - This is now a wrapper function that takes a gfs2_buffer_head
* and calls handle_ip, which takes an in-code dinode structure.
*/
-static int handle_di(struct gfs2_sbd *sdp, struct gfs2_buffer_head *bh)
+static int handle_di(struct gfs2_sbd *sdp, struct gfs2_buffer_head *bh,
+ struct rgrp_tree *rgd)
{
int error = 0;
uint64_t block = bh->b_blocknr;
@@ -1254,6 +1212,7 @@ static int handle_di(struct gfs2_sbd *sdp, struct gfs2_buffer_head *bh)
(unsigned long long)block,
(unsigned long long)block);
}
+ ip->i_rgd = rgd;
error = handle_ip(sdp, ip);
fsck_inode_put(&ip);
return error;
@@ -1508,9 +1467,6 @@ int pass1(struct gfs2_sbd *sdp)
/* Make sure the system inodes are okay & represented in the bitmap. */
check_system_inodes(sdp);
- /* Turn the check_i_goal function ON for the non-system inodes */
- pass1_fxns.check_i_goal = check_i_goal;
-
/* So, do we do a depth first search starting at the root
* inode, or use the rg bitmaps, or just read every fs block
* to find the inodes? If we use the depth first search, why
@@ -1654,7 +1610,7 @@ int pass1(struct gfs2_sbd *sdp)
check_n_fix_bitmap(sdp, block, 0,
gfs2_block_free);
}
- } else if (handle_di(sdp, bh) < 0) {
+ } else if (handle_di(sdp, bh, rgd) < 0) {
stack;
brelse(bh);
gfs2_special_free(&gfs1_rindex_blks);
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index 9985c97..9c20f11 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -131,6 +131,7 @@ struct gfs2_inode {
struct gfs2_dinode i_di;
struct gfs2_buffer_head *i_bh;
struct gfs2_sbd *i_sbd;
+ struct rgrp_tree *i_rgd; /* The rgrp this inode is in */
};
#define BUF_HASH_SHIFT (13) /* # hash buckets = 8K */