2008/11/12 Matthew Ahrens <Matthew.Ahrens at sun.com>:
> Chen Zheng wrote:
>>
>> Hi matt,
>>
>> I have some problems about understanding zfs COW implemention. Suppose
>>  b and c are both children dir of a,  if c changes,  there will be new
>> versions of both a and c, namely c' and a'.
>>
>>  a a'
>>  b c c'
>>
>
> Actually, there will not be a new version of A unless the name of C changes
> (or it is removed from A).  Adding or removing entries from C does not
> change A.
>>
>> Because '..' in b points to a before this change,  shall we modify b
>> to let '..' point to a'?
>
> If we did write out a new version of A (for example, when adding a new file
> "A/D"), then B's "pointer" to A will still be valid, because it references A
> by object number, not by block pointer (in zp_parent, as Eddie mentioned).
>
> --matt
>


Yes, understood, the old A and the new A just have the same object
number N: first alloc a new block,  write new A,  then modify objset's
slot N to let it point the new A, done

Does that mean that the two versions of A can't both exist in the same
objset?  And snapshot S which contains old A and current active fs
which contains new A,  must have independent objsets? So when creating
snapshots, objset of the fs should be cloned.  But in
dsl_dataset_snapshot_sync,  I found that
        dsphys->ds_bp = ds->ds_phys->ds_bp;
shows that newly created snapshot has a objset same as the fs,  where
is the clone work?  And if the objset is large, has millions of slots,
that will be lots of work to do.

I'm considering if backtracking pointer like 'parent' is allowed,  is
it still possibles that different versions of object can exist in the
same object set with different object numbers?

Matt, Eddie, thanks for your kindly help

-chenz

-- 
args are passed by ref, but bindings are local, variables are in fact
just a symbol referencing an object

Reply via email to