Hi Matt,

Thanks for the reply.
So can it happen like block gets physically allocate in one txg (say
txg=123) using metaslab_alloc()
So the blkptr will have only blk_birth=123 and bkp_phys_birth=0.
Later on this block gets assigned to a Dnode (lets say ion txg 456) then we
can modify the blkptr as blk_birth=456 and blk_phys_birth=123.

Would this work? this would work only in case we have dedupe enabled.

Thanks,
Gaurav


On Tue, Oct 15, 2013 at 10:59 AM, Matthew Ahrens <mahr...@delphix.com>wrote:

> On Wed, Oct 9, 2013 at 3:35 AM, Gaurav Mahajan <gaurav...@gmail.com>wrote:
>
>> Hi,
>>
>> I am new to ZFS and trying to understand the code and workflow.
>>
>> In blkptr structure there are blk_phys_birth and blk_birth are nothing
>> but the txgs.
>>
>> What is the difference between them?
>> How DDT uses these two fields?
>>
>> typedef struct blkptr {
>> ....
>>     uint64_t    blk_phys_birth;  /* txg when block was allocated */
>>     uint64_t    blk_birth;  /* transaction group at birth       */
>> .....
>> } blkptr_t;
>>
>>
> blk_birth_phys is when the block was allocated.
> blk_birth is when this particular reference was created.
>
> If the block is dedup'ed, blk_birth_phys can be before blk_birth.  (The
> block was allocated at time A, then another reference was added to that
> block at a later time B.)
>
> If they are the same (e.g. as is the case for all non-dedup'ed blocks), we
> only store blk_birth.  (I believe this is for backwards compatibility with
> software that doesn't understand dedup (pool version 21)).
>
> blk_birth_phys is used by the SPA, for example when resilvering devices
> that were temporarily offline.
>
> blk_birth is used by the DMU and DSL, for example to determine when to
> free a block, or what blocks should be part of a zfs send stream.
>
> --matt
>
> To unsubscribe from this group and stop receiving emails from it, send an
> email to zfs-devel+unsubscr...@zfsonlinux.org.
>
_______________________________________________
developer mailing list
developer@open-zfs.org
http://lists.open-zfs.org/mailman/listinfo/developer

Reply via email to