[Ocfs2-tools-devel] [PATCH 11/15] dx_dirs v10: build indexed trees when enabling indexed-dirs
Mark Fasheh
mfasheh at suse.com
Wed Mar 31 15:54:29 PDT 2010
On Thu, Mar 25, 2010 at 03:51:40AM +0800, Coly Li wrote:
> Previos enable indexed-dirs implementation only set superblock flag,
> does not build indexed trees for existed directories.
> Tis patch tries to build indexed trees for directories when enable
> indexed-dirs.
>
> Signed-off-by: Coly Li <coly.li at suse.de>
> Cc: Mark Fasheh <mfasheh at suse.com>
> ---
> tunefs.ocfs2/feature_indexed_dirs.c | 63 +++++++++++++++++++++++++++++++----
> tunefs.ocfs2/o2ne_err.et | 3 ++
> 2 files changed, 59 insertions(+), 7 deletions(-)
>
> diff --git a/tunefs.ocfs2/feature_indexed_dirs.c b/tunefs.ocfs2/feature_indexed_dirs.c
> index e9f87fb..45fed19 100644
> --- a/tunefs.ocfs2/feature_indexed_dirs.c
> +++ b/tunefs.ocfs2/feature_indexed_dirs.c
> @@ -42,11 +42,42 @@ struct dx_dirs_context {
> struct tools_progress *prog;
> };
>
> +static errcode_t build_dx_dir(ocfs2_filesys *fs, struct ocfs2_dinode *di,
> + void *user_data)
> +{
> + errcode_t ret = 0;
> + struct dx_dirs_context *ctxt = (struct dx_dirs_context *)user_data;
> +
> + if (!S_ISDIR(di->i_mode))
> + goto bail;
> +
> + if (di->i_dyn_features & OCFS2_INDEXED_DIR_FL) {
> + verbosef(VL_APP,
> + "Directory inode %llu already has an indexed tree, "
> + "rebuild the indexed tree.\n", di->i_blkno);
> + ret = ocfs2_dx_dir_truncate(fs, di->i_blkno);
> + if (ret) {
> + ret = TUNEFS_ET_DX_DIRS_TRUNCATE_FAILED;
> + tcom_err(ret, "while rebulid indexed tree");
> + }
A short description of why you're truncating existing dx_dirs would be good
- I assume it's a precaution in case they were from a previous, failed
tunefs?
Otherwise patch looks good, assuming we also pull in patch #13 ;)
Acked-by: Mark Fasheh <mfasheh at suse.com>
--
Mark Fasheh
More information about the Ocfs2-tools-devel
mailing list