[Ocfs2-tools-devel] [PATCH 4/9] libocfs2: Set and clear journal features.
Joel Becker
Joel.Becker at oracle.com
Tue Oct 14 18:19:43 PDT 2008
On Tue, Oct 14, 2008 at 06:06:39PM -0700, Mark Fasheh wrote:
> 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
It does by returning false when anything but V2. Basically,
those lines of context you included are:
- Can we support the journal features in *features?
- if you aren't asking for any features at all, return "yes"
- if the header is not V2, return "no"
So, if you ask for anything but the default feature set, you're required
to have a V2 superblock. I think that's safe.
Joel
--
"Too much walking shoes worn thin.
Too much trippin' and my soul's worn thin.
Time to catch a ride it leaves today
Her name is what it means.
Too much walking shoes worn thin."
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