On 2018年04月24日 19:30, David Sterba wrote:
> On Tue, Apr 24, 2018 at 07:28:27PM +0800, Qu Wenruo wrote:
>>> I've read the discussion under previous version again, IMHO the best way
>>> to report what's going on is to use 2 functions for mount ant pre-commit
>>> time.
>>
>> OK, next version will go that direction.
>>
>> Although it may still be a little tricky to split what we need in
>> btrfs_validate_super() and btrfs_precheck_super().
>>
>> What about this idea:
>> - btrfs_precheck_super() only checks the very basis:
>>   * magic
>>   * incompat flags
>>   * csum type
>>   Any mismatch will do friendly prompt ("no btrfs detected" or
>>   "unsupported flags/csum type" respectively)
>>
>> - btrfs_validate_super() do the comprehensive check:
>>   * Everything we did in this patchset
>>   * including magic, incompat flags and csum type
>>   Any mismatch will be considered as corruption.
>>
>> For mount time, we call btrfs_precheck_super() then btrfs_validate_super().
>>
>> For commit time, only btrfs_validate_super().
>>
>> How about this solution?
> 
> I'd do that the other way around:
> 
> * mount checks: btrfs_validate_super - the superblock on disk must be
>   valid before we mount it
> 
>   btrfs_validate_super()
> 
> * pre-commit checks: the superblock must be valid and we can also do
>   some additional checks to detect in-memory corruption
> 
>   btrfs_super_precommit_check()
>         btrfs_validate_super()
>         if (incompat) {
>                 ...
>         }

Understood.

I'll try this one in next one.

Thanks,
Qu

> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to