[Ocfs2-tools-devel] [PATCH 16/30] tunefs.ocfs2: move o2ne_add_tailers() into libocfs2ne.c
Joel Becker
Joel.Becker at oracle.com
Thu Apr 29 16:41:21 PDT 2010
On Thu, Apr 29, 2010 at 03:59:45PM -0700, Mark Fasheh wrote:
> > > @@ -300,11 +300,50 @@ struct tunefs_trailer_context {
> > > iteration of the directory */
> > > };
> > >
> > > +/* A dirblock we have to add a trailer to */
> > > +struct tunefs_trailer_dirblock {
> >
> > This structure doesn't need to be in the header, it is private
> > to the tunefs_trailer_context. The definition should be in
> > libocfs2ne.c.
>
> Good catch - how does the attached patch look?
Good, except I'd like to fix the comment while we're here.
> +/* A dirblock we have to add a trailer to */
> +struct tunefs_trailer_dirblock {
> + struct list_head db_list;
> + uint64_t db_blkno;
> + char *db_buf;
> +
> + /*
> + * These require a little explanation. They point to
> + * ocfs2_dir_entry structures inside db_buf.
> + *
+ * db_last is the entry we're going to *keep*. If the last entry in the
> + * dirblock has enough extra rec_len to allow the trailer, db_last
> + * points to it. We will shorten its rec_len and insert the
> + * trailer.
> + *
> + * However, if the last entry in the dirblock cannot be truncated,
+ * db_last points to the entry before that - the last entry we're
+ * keeping in this dirblock.
> + *
> + * Examples:
> + *
> + * - The last entry in the dirblock has a name_len of 1 and a
> + * rec_len of 128. We can easily change the rec_len to 64 and
> + * insert the trailer. db_last points to this entry.
> + *
> + * - The last entry in the dirblock has a name_len of 1 and a
> + * rec_len of 48. The previous entry has a name_len of 1 and a
> + * rec_len of 32. We have to move the last entry out. The
> + * second-to-last entry can have its rec_len truncated to 16, so
> + * we put it in db_last.
> + */
> + struct ocfs2_dir_entry *db_last;
> +};
Other than that, sob.
Joel
--
Life's Little Instruction Book #497
"Go down swinging."
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