[Cluster-devel] [fsck.gfs2 v2 PATCH 07/40] fsck.gfs2: Move set_ip_blockmap to pass1
Bob Peterson
rpeterso at redhat.com
Fri May 6 17:39:00 UTC 2016
Since function set_ip_blockmap is now only called from pass1,
move it to pass1 and make it static.
Signed-off-by: Bob Peterson <rpeterso at redhat.com>
---
gfs2/fsck/pass1.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
gfs2/fsck/util.c | 50 --------------------------------------------------
gfs2/fsck/util.h | 1 -
3 files changed, 49 insertions(+), 51 deletions(-)
diff --git a/gfs2/fsck/pass1.c b/gfs2/fsck/pass1.c
index cc70d5f..e09bcb4 100644
--- a/gfs2/fsck/pass1.c
+++ b/gfs2/fsck/pass1.c
@@ -1141,6 +1141,55 @@ struct metawalk_fxns eattr_undo_fxns = {
.check_eattr_leaf = undo_eattr_indir_or_leaf,
.finish_eattr_indir = finish_eattr_indir,
};
+/* set_ip_blockmap - set the blockmap for a dinode
+ *
+ * instree: Set to 1 if directories should be inserted into the directory tree
+ * otherwise 0.
+ * returns: 0 if no error, -EINVAL if dinode has a bad mode, -EPERM on error
+ */
+static int set_ip_blockmap(struct gfs2_inode *ip, int instree)
+{
+ uint64_t block = ip->i_bh->b_blocknr;
+ uint32_t mode;
+ const char *ty;
+
+ if (ip->i_sbd->gfs1)
+ mode = gfs_to_gfs2_mode(ip);
+ else
+ mode = ip->i_di.di_mode & S_IFMT;
+
+ switch (mode) {
+ case S_IFDIR:
+ ty = _("directory");
+ break;
+ case S_IFREG:
+ ty = _("file");
+ break;
+ case S_IFLNK:
+ ty = _("symlink");
+ break;
+ case S_IFBLK:
+ ty = _("block device");
+ break;
+ case S_IFCHR:
+ ty = _("character device");
+ break;
+ case S_IFIFO:
+ ty = _("fifo");
+ break;
+ case S_IFSOCK:
+ ty = _("socket");
+ break;
+ default:
+ return -EINVAL;
+ }
+ if (fsck_blockmap_set(ip, block, ty, GFS2_BLKST_DINODE) ||
+ (mode == S_IFDIR && instree && !dirtree_insert(ip->i_di.di_num))) {
+ stack;
+ return -EPERM;
+ }
+ return 0;
+}
/*
* handle_ip - process an incore structure representing a dinode.
diff --git a/gfs2/fsck/util.c b/gfs2/fsck/util.c
index 55bd050..7ca7b91 100644
--- a/gfs2/fsck/util.c
+++ b/gfs2/fsck/util.c
@@ -591,56 +591,6 @@ void *gfs2_bmap_destroy(struct gfs2_sbd *sdp, struct gfs2_bmap *il)
return il;
}
-/* set_ip_blockmap - set the blockmap for a dinode
- *
- * instree: Set to 1 if directories should be inserted into the directory tree
- * otherwise 0.
- * returns: 0 if no error, -EINVAL if dinode has a bad mode, -EPERM on error
- */
-int set_ip_blockmap(struct gfs2_inode *ip, int instree)
-{
- uint64_t block = ip->i_bh->b_blocknr;
- uint32_t mode;
- const char *ty;
-
- if (ip->i_sbd->gfs1)
- mode = gfs_to_gfs2_mode(ip);
- else
- mode = ip->i_di.di_mode & S_IFMT;
-
- switch (mode) {
- case S_IFDIR:
- ty = _("directory");
- break;
- case S_IFREG:
- ty = _("file");
- break;
- case S_IFLNK:
- ty = _("symlink");
- break;
- case S_IFBLK:
- ty = _("block device");
- break;
- case S_IFCHR:
- ty = _("character device");
- break;
- case S_IFIFO:
- ty = _("fifo");
- break;
- case S_IFSOCK:
- ty = _("socket");
- break;
- default:
- return -EINVAL;
- }
- if (fsck_blockmap_set(ip, block, ty, GFS2_BLKST_DINODE) ||
- (mode == S_IFDIR && instree && !dirtree_insert(ip->i_di.di_num))) {
- stack;
- return -EPERM;
- }
- return 0;
-}
-
uint64_t find_free_blk(struct gfs2_sbd *sdp)
{
struct osi_node *n, *next = NULL;
diff --git a/gfs2/fsck/util.h b/gfs2/fsck/util.h
index 8709193..45a9000 100644
--- a/gfs2/fsck/util.h
+++ b/gfs2/fsck/util.h
@@ -119,7 +119,6 @@ extern struct gfs2_bmap *gfs2_bmap_create(struct gfs2_sbd *sdp, uint64_t size,
uint64_t *addl_mem_needed);
extern void *gfs2_bmap_destroy(struct gfs2_sbd *sdp, struct gfs2_bmap *il);
extern int gfs2_blockmap_set(struct gfs2_bmap *il, uint64_t block, int mark);
-extern int set_ip_blockmap(struct gfs2_inode *ip, int instree);
extern char generic_interrupt(const char *caller, const char *where,
const char *progress, const char *question,
const char *answers);
--
2.5.5
More information about the Cluster-devel
mailing list