From: Andrew Price <anprice@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 03/18] libgfs2: Move build_jindex() into fsck.gfs2
Date: Wed, 12 Jan 2022 19:26:35 +0000 [thread overview]
Message-ID: <20220112192650.1426415-4-anprice@redhat.com> (raw)
In-Reply-To: <20220112192650.1426415-1-anprice@redhat.com>
fsck.gfs2 is the only remaining util that builds journals this way so
move it out of libgfs2. The debug printfs can be removed because
fsck.gfs2 doesn't enable libgfs2's cfg_debug.
Signed-off-by: Andrew Price <anprice@redhat.com>
---
gfs2/fsck/fs_recovery.c | 21 +++++++++++++++++++++
gfs2/fsck/fs_recovery.h | 1 +
gfs2/fsck/pass2.c | 1 +
gfs2/libgfs2/libgfs2.h | 1 -
gfs2/libgfs2/structures.c | 29 -----------------------------
5 files changed, 23 insertions(+), 30 deletions(-)
diff --git a/gfs2/fsck/fs_recovery.c b/gfs2/fsck/fs_recovery.c
index 48d98626..e5cde051 100644
--- a/gfs2/fsck/fs_recovery.c
+++ b/gfs2/fsck/fs_recovery.c
@@ -848,6 +848,27 @@ static struct metawalk_fxns jindex_check_fxns = {
.check_dentry = check_jindex_dent,
};
+int build_jindex(struct gfs2_sbd *sdp)
+{
+ struct gfs2_inode *jindex;
+
+ jindex = createi(sdp->master_dir, "jindex", S_IFDIR | 0700,
+ GFS2_DIF_SYSTEM);
+ if (jindex == NULL) {
+ return errno;
+ }
+ sdp->md.journal = malloc(sdp->md.journals * sizeof(struct gfs2_inode *));
+ for (unsigned j = 0; j < sdp->md.journals; j++) {
+ int ret = build_journal(sdp, j, jindex);
+ if (ret)
+ return ret;
+ inode_put(&sdp->md.journal[j]);
+ }
+ free(sdp->md.journal);
+ inode_put(&jindex);
+ return 0;
+}
+
/**
* init_jindex - read in the rindex file
*/
diff --git a/gfs2/fsck/fs_recovery.h b/gfs2/fsck/fs_recovery.h
index d6876274..884d3c43 100644
--- a/gfs2/fsck/fs_recovery.h
+++ b/gfs2/fsck/fs_recovery.h
@@ -8,6 +8,7 @@ extern int replay_journals(struct gfs2_sbd *sdp, int preen, int force_check,
extern int preen_is_safe(struct gfs2_sbd *sdp, int preen, int force_check);
extern int ji_update(struct gfs2_sbd *sdp);
+extern int build_jindex(struct gfs2_sbd *sdp);
extern int init_jindex(struct gfs2_sbd *sdp, int allow_ji_rebuild);
#endif /* __FS_RECOVERY_H__ */
diff --git a/gfs2/fsck/pass2.c b/gfs2/fsck/pass2.c
index 998b0c96..0ab35b55 100644
--- a/gfs2/fsck/pass2.c
+++ b/gfs2/fsck/pass2.c
@@ -18,6 +18,7 @@
#include "lost_n_found.h"
#include "inode_hash.h"
#include "afterpass1_common.h"
+#include "fs_recovery.h"
#define MAX_FILENAME 256
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index 990a9d9e..9a66b5b3 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -776,7 +776,6 @@ extern int build_master(struct gfs2_sbd *sdp);
extern int lgfs2_sb_write(const struct gfs2_sbd *sdp, int fd);
extern int build_journal(struct gfs2_sbd *sdp, int j,
struct gfs2_inode *jindex);
-extern int build_jindex(struct gfs2_sbd *sdp);
extern struct gfs2_inode *lgfs2_build_jindex(struct gfs2_inode *metafs, struct lgfs2_inum *jnls, size_t nmemb);
extern int build_per_node(struct gfs2_sbd *sdp);
extern int build_inum(struct gfs2_sbd *sdp);
diff --git a/gfs2/libgfs2/structures.c b/gfs2/libgfs2/structures.c
index de36c4e3..09d7041e 100644
--- a/gfs2/libgfs2/structures.c
+++ b/gfs2/libgfs2/structures.c
@@ -279,35 +279,6 @@ struct gfs2_inode *lgfs2_build_jindex(struct gfs2_inode *master, struct lgfs2_in
return jindex;
}
-int build_jindex(struct gfs2_sbd *sdp)
-{
- struct gfs2_inode *jindex;
- unsigned int j;
- int ret;
-
- jindex = createi(sdp->master_dir, "jindex", S_IFDIR | 0700,
- GFS2_DIF_SYSTEM);
- if (jindex == NULL) {
- return errno;
- }
- sdp->md.journal = malloc(sdp->md.journals *
- sizeof(struct gfs2_inode *));
- for (j = 0; j < sdp->md.journals; j++) {
- ret = build_journal(sdp, j, jindex);
- if (ret)
- return ret;
- inode_put(&sdp->md.journal[j]);
- }
- if (cfg_debug) {
- printf("\nJindex:\n");
- lgfs2_dinode_print(jindex->i_bh->b_data);
- }
-
- free(sdp->md.journal);
- inode_put(&jindex);
- return 0;
-}
-
int build_inum_range(struct gfs2_inode *per_node, unsigned int j)
{
char name[256];
--
2.34.1
next prev parent reply other threads:[~2022-01-12 19:26 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-12 19:26 [Cluster-devel] [PATCH 00/18] gfs2-utils: Don't require an external print_it() in libgfs2 Andrew Price
2022-01-12 19:26 ` [Cluster-devel] [PATCH 01/18] libgfs2: Move debugging printf out of build_master() Andrew Price
2022-01-12 19:26 ` [Cluster-devel] [PATCH 02/18] libgfs2: Rework lgfs2_build_jindex() Andrew Price
2022-01-12 19:26 ` Andrew Price [this message]
2022-01-12 19:26 ` [Cluster-devel] [PATCH 04/18] libgfs2: Push down build_per_node() into the utils Andrew Price
2022-01-12 19:26 ` [Cluster-devel] [PATCH 05/18] libgfs2: Return the inode from build_inum_range() Andrew Price
2022-01-12 19:26 ` [Cluster-devel] [PATCH 06/18] libgfs2: Return the inode from build_statfs_change() Andrew Price
2022-01-12 19:26 ` [Cluster-devel] [PATCH 07/18] libgfs2: Return the inode from build_quota_change() Andrew Price
2022-01-12 19:26 ` [Cluster-devel] [PATCH 08/18] libgfs2: Return the inode from build_inum() Andrew Price
2022-01-12 19:26 ` [Cluster-devel] [PATCH 09/18] libgfs2: Return the inode from build_statfs() Andrew Price
2022-01-12 19:26 ` [Cluster-devel] [PATCH 10/18] libgfs2: Return the inode from build_rindex() Andrew Price
2022-01-12 19:26 ` [Cluster-devel] [PATCH 11/18] libgfs2: Return the inode from build_quota() Andrew Price
2022-01-12 19:26 ` [Cluster-devel] [PATCH 12/18] libgfs2: Move debugging printf out of build_root() Andrew Price
2022-01-12 19:26 ` [Cluster-devel] [PATCH 13/18] libgfs2: Remove debugging printf from do_init_statfs() Andrew Price
2022-01-12 19:26 ` [Cluster-devel] [PATCH 14/18] libgfs2: Move debugging output out of do_init_inum() Andrew Price
2022-01-12 19:26 ` [Cluster-devel] [PATCH 15/18] libgfs2: Remove debugging printfs from fix_device_geometry() Andrew Price
2022-01-12 19:26 ` [Cluster-devel] [PATCH 16/18] libgfs2: Remove config.[ch] Andrew Price
2022-01-12 19:26 ` [Cluster-devel] [PATCH 17/18] libgfs2: Move struct printing functions out of libgfs2 Andrew Price
2022-01-12 19:26 ` [Cluster-devel] [PATCH 18/18] libgfs2: Remove print_it extern requirement Andrew Price
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220112192650.1426415-4-anprice@redhat.com \
--to=anprice@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).