[Ocfs2-tools-devel] [PATCH 08/15] dx_dirs v10: fsck.ocfs2 support
Coly Li
coly.li at suse.de
Sat Apr 10 23:28:03 PDT 2010
On 04/01/2010 07:12 AM, Mark Fasheh Wrote:
> On Thu, Mar 25, 2010 at 03:51:03AM +0800, Coly Li wrote:
>> This patch does a basic indexed dirs support in fsck.ocfs2.
>>
>> During pass2, if a directory block is changed, and indexed dirs in
>> enabled, the indexed tree of this directory will be
>> truncate, then rebuild with the modified directory data. All the
>> modified directories' inode numbers are recored in a
>> rb-tree, when all directories get scanned, truncate and rebuild the
>> directories whose inode recorded in the rb-tree.
>>
>> Signed-off-by: Coly Li <coly.li at suse.de>
>> Cc: Mark Fasheh <mfasheh at suse.com>
>> ---
>> fsck.ocfs2/dirblocks.c | 127 ++++++++++++++++++++++++++++++++++++++--
>> fsck.ocfs2/include/dirblocks.h | 4 +
>> fsck.ocfs2/pass1.c | 54 +++++++++++++++++
>> fsck.ocfs2/pass1b.c | 4 +-
>> fsck.ocfs2/pass2.c | 47 ++++++++++++++-
>> fsck.ocfs2/pass3.c | 1 +
>> fsck.ocfs2/pass4.c | 1 +
>> 7 files changed, 229 insertions(+), 9 deletions(-)
[snip]
>> diff --git a/fsck.ocfs2/pass1b.c b/fsck.ocfs2/pass1b.c
>> index 0ea87b4..3ca1d7d 100644
>> --- a/fsck.ocfs2/pass1b.c
>> +++ b/fsck.ocfs2/pass1b.c
[snip]
>> static int dirent_has_dots(struct ocfs2_dir_entry *dirent, int num_dots)
>> @@ -833,10 +835,11 @@ next:
>> }
>>
>> if (ocfs2_dir_has_trailer(dd->fs, di))
>> - fix_dir_trailer(dd->ost, dbe,
>> + fix_dir_trailer(dd->ost,
>> + dbe,
>> ocfs2_dir_trailer_from_block(dd->fs,
>> dd->dirblock_buf),
>> - &ret_flags);
>> + &ret_flags);
>>
>> if (ret_flags & OCFS2_DIRENT_CHANGED) {
>> if (di->i_dyn_features & OCFS2_INLINE_DATA_FL) {
>> @@ -851,15 +854,46 @@ next:
>> com_err(whoami, ret, "while writing dir block %"PRIu64,
>> dbe->e_blkno);
>> dd->ost->ost_write_error = 1;
>> + goto out;
>> + }
>> +
>> + if (ocfs2_supports_indexed_dirs(OCFS2_RAW_SB(dd->fs->fs_super)) &&
>> + !(di->i_dyn_features & OCFS2_INLINE_DATA_FL)) {
>> + ret = o2fsck_try_add_reidx_dir(&dd->re_idx_dirs, dbe->e_ino);
>> + if (ret) {
>> + com_err(whoami, ret, "while adding block for "
>> + "directory inode %"PRIu64" to rebuild "
>> + "dir index", dbe->e_ino);
>> + goto out;
>> + }
>> }
>
> The check here should be:
>
> if (ocfs2_supports_indexed_dirs(OCFS2_RAW_SB(dd->fs->fs_super)) &&
> !(di->i_dyn_features & OCFS2_INLINE_DATA_FL) &&
> (di->i_dyn_features & OCFS2_INDEXED_DIR_FL)) {
>
> We don't want to be rebuilding directories which weren't indexed to begin
> with.
Thanks for the catch, fixed in v11 patches.
--
Coly Li
SuSE Labs
More information about the Ocfs2-tools-devel
mailing list