[Ocfs2-tools-devel] [PATCH] o2image: dx_dirs support

Coly Li coly.li at suse.de
Thu May 20 02:26:00 PDT 2010



On 05/20/2010 11:49 AM, Wengang Wang Wrote:
> On 10-05-20 11:51, Coly Li wrote:
>>
>>
>> On 05/20/2010 10:20 AM, Mark Fasheh Wrote:
>>> O2image wasn't picking up the entire dx_tree. This adds detection of an
>>> indexed dir to o2image so that it can traverse the tree in dx_root->dr_list
>>> and record the meta data within.
>>>
>>> Signed-off-by: Mark Fasheh <mfasheh at suse.com>
>>> ---
>>>  o2image/o2image.c |   33 ++++++++++++++++++++++++++++++++-
>>>  1 files changed, 32 insertions(+), 1 deletions(-)
>>>
>>> diff --git a/o2image/o2image.c b/o2image/o2image.c
>> [snip]
>>>  static errcode_t traverse_inode(ocfs2_filesys *ofs, uint64_t inode)
>>>  {
>>>  	struct ocfs2_super_block *super;
>>> @@ -234,9 +260,14 @@ static errcode_t traverse_inode(ocfs2_filesys *ofs, uint64_t inode)
>>>  		ret = traverse_chains(ofs, &(di->id2.i_chain), dump_type);
>>>  	else if (di->i_flags & OCFS2_DEALLOC_FL)
>>>  		ret = mark_dealloc_bits(ofs, &(di->id2.i_dealloc));
>>> -	else
>>> +	else {
>>> +		if (S_ISDIR(di->i_mode) &&
>>> +		    (di->i_dyn_features & OCFS2_INDEXED_DIR_FL)) {
>>> +			ret = traverse_dx_root(ofs, di->i_dx_root);
>>> +		}
>>
>> Hi Mark,
>>
>> How about call ocfs2_supports_indexed_dirs() before check di->i_dyn_features, like this,
>> +	else {
>> +		if (S_ISDIR(di->i_mode) &&
>> +		    ocfs2_supports_indexed_dirs(super) &&
>> +		    (di->i_dyn_features & OCFS2_INDEXED_DIR_FL)) {
>> +			ret = traverse_dx_root(ofs, di->i_dx_root);
>> +		}
> Hi Coly,
> If this can happen(I'm not sure), seems we shouldn't add the super
> check.
> 
> indexed dir feature enabled when mkfs or tunefs;
> then some indexed dirs created on disk;
> indexed dir feature disabled by tunefs;
> o2image;
> 

In the above example, if everything goes well, only check i_dyn_features for OCFS2_INDEXED_DIR_FL is enough.
But I worry about when something unexpected happens, e.g. a tunefs.ocfs2 to truncate indexed tree failed. In this
uncommon cases, it's possible that indexed-dirs is cleared from super block's flag, and user don't want the unnecessary
indexed tree meta data.

-- 
Coly Li
SuSE Labs



More information about the Ocfs2-tools-devel mailing list