[Ocfs2-tools-devel] [PATCH 6/6] fsck.ocfs2: Do slot recovery.

Tao Ma tao.ma at oracle.com
Tue Sep 16 18:49:37 PDT 2008



Sunil Mushran wrote:
> comment inlined.
> 
> Tao Ma wrote:
>> In fsck.ocfs2, add the ability of slot recovery in fsck.ocfs2.
>> The whole process will work like this:
>> 1. Replay journal for all slots.
>> 2. Apply the truncate log and local alloc bits. Look for inconsistency.
>>    If any inconsistency, force a full fsck.
>> 3. If non-force fsck, replay orphan dirs. If error, force a full fsck.
>>    If not, go to step 6.
>> 4. If force fsck, fsck the entire fs.
>> 5. Remove the entries in orphan dirs.
>> 6. Reset the slot map and the journal dirty flags.
>>
>> Signed-off-by: Tao Ma <tao.ma at oracle.com>
>> ---
>>  fsck.ocfs2/fsck.c |   73 
>> ++++++++++++++++++++++++++++++++++++++++++++++++++++-
>>  1 files changed, 72 insertions(+), 1 deletions(-)
>>
>> diff --git a/fsck.ocfs2/fsck.c b/fsck.ocfs2/fsck.c
>> index ed275a3..b27c195 100644
>> --- a/fsck.ocfs2/fsck.c
>> +++ b/fsck.ocfs2/fsck.c
>> @@ -66,6 +66,7 @@
>>  #include "pass4.h"
>>  #include "problem.h"
>>  #include "util.h"
>> +#include "slot_recovery.h"
>>  
>>  int verbose = 0;
>>  
>> @@ -495,6 +496,43 @@ out:
>>      return ret;
>>  }
>>  
>> +/*
>> + * Do the slot recovery, replay truncate log, local aloc and orphan dir.
>> + * If there is any error, a force check is enabled.
>> + */
>> +static errcode_t o2fsck_slot_recovery(o2fsck_state *ost)
>> +{
>> +    errcode_t ret = 0;
>> +
>> +    if (!(ost->ost_fs->fs_flags & OCFS2_FLAG_RW)) {
>> +        printf("** Skipping slot recovery because -n was "
>> +               "given. **\n");
>> +        goto out;
>> +    }
>> +
>> +    ret = o2fsck_replay_truncate_logs(ost->ost_fs);
>> +    if (ret)
>> +        goto out;
>> +
>> +    ret = o2fsck_replay_local_allocs(ost->ost_fs);
>> +    if (ret)
>> +        goto out;
>> +
> 
> In the kernel, we replay local alloc before truncate log. Can
> we keep the same sequence here too. Not suggesting this is
> wrong... just trying to keep the two consistent as far as possible.

ok, thanks for your review. I will modify it with all the suggestions 
you have mentioned in previous e-mail.

Regards,
Tao



More information about the Ocfs2-tools-devel mailing list