[Ocfs2-tools-devel] [PATCH 3/3] Ocfs2-tools: Implement new prompt codes of journal for fswreck.

Joel Becker Joel.Becker at oracle.com
Thu Jul 2 15:21:37 PDT 2009


On Thu, Jul 02, 2009 at 02:52:39PM +0800, Tristan Ye wrote:
> We want fswreck to support journal's corruptions as fsck.ocfs2
> has had such kind of prompt codes already.
> 
> Signed-off-by: Tristan Ye <tristan.ye at oracle.com>
> ---
>  fswreck/Makefile            |    3 +-
>  fswreck/corrupt.c           |   12 +++
>  fswreck/include/fsck_type.h |    6 ++
>  fswreck/include/journal.h   |   23 ++++++
>  fswreck/include/main.h      |    1 +
>  fswreck/journal.c           |  174 +++++++++++++++++++++++++++++++++++++++++++
>  fswreck/main.c              |    8 ++
>  7 files changed, 225 insertions(+), 2 deletions(-)
>  create mode 100644 fswreck/include/journal.h
>  create mode 100644 fswreck/journal.c
> 
> diff --git a/fswreck/Makefile b/fswreck/Makefile
> index 3848cc2..bfd937b 100644
> --- a/fswreck/Makefile
> +++ b/fswreck/Makefile
> @@ -10,12 +10,11 @@ INCLUDES += $(GLIB_CFLAGS)
>  
>  UNINST_PROGRAMS = fswreck
>  
> -CFILES = main.c corrupt.c chain.c extent.c group.c inode.c local_alloc.c truncate_log.c special.c symlink.c dir.c
> +CFILES = main.c corrupt.c chain.c extent.c group.c inode.c local_alloc.c truncate_log.c special.c symlink.c dir.c journal.c
>  
>  HFILES = 			\
>  	include/main.h		\
>  	include/corrupt.h	\
> -	include/chain.c
>  
>  OBJS = $(subst .c,.o,$(CFILES))
>  
> diff --git a/fswreck/corrupt.c b/fswreck/corrupt.c
> index a9e5188..484b21e 100644
> --- a/fswreck/corrupt.c
> +++ b/fswreck/corrupt.c
> @@ -323,6 +323,18 @@ void corrupt_sys_file(ocfs2_filesys *fs, enum fsck_type type, uint16_t slotnum)
>  	case INODE_ALLOC_REPAIR:
>  		func = mess_up_inode_alloc;
>  		break;
> +	case JOURNAL_FILE_INVALID:
> +		func = mess_up_journal;
> +		break;
> +	case JOURNAL_UNKNOWN_FEATURE:
> +		func = mess_up_journal;
> +		break;
> +	case JOURNAL_MISS_FEATURE:
> +		func = mess_up_journal;
> +		break;
> +	case JOURNAL_TOO_SMALL:
> +		func = mess_up_journal;
> +		break;

	I would think this reads better as:

+	case JOURNAL_FILE_INVALID:
+	case JOURNAL_UNKNOWN_FEATURE:
+	case JOURNAL_MISSING_FEATURE:
+	case JOURNAL_TOO_SMALL:
+		func = mess_up_journal;
+		break;


> +	case JOURNAL_UNKNOWN_FEATURE:
> +		jsb->s_feature_incompat |= ~JBD2_KNOWN_INCOMPAT_FEATURES;
> +		jsb->s_feature_ro_compat |= ~JBD2_KNOWN_ROCOMPAT_FEATURES;
> +		fprintf(stdout, "JOURNAL_FILE_INVALID: "
> +			"Corrupt journal system inode#%"PRIu64" by "
> +			"adding unsupported features.\n", j_blkno);
> +		break;

	Don't you want to print JOURNAL_UNKNOWN_FEATURE: here?  Same
with the other ones.

Joel

-- 

"I always thought the hardest questions were those I could not answer.
 Now I know they are the ones I can never ask."
			- Charlie Watkins

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker at oracle.com
Phone: (650) 506-8127



More information about the Ocfs2-tools-devel mailing list