This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch andyp-fsck_cx in repository gfs2-utils.
commit 3ea1464f7ecfa124954e2a342a32f2ea416ee70e Author: Andrew Price anprice@redhat.com AuthorDate: Mon Aug 1 09:07:34 2022 +0100
fsck.gfs2: Pass fsck_options into initialize()
Signed-off-by: Andrew Price anprice@redhat.com --- gfs2/fsck/fsck.h | 20 ++++++++++---------- gfs2/fsck/initialize.c | 14 ++++++-------- gfs2/fsck/main.c | 2 +- 3 files changed, 17 insertions(+), 19 deletions(-)
diff --git a/gfs2/fsck/fsck.h b/gfs2/fsck/fsck.h index 306a4ec1..155f4d23 100644 --- a/gfs2/fsck/fsck.h +++ b/gfs2/fsck/fsck.h @@ -108,6 +108,15 @@ enum rgindex_trust_level { /* how far can we trust our RG index? */ must have been converted from gfs2_convert. */ };
+struct fsck_options { + char *device; + unsigned int yes:1; + unsigned int no:1; + unsigned int query:1; + unsigned int preen:1; + unsigned int force:1; +}; + struct fsck_cx { struct lgfs2_sbd *sdp; struct osi_root dup_blocks; @@ -121,7 +130,7 @@ extern struct lgfs2_inode *fsck_inode_get(struct lgfs2_sbd *sdp, struct lgfs2_buffer_head *bh); extern void fsck_inode_put(struct lgfs2_inode **ip);
-extern int initialize(struct fsck_cx *cx, int force_check, int preen, int *all_clean); +extern int initialize(struct fsck_cx *cx, const struct fsck_options * const opts, int *all_clean); extern void destroy(struct fsck_cx *cx); extern int pass1(struct fsck_cx *cx); extern int pass1b(struct fsck_cx *cx); @@ -141,15 +150,6 @@ extern void dirtree_delete(struct fsck_cx *cx, struct dir_info *b); * of pass1 and put somewhere else... */ struct dir_info *dirtree_insert(struct fsck_cx *cx, struct lgfs2_inum inum);
-struct fsck_options { - char *device; - unsigned int yes:1; - unsigned int no:1; - unsigned int query:1; - unsigned int preen:1; - unsigned int force:1; -}; - extern struct fsck_options opts; extern struct lgfs2_inode *lf_dip; /* Lost and found directory inode */ extern int lf_was_created; diff --git a/gfs2/fsck/initialize.c b/gfs2/fsck/initialize.c index efceb271..c5160acc 100644 --- a/gfs2/fsck/initialize.c +++ b/gfs2/fsck/initialize.c @@ -1545,8 +1545,7 @@ static int init_rindex(struct lgfs2_sbd *sdp) * initialize - initialize superblock pointer * */ -int initialize(struct fsck_cx *cx, int force_check, int preen, - int *all_clean) +int initialize(struct fsck_cx *cx, const struct fsck_options * const _opts, int *all_clean) { struct lgfs2_sbd *sdp = cx->sdp; int clean_journals = 0, open_flag; @@ -1601,7 +1600,7 @@ int initialize(struct fsck_cx *cx, int force_check, int preen, return err;
/* Change lock protocol to be fsck_* instead of lock_* */ - if (!opts.no && preen_is_safe(sdp, preen, force_check)) { + if (!opts.no && preen_is_safe(sdp, _opts->preen, _opts->force)) { if (block_mounters(sdp, 1)) { log_err( _("Unable to block other mounters\n")); return FSCK_USAGE; @@ -1653,19 +1652,18 @@ int initialize(struct fsck_cx *cx, int force_check, int preen, if (sdp->gfs1) { if (reconstruct_journals(sdp)) return FSCK_ERROR; - } else if (replay_journals(cx, preen, force_check, - &clean_journals)) { - if (!opts.no && preen_is_safe(sdp, preen, force_check)) + } else if (replay_journals(cx, _opts->preen, _opts->force, &clean_journals)) { + if (!opts.no && preen_is_safe(sdp, _opts->preen, _opts->force)) block_mounters(sdp, 0); stack; return FSCK_ERROR; } if (sdp->md.journals == clean_journals) *all_clean = 1; - else if (force_check || !preen) + else if (_opts->force || !_opts->preen) log_notice( _("\nJournal recovery complete.\n"));
- if (!force_check && *all_clean && preen) + if (!_opts->force && *all_clean && _opts->preen) return FSCK_OK; }
diff --git a/gfs2/fsck/main.c b/gfs2/fsck/main.c index 47f9c287..86375bf4 100644 --- a/gfs2/fsck/main.c +++ b/gfs2/fsck/main.c @@ -325,7 +325,7 @@ int main(int argc, char **argv) exit(error); setbuf(stdout, NULL); log_notice( _("Initializing fsck\n")); - if ((error = initialize(&cx, opts.force, opts.preen, &all_clean))) + if ((error = initialize(&cx, &opts, &all_clean))) exit(error);
if (!opts.force && all_clean && opts.preen) {