On 4/22/13 4:31 AM, Anand Jain wrote:
>
>> /*
>> - * If the btrfs-progs is newer and kernel is at
>> - * generation_v1 then we don't touch v2 items
>> - * otherwise when kernel is at same or greater
>> - * version compared with btrfs-progs then update
>> - * the needed
>> - */
>> - old_size = btrfs_item_size_nr(l, slot);
>> - if (old_size >= sizeof(*item)) {
>> - btrfs_set_root_generation_v2(item,
>> - btrfs_root_generation(item));
>> + * If this is the first time we update the root item which originated
>> + * from an older kernel, we need to enlarge the item size to make room
>> + * for the added fields.
>> + */
>> + if (old_len < sizeof(*item)) {
>
> With this fix. when kernel is using v1 and btrfs-progs is
> using v2, the disk structure will be changed to v2 after
> running btrfs check. I would rather take a conservative
> approach, by maintaining kernel intended version.
If the kernel can do it, it should be safe for userspace to do it
as well. An old kernel will have a smaller btrfs_root_item size,
and won't even see the new fields when it reads the roots, I think.
And this has the advantage of not further diverging userspace
from kernelspace which, as we've seen, leads to bugs. :)
Thanks,
-Eric
> Thanks, Anand
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html