Updated comments to prefer "canonical checksum" for rbyd checksums
I think this describes the goal of the non-perturbed rbyd checksums decently. At the very least it's less wrong that "data checksum", and calling it the "metadata checksum" would just be confusing. (Would our commit checksum be the "metametadata checksum" then?)
This commit is contained in:
@@ -2284,7 +2284,7 @@ static int lfsr_rbyd_fetch(lfs_t *lfs, lfsr_rbyd_t *rbyd,
|
|||||||
rbyd->weight = weight;
|
rbyd->weight = weight;
|
||||||
ecksum = ecksum_;
|
ecksum = ecksum_;
|
||||||
|
|
||||||
// revert to data checksum
|
// revert to canonical checksum
|
||||||
cksum_ = cksum;
|
cksum_ = cksum;
|
||||||
ecksum_.cksize = -1;
|
ecksum_.cksize = -1;
|
||||||
}
|
}
|
||||||
@@ -2311,7 +2311,7 @@ static int lfsr_rbyd_fetch(lfs_t *lfs, lfsr_rbyd_t *rbyd,
|
|||||||
|
|
||||||
// end of trunk?
|
// end of trunk?
|
||||||
if (!lfsr_tag_isalt(tag)) {
|
if (!lfsr_tag_isalt(tag)) {
|
||||||
// update data checksum
|
// update canonical checksum
|
||||||
cksum = cksum_;
|
cksum = cksum_;
|
||||||
// update trunk and weight, unless we are a shrub trunk
|
// update trunk and weight, unless we are a shrub trunk
|
||||||
if (!lfsr_tag_isshrub(tag) || trunk__ == trunk) {
|
if (!lfsr_tag_isshrub(tag) || trunk__ == trunk) {
|
||||||
@@ -3371,7 +3371,7 @@ static int lfsr_rbyd_appendcksum(lfs_t *lfs, lfsr_rbyd_t *rbyd) {
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
// save the data checksum
|
// save the canonical checksum
|
||||||
uint32_t cksum = rbyd->cksum;
|
uint32_t cksum = rbyd->cksum;
|
||||||
|
|
||||||
// align to the next prog unit
|
// align to the next prog unit
|
||||||
@@ -3501,7 +3501,7 @@ static int lfsr_rbyd_appendcksum(lfs_t *lfs, lfsr_rbyd_t *rbyd) {
|
|||||||
= ((lfs_size_t)perturb
|
= ((lfs_size_t)perturb
|
||||||
<< (8*sizeof(lfs_size_t)-1))
|
<< (8*sizeof(lfs_size_t)-1))
|
||||||
| off_;
|
| off_;
|
||||||
// revert to data checksum
|
// revert to canonical checksum
|
||||||
rbyd->cksum = cksum;
|
rbyd->cksum = cksum;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -713,7 +713,7 @@ class Rbyd:
|
|||||||
|
|
||||||
# end of trunk?
|
# end of trunk?
|
||||||
if not tag & TAG_ALT:
|
if not tag & TAG_ALT:
|
||||||
# update data checksum
|
# update canonical checksum
|
||||||
cksum_ = cksum__
|
cksum_ = cksum__
|
||||||
# update trunk/weight unless we found a shrub or an
|
# update trunk/weight unless we found a shrub or an
|
||||||
# explicit trunk (which may be a shrub) is requested
|
# explicit trunk (which may be a shrub) is requested
|
||||||
|
|||||||
+1
-1
@@ -386,7 +386,7 @@ class Rbyd:
|
|||||||
|
|
||||||
# end of trunk?
|
# end of trunk?
|
||||||
if not tag & TAG_ALT:
|
if not tag & TAG_ALT:
|
||||||
# update data checksum
|
# update canonical checksum
|
||||||
cksum_ = cksum__
|
cksum_ = cksum__
|
||||||
# update trunk/weight unless we found a shrub or an
|
# update trunk/weight unless we found a shrub or an
|
||||||
# explicit trunk (which may be a shrub) is requested
|
# explicit trunk (which may be a shrub) is requested
|
||||||
|
|||||||
+1
-1
@@ -417,7 +417,7 @@ class Rbyd:
|
|||||||
|
|
||||||
# end of trunk?
|
# end of trunk?
|
||||||
if not tag & TAG_ALT:
|
if not tag & TAG_ALT:
|
||||||
# update data checksum
|
# update canonical checksum
|
||||||
cksum_ = cksum__
|
cksum_ = cksum__
|
||||||
# update trunk/weight unless we found a shrub or an
|
# update trunk/weight unless we found a shrub or an
|
||||||
# explicit trunk (which may be a shrub) is requested
|
# explicit trunk (which may be a shrub) is requested
|
||||||
|
|||||||
+1
-1
@@ -401,7 +401,7 @@ class Rbyd:
|
|||||||
|
|
||||||
# end of trunk?
|
# end of trunk?
|
||||||
if not tag & TAG_ALT:
|
if not tag & TAG_ALT:
|
||||||
# update data checksum
|
# update canonical checksum
|
||||||
cksum_ = cksum__
|
cksum_ = cksum__
|
||||||
# update trunk/weight unless we found a shrub or an
|
# update trunk/weight unless we found a shrub or an
|
||||||
# explicit trunk (which may be a shrub) is requested
|
# explicit trunk (which may be a shrub) is requested
|
||||||
|
|||||||
+2
-2
@@ -580,7 +580,7 @@ def dbg_log(data, block_size, rev, eoff, weight, *,
|
|||||||
upper_ += w
|
upper_ += w
|
||||||
|
|
||||||
if not tag & TAG_ALT:
|
if not tag & TAG_ALT:
|
||||||
# update data checksum
|
# update canonical checksum
|
||||||
cksum = cksum_
|
cksum = cksum_
|
||||||
# derive the current tag's rid from alt weights
|
# derive the current tag's rid from alt weights
|
||||||
rid = lower_ + w-1
|
rid = lower_ + w-1
|
||||||
@@ -997,7 +997,7 @@ def main(disk, blocks=None, *,
|
|||||||
|
|
||||||
# end of trunk?
|
# end of trunk?
|
||||||
if not tag & TAG_ALT:
|
if not tag & TAG_ALT:
|
||||||
# update data checksum
|
# update canonical checksum
|
||||||
cksum_ = cksum__
|
cksum_ = cksum__
|
||||||
# update trunk/weight unless we found a shrub or an
|
# update trunk/weight unless we found a shrub or an
|
||||||
# explicit trunk (which may be a shrub) is requested
|
# explicit trunk (which may be a shrub) is requested
|
||||||
|
|||||||
Reference in New Issue
Block a user