cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Bob Peterson <rpeterso@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [fsck.gfs2 v2 PATCH 07/40] fsck.gfs2: Move set_ip_blockmap to pass1
Date: Fri,  6 May 2016 12:39:00 -0500	[thread overview]
Message-ID: <eaa8a0cb8c8047c9cc41615a74ce1107a50e3ecf.1462556087.git.rpeterso@redhat.com> (raw)
In-Reply-To: <cover.1462555424.git.rpeterso@redhat.com>

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@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



  parent reply	other threads:[~2016-05-06 17:39 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-06 17:38 [Cluster-devel] [fsck.gfs2 v2 PATCH 00/40] fsck.gfs2: memory reduction patches Bob Peterson
2016-05-06 17:38 ` [Cluster-devel] [fsck.gfs2 v2 PATCH 01/40] fsck.gfs2: Move pass5 to immediately follow pass1 Bob Peterson
2016-05-06 17:38 ` [Cluster-devel] [fsck.gfs2 v2 PATCH 02/40] fsck.gfs2: Convert block_type to bitmap_type after pass1 and 5 Bob Peterson
2016-05-06 17:38 ` [Cluster-devel] [fsck.gfs2 v2 PATCH 03/40] fsck.gfs2: Change bitmap_type variables to int Bob Peterson
2016-05-06 17:38 ` [Cluster-devel] [fsck.gfs2 v2 PATCH 04/40] fsck.gfs2: Use di_entries to determine if lost+found was created Bob Peterson
2016-05-06 17:38 ` [Cluster-devel] [fsck.gfs2 v2 PATCH 05/40] fsck.gfs2: pass1b shouldn't complain about non-bitmap blocks Bob Peterson
2016-05-06 17:38 ` [Cluster-devel] [fsck.gfs2 v2 PATCH 06/40] fsck.gfs2: Change all fsck_blockmap_set to fsck_bitmap_set Bob Peterson
2016-05-06 17:39 ` Bob Peterson [this message]
2016-05-06 17:39 ` [Cluster-devel] [fsck.gfs2 v2 PATCH 08/40] fsck.gfs2: Remove unneeded parameter instree from set_ip_blockmap Bob Peterson
2016-05-06 17:39 ` [Cluster-devel] [fsck.gfs2 v2 PATCH 09/40] fsck.gfs2: Move leaf repair to pass2 Bob Peterson
2016-05-06 17:39 ` [Cluster-devel] [fsck.gfs2 v2 PATCH 10/40] fsck.gfs2: Eliminate astate code Bob Peterson
2016-05-06 17:39 ` [Cluster-devel] [fsck.gfs2 v2 PATCH 11/40] fsck.gfs2: Move reprocess code to pass1 Bob Peterson
2016-05-06 17:39 ` [Cluster-devel] [fsck.gfs2 v2 PATCH 12/40] fsck.gfs2: Separate out functions that may only be done after pass1 Bob Peterson
2016-05-09 14:55   ` Andrew Price
2016-05-09 16:35     ` Bob Peterson
2016-05-06 17:39 ` [Cluster-devel] [fsck.gfs2 v2 PATCH 13/40] fsck.gfs2: Divest check_metatree from fsck_blockmap_set Bob Peterson
2016-05-06 17:39 ` [Cluster-devel] [fsck.gfs2 v2 PATCH 14/40] fsck.gfs2: eliminate fsck_blockmap_set from check_eattr_entries Bob Peterson
2016-05-06 17:39 ` [Cluster-devel] [fsck.gfs2 v2 PATCH 15/40] fsck.gfs2: Move blockmap stuff to pass1.c Bob Peterson
2016-05-06 17:39 ` [Cluster-devel] [fsck.gfs2 v2 PATCH 16/40] fsck: make pass1 call bitmap reconciliation AKA pass5 Bob Peterson
2016-05-06 17:39 ` [Cluster-devel] [fsck.gfs2 v2 PATCH 17/40] fsck.gfs2: make blockmap global variable only to pass1 Bob Peterson
2016-05-06 17:39 ` [Cluster-devel] [fsck.gfs2 v2 PATCH 18/40] fsck.gfs2: Add wrapper function pass1_check_metatree Bob Peterson
2016-05-06 17:39 ` [Cluster-devel] [fsck.gfs2 v2 PATCH 19/40] fsck.gfs2: pass counted_links into fix_link_count in pass4 Bob Peterson
2016-05-06 17:39 ` [Cluster-devel] [fsck.gfs2 v2 PATCH 20/40] fsck.gfs2: refactor pass4 function scan_inode_list Bob Peterson
2016-05-06 17:39 ` [Cluster-devel] [fsck.gfs2 v2 PATCH 21/40] fsck.gfs2: More refactoring of " Bob Peterson
2016-05-06 17:39 ` [Cluster-devel] [fsck.gfs2 v2 PATCH 22/40] fsck.gfs2: Fix white space problems Bob Peterson
2016-05-06 17:39 ` [Cluster-devel] [fsck.gfs2 v2 PATCH 23/40] fsck.gfs2: move link count info for directories to directory tree Bob Peterson
2016-05-06 17:39 ` [Cluster-devel] [fsck.gfs2 v2 PATCH 24/40] fsck.gfs2: Use bitmaps instead of linked list for inodes w/nlink == 1 Bob Peterson
2016-05-06 17:39 ` [Cluster-devel] [fsck.gfs2 v2 PATCH 25/40] fsck.gfs2: Refactor check_n_fix_bitmap to make it more readable Bob Peterson
2016-05-06 17:39 ` [Cluster-devel] [fsck.gfs2 v2 PATCH 26/40] fsck.gfs2: adjust rgrp inode count when fixing bitmap Bob Peterson
2016-05-06 17:39 ` [Cluster-devel] [fsck.gfs2 v2 PATCH 27/40] fsck.gfs2: blocks cannot be UNLINKED in pass1b or after that Bob Peterson
2016-05-06 17:39 ` [Cluster-devel] [fsck.gfs2 v2 PATCH 28/40] fsck.gfs2: Add error checks to get_next_leaf Bob Peterson
2016-05-06 17:39 ` [Cluster-devel] [fsck.gfs2 v2 PATCH 29/40] fsck.gfs2: re-add a non-allocating repair_leaf to pass1 Bob Peterson
2016-05-06 17:39 ` [Cluster-devel] [fsck.gfs2 v2 PATCH 30/40] libgfs2: Allocate new GFS1 metadata as type 3, not type 1 Bob Peterson
2016-05-06 17:39 ` [Cluster-devel] [fsck.gfs2 v2 PATCH 31/40] fsck.gfs2: Undo partially done metadata records Bob Peterson
2016-05-06 17:39 ` [Cluster-devel] [fsck.gfs2 v2 PATCH 32/40] fsck.gfs2: Eliminate redundant code in _fsck_bitmap_set Bob Peterson
2016-05-06 17:39 ` [Cluster-devel] [fsck.gfs2 v2 PATCH 33/40] fsck.gfs2: Fix inode counting bug Bob Peterson
2016-05-06 17:39 ` [Cluster-devel] [fsck.gfs2 v2 PATCH 34/40] fsck.gfs2: Adjust bitmap for lost+found after adding to dirtree Bob Peterson
2016-05-06 17:39 ` [Cluster-devel] [fsck.gfs2 v2 PATCH 35/40] GFS2: Add initialization checks for GFS1 used metadata Bob Peterson
2016-05-06 17:39 ` [Cluster-devel] [fsck.gfs2 v2 PATCH 36/40] fsck.gfs2: Use BLKST constants to make pass5 more clear Bob Peterson
2016-05-06 17:39 ` [Cluster-devel] [fsck.gfs2 v2 PATCH 37/40] fsck.gfs2: Fix GFS1 "used meta" accounting bug Bob Peterson
2016-05-06 17:39 ` [Cluster-devel] [fsck.gfs2 v2 PATCH 38/40] fsck.gfs2: pass1b is too noisy wrt gfs1 non-dinode metadata Bob Peterson
2016-05-06 17:39 ` [Cluster-devel] [fsck.gfs2 v2 PATCH 39/40] fsck.gfs2: Fix rgrp dinode accounting bug Bob Peterson
2016-05-06 17:39 ` [Cluster-devel] [fsck.gfs2 v2 PATCH 40/40] fsck.gfs2: Fix rgrp accounting in check_n_fix_bitmap Bob Peterson
2016-05-09 14:55 ` [Cluster-devel] [fsck.gfs2 v2 PATCH 00/40] fsck.gfs2: memory reduction patches Andrew Price
2016-05-09 17:48 ` Abhijith Das

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=eaa8a0cb8c8047c9cc41615a74ce1107a50e3ecf.1462556087.git.rpeterso@redhat.com \
    --to=rpeterso@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).