[Ocfs2-tools-devel] [PATCH 11/15] dx_dirs v10: build indexed trees when enabling indexed-dirs
Coly Li
coly.li at suse.de
Sat Apr 10 23:27:51 PDT 2010
On 04/01/2010 06:54 AM, Mark Fasheh Wrote:
> 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?
>
Yes, if a disabled indexed-dirs directory has an indexed tree, this tree is unreliable. So the indexed tree must be rebuilt.
> Otherwise patch looks good, assuming we also pull in patch #13 ;)
>
> Acked-by: Mark Fasheh <mfasheh at suse.com>
>
Thanks for the review.
--
Coly Li
SuSE Labs
More information about the Ocfs2-tools-devel
mailing list