[Ocfs2-tools-devel] [PATCH 1/4] Ocfs2-tools: Classify duplicate prompt codes in fsck.ocfs2.

Tristan Ye tristan.ye at oracle.com
Wed Jun 24 03:44:12 PDT 2009


fsck.ocfs2 is supposed to only use each prompt code once. However,
about four of the codes are used in multiple places. We therefore
should make distinct codes for each case.

Signed-off-by: Tristan Ye <tristan.ye at oracle.com>
---
 fsck.ocfs2/fsck.ocfs2.checks.8.in |   68 ++++++++++++++++++++++++++++++++++--
 fsck.ocfs2/journal.c              |    6 ++--
 fsck.ocfs2/pass1.c                |    8 ++--
 fsck.ocfs2/xattr.c                |    7 ++--
 4 files changed, 75 insertions(+), 14 deletions(-)

diff --git a/fsck.ocfs2/fsck.ocfs2.checks.8.in b/fsck.ocfs2/fsck.ocfs2.checks.8.in
index b780561..2b8627f 100644
--- a/fsck.ocfs2/fsck.ocfs2.checks.8.in
+++ b/fsck.ocfs2/fsck.ocfs2.checks.8.in
@@ -473,6 +473,24 @@ Answering yes to this question updates the inode's i_size to match the amount
 of data referenced by the extent lists.  It is vitally important that i_size
 matches the extent lists and so answering yes is strongly encouraged.
 
+.SS "INODE_SPARSE_SIZE"
+Certain inodes record the size of the data they reference in an i_size field.
+This can be the number of bytes in a file, directory, or symlink target
+which are stored in data mapped by extents of clusters.  This error occurs
+when the extent lists are walked and the amount of data found does not match
+what is stored in i_size.
+
+Answering yes to this question updates the inode's i_size to match the amount
+of data referenced by the extent lists.  It is vitally important that i_size
+matches the extent lists and so answering yes is strongly encouraged.
+
+.SS "INODE_INLINE_SIZE"
+Inlined inodes store the max inline data size in i_size, this error occurs
+when the file size of an inlined inode exceeds the max inline data size.
+
+Answering yes to this question updates the inode's i_size to max inline data
+size.
+
 .SS "INODE_CLUSTERS"
 Inodes contain a record of how many clusters are allocated to them.  An inode
 was found whose recorded number of clusters doesn't match the number of blocks
@@ -481,6 +499,20 @@ that were found associated with the inode.
 Answering yes resets the inode's number of clusters to reflect the number
 of blocks that were associated with the file.
 
+.SS "INODE_SPARSE_CLUSTERS"
+Inodes contain a record of how many clusters are allocated to them.  An inode
+was found whose recorded number of clusters doesn't match the number of blocks
+that were found associated with the inode.
+
+Answering yes resets the inode's number of clusters to reflect the number
+of blocks that were associated with the file.
+
+.SS "INODE_INLINE_CLUSTERS"
+Inlined inode should not have allocated clusters.  An inode who has inline data
+flag set was found with clusters allocated.
+
+Answering yes resets the inode's number of clusters to zero.
+
 .SS "LALLOC_REPAIR"
 An active local allocator did not accurately reflect the set of clusters that
 are free and in use in its region.
@@ -710,10 +742,28 @@ Answering yes creates the orphan directory in the system directory.
 
 .SS "JOURNAL_FILE_INVALID"
 OCFS2 uses JDB for journalling and some journal files exist in the
-system directory. Fsck has found some journal file is whether empty or has
-bad journal superblock and would like to fix it for future use.
+system directory. Fsck has found some journal files are invalid.
+
+Answering yes to regenerate the journal file.
+
+.SS "JOURNAL_UNKNOWN_FEATURE"
+Fsck has found some journal files have unknown features, however, other
+journals have only known features, so this is likely a corruption.
+If you think your filesystem may be newer than this version of fsck.ocfs2,
+say N here and grab the latest version of fsck.ocfs2.
+
+Answering yes resets the journal features to math other journals.
+
+.SS "JOURNAL_MISS_FEATURE"
+Fsck has found some journal files are missing features that are set on
+other journal files.
 
-Answering yes reformats the journal file in the system directory.
+Answering yes sets these missing features.
+
+.SS "JOURNAL_TOO_SMALL"
+Fsck has found some journal files are too small.
+
+Answering yes extends these journals.
 
 .SS "RECOVER_CLUSTER_INFO"
 The currently active cluster stack is different than the one the filesystem
@@ -752,12 +802,22 @@ does not match the number of entries found by fsck.
 
 Answering yes will change this to the correct count.
 
-.SS "XATTR_OFFSET_INVALID"
+.SS "XATTR_ENTRY_INVALID"
+Extended attribute entry refers to a used area.
+
+Answering yes will remove this entry.
+
+.SS "XATTR_NAME_OFFSET_INVALID"
 The name_offset field of an extended attribute entry is not correct.
 Without a correct name_offset field, the entry cannot be used.
 
 Answering yes will remove this entry.
 
+.SS "XATTR_VALUE_INVALID"
+Extended attribute entry's value/name pair refers to a used area.
+
+Answering yes will remove this entry.
+
 .SS "XATTR_LOCATION_INVALID"
 The xe_local field and xe_value_size field of an extended attribute
 entry does not match. So the entry cannot be used.
diff --git a/fsck.ocfs2/journal.c b/fsck.ocfs2/journal.c
index 4ed7653..52d47a6 100644
--- a/fsck.ocfs2/journal.c
+++ b/fsck.ocfs2/journal.c
@@ -833,7 +833,7 @@ static errcode_t fix_journals_func(o2fsck_state *ost,
 
 	if ((ji->i_error == OCFS2_ET_UNSUPP_FEATURE) ||
 	    (ji->i_error == OCFS2_ET_RO_UNSUPP_FEATURE)) {
-		if (prompt(ost, PN, PR_JOURNAL_FILE_INVALID,
+		if (prompt(ost, PN, PR_JOURNAL_UNKNOWN_FEATURE,
 			   "journal file %s has unknown features.  "
 			   "However, other journals have only known "
 			   "features, so this is likely a corruption.  "
@@ -863,7 +863,7 @@ static errcode_t fix_journals_func(o2fsck_state *ost,
 		    jc->jc_max_features.opt_ro_compat) ||
 		   (ji->i_features.opt_incompat !=
 		    jc->jc_max_features.opt_incompat)) {
-		if (prompt(ost, PY, PR_JOURNAL_FILE_INVALID,
+		if (prompt(ost, PY, PR_JOURNAL_MISS_FEATURE,
 			   "journal file %s is missing features that "
 			   "are set on other journal files.  Set these "
 			   "features?",
@@ -885,7 +885,7 @@ static errcode_t fix_journals_func(o2fsck_state *ost,
 	}
 
 	if (ji->i_clusters != jc->jc_max_clusters) {
-		if (prompt(ost, PY, PR_JOURNAL_FILE_INVALID,
+		if (prompt(ost, PY, PR_JOURNAL_TOO_SMALL,
 			   "journal file %s is too small, extend it?",
 			   fname)) {
 			err = ocfs2_make_journal(fs, ci->ci_blkno,
diff --git a/fsck.ocfs2/pass1.c b/fsck.ocfs2/pass1.c
index 15880bc..6f32fcb 100644
--- a/fsck.ocfs2/pass1.c
+++ b/fsck.ocfs2/pass1.c
@@ -887,7 +887,7 @@ size_cluster_check:
 
 		/* i_size is checked for symlinks elsewhere */
 		if (di->i_size > max_inline &&
-		    prompt(ost, PY, PR_INODE_SIZE, "Inode %"PRIu64
+		    prompt(ost, PY, PR_INODE_INLINE_SIZE, "Inode %"PRIu64
 			   "has a size of %"PRIu64" which exceeds the max "
 			   "inline data size %u. "
 			   "Correct the file size?",
@@ -898,7 +898,7 @@ size_cluster_check:
 		}
 
 		if (di->i_clusters > 0 &&
-		    prompt(ost, PY, PR_INODE_CLUSTERS,
+		    prompt(ost, PY, PR_INODE_INLINE_CLUSTERS,
 			   "Inode %"PRIu64" has %"PRIu32" clusters but it has "
 			   "inline data flag set. "
 			   "Correct the number of clusters?",
@@ -916,7 +916,7 @@ size_cluster_check:
 
 			/* i_size is checked for symlinks elsewhere */
 			if (!S_ISLNK(di->i_mode) && di->i_size <= unexpected &&
-			    prompt(ost, PY, PR_INODE_SIZE, "Inode %"PRIu64
+			    prompt(ost, PY, PR_INODE_SPARSE_SIZE, "Inode %"PRIu64
 				   " has a size of %"PRIu64" but has %"PRIu64
 				   " blocks of actual data. "
 				   "Correct the file size?",
@@ -931,7 +931,7 @@ size_cluster_check:
 			expected = ocfs2_clusters_in_blocks(fs, vb.vb_num_blocks);
 
 		if (di->i_clusters != expected &&
-		    prompt(ost, PY, PR_INODE_CLUSTERS,
+		    prompt(ost, PY, PR_INODE_SPARSE_CLUSTERS,
 			   "Inode %"PRIu64" has %"PRIu32" clusters but its "
 			   "blocks fit in %"PRIu64" clusters. "
 			   "Correct the number of clusters?",
diff --git a/fsck.ocfs2/xattr.c b/fsck.ocfs2/xattr.c
index 7806234..98d81f7 100644
--- a/fsck.ocfs2/xattr.c
+++ b/fsck.ocfs2/xattr.c
@@ -247,7 +247,7 @@ static errcode_t check_xattr_entry(o2fsck_state *ost,
 		uint32_t hash;
 
 		if (check_area_fits(umap, XE_OFFSET(xh, xe), ENTRY_SIZE)) {
-			if (!prompt(ost, PY, PR_XATTR_OFFSET_INVALID,
+			if (!prompt(ost, PY, PR_XATTR_ENTRY_INVALID,
 				    "Extended attribute entry in %s #%"
 				    PRIu64" refers to a used area at %u,"
 				    " clear this entry?",
@@ -261,7 +261,7 @@ static errcode_t check_xattr_entry(o2fsck_state *ost,
 
 		/* check and fix name_offset */
 		if (xe->xe_name_offset >= xi->max_offset) {
-			if (!prompt(ost, PY, PR_XATTR_OFFSET_INVALID,
+			if (!prompt(ost, PY, PR_XATTR_NAME_OFFSET_INVALID,
 				    "Extended attribute entry in %s #%"PRIu64
 				    " refers to an invalid name offset %u,"
 				    " clear this entry?",
@@ -303,7 +303,7 @@ static errcode_t check_xattr_entry(o2fsck_state *ost,
 		value_len = ocfs2_xattr_value_real_size(xe->xe_name_len,
 							xe->xe_value_size);
 		if (check_area_fits(umap, xe->xe_name_offset, value_len)) {
-			if (!prompt(ost, PY, PR_XATTR_OFFSET_INVALID,
+			if (!prompt(ost, PY, PR_XATTR_VALUE_INVALID,
 				    "Extended attribute entry in %s #%"PRIu64
 				    " refers to a used area at %u,"
 				    " clear this entry?",
@@ -317,6 +317,7 @@ static errcode_t check_xattr_entry(o2fsck_state *ost,
 				goto wipe_entry;
 			}
 		}
+
 		/* mark the value area as used */
 		set_used_area(umap, xe->xe_name_offset, value_len, NULL);
 
-- 
1.5.5




More information about the Ocfs2-tools-devel mailing list