[Ocfs2-tools-devel] [PATCH 4/9] libocfs2: Set and clear journal features.

Mark Fasheh mfasheh at suse.com
Tue Oct 14 18:06:39 PDT 2008


On Tue, Sep 09, 2008 at 05:57:11PM -0700, Joel Becker wrote:
> This adds functions to set and clear feature bits in the journal
> superblock.  Features are checked against the known feature set.
> 
> Signed-off-by: Joel Becker <joel.becker at oracle.com>
> ---
>  include/ocfs2/ocfs2.h |    4 +++
>  libocfs2/mkjournal.c  |   55 +++++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 59 insertions(+), 0 deletions(-)
> 
> diff --git a/include/ocfs2/ocfs2.h b/include/ocfs2/ocfs2.h
> index bdeadb9..8a7e865 100644
> --- a/include/ocfs2/ocfs2.h
> +++ b/include/ocfs2/ocfs2.h
> @@ -289,6 +289,10 @@ errcode_t ocfs2_write_journal_superblock(ocfs2_filesys *fs, uint64_t blkno,
>  					 char *jsb_buf);
>  errcode_t ocfs2_make_journal(ocfs2_filesys *fs, uint64_t blkno,
>  			     uint32_t clusters);
> +errcode_t ocfs2_journal_clear_features(journal_superblock_t *jsb,
> +				       ocfs2_fs_options *features);
> +errcode_t ocfs2_journal_set_features(journal_superblock_t *jsb,
> +				     ocfs2_fs_options *features);
>  extern size_t ocfs2_journal_tag_bytes(journal_superblock_t *jsb);
>  extern uint64_t ocfs2_journal_tag_block(journal_block_tag_t *tag,
>  					size_t tag_bytes);
> diff --git a/libocfs2/mkjournal.c b/libocfs2/mkjournal.c
> index e14a34d..35835f1 100644
> --- a/libocfs2/mkjournal.c
> +++ b/libocfs2/mkjournal.c
> @@ -50,6 +50,61 @@ uint64_t ocfs2_journal_tag_block(journal_block_tag_t *tag, size_t tag_bytes)
>  	return blockno;
>  }
>  
> +/* Returns true if we support these journal features */
> +static int ocfs2_journal_check_available_features(journal_superblock_t *jsb,
> +						  ocfs2_fs_options *features)
> +{
> +	if (!features->opt_compat && !features->opt_ro_compat &&
> +	    !features->opt_incompat)
> +		return 1;
> +
> +	if (jsb->s_header.h_blocktype != JBD2_SUPERBLOCK_V2)
> +		return 0;

Shouldn't this also check for JBD2_SUPERBLOCK_V1 somehow?
	--Mark

--
Mark Fasheh



More information about the Ocfs2-tools-devel mailing list