Re: [PATCH v2 03/10] commit: add generation number to struct commmit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Apr 9, 2018 at 9:42 AM, Derrick Stolee <dstolee@xxxxxxxxxxxxx> wrote:
> The generation number of a commit is defined recursively as follows:
>
> * If a commit A has no parents, then the generation number of A is one.
> * If a commit A has parents, then the generation number of A is one
>   more than the maximum generation number among the parents of A.
>
> Add a uint32_t generation field to struct commit so we can pass this
> information to revision walks. We use two special values to signal
> the generation number is invalid:
>
> GENERATION_NUMBER_ININITY 0xFFFFFFFF

GENERATION_NUMBER_INFINITY

On disk we currently only store up to 2^30-1,
(2 bits fewer than MAX_UINT_32), but here we just take the maximum
value of what a uint32_t can store. That miss match should not be a
problem albeit aesthetically.

Once we run into scaling problems, we can just up to uint64_t in the code,
and defer the solution on disk to a new file format.

With both ZERO and _INFINITY we are at the border of uint
wrap-around, so we have to be very careful to not add/subtract
one and then compare. Just to watch out for when reviewing.



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux