From 240fe4efe447a2db9583922d122cf00570de3c6d Mon Sep 17 00:00:00 2001 From: Christopher Haster Date: Tue, 24 Oct 2023 23:46:11 -0500 Subject: [PATCH] Changed CKSUM suptype encoding from 0x2000 -> 0x3000 I may be overthinking things, but I'm guessing of all the possible tag modes we may want to add in the future, we will mostly like want to add something that looks vaguely tag like. Like the shrub tags, for example. It's beneficial, ordering wise, for these hypothetical future tags to come before the cksum tags. Current tag modes: 0x0ttt v--- tttt -ttt tttt normal tags 0x1ttt v--1 tttt -ttt tttt shrub tags 0x3tpp v-11 tttt ---- ---p cksum tags 0x4kkk v1dc kkkk -kkk kkkk alt tags --- lfs.c | 6 +++--- scripts/dbgbtree.py | 6 +++--- scripts/dbglfs.py | 6 +++--- scripts/dbgmtree.py | 6 +++--- scripts/dbgrbyd.py | 16 ++++++++-------- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/lfs.c b/lfs.c index c5ccb6c0..fd584b10 100644 --- a/lfs.c +++ b/lfs.c @@ -636,8 +636,8 @@ enum lfsr_tag_type { LFSR_TAG_R = 0x1000, // checksum tags - LFSR_TAG_CKSUM = 0x2000, - LFSR_TAG_ECKSUM = 0x2100, + LFSR_TAG_CKSUM = 0x3000, + LFSR_TAG_ECKSUM = 0x3100, // in-device only tags, these should never get written to disk LFSR_TAG_INTERNAL = 0x0800, @@ -723,7 +723,7 @@ static inline bool lfsr_tag_isshrub(lfsr_tag_t tag) { } static inline bool lfsr_tag_istrunk(lfsr_tag_t tag) { - return (tag & 0xe000) != 0x2000; + return lfsr_tag_mode(tag) != LFSR_TAG_CKSUM; } static inline bool lfsr_tag_isinternal(lfsr_tag_t tag) { diff --git a/scripts/dbgbtree.py b/scripts/dbgbtree.py index 3329c8fa..df7269ec 100755 --- a/scripts/dbgbtree.py +++ b/scripts/dbgbtree.py @@ -42,8 +42,8 @@ TAG_DID = 0x032c TAG_UATTR = 0x0400 TAG_SATTR = 0x0600 TAG_SHRUB = 0x1000 -TAG_CKSUM = 0x2000 -TAG_ECKSUM = 0x2100 +TAG_CKSUM = 0x3000 +TAG_ECKSUM = 0x3100 TAG_ALT = 0x4000 TAG_GT = 0x2000 TAG_R = 0x1000 @@ -320,7 +320,7 @@ class Rbyd: weight = weight_ # evaluate trunks - if (tag & 0xe000) != TAG_CKSUM and ( + if (tag & 0xf000) != TAG_CKSUM and ( not trunk or trunk >= j_-d or wastrunk): # new trunk? if not wastrunk: diff --git a/scripts/dbglfs.py b/scripts/dbglfs.py index cbf3aa50..74e1a3a1 100755 --- a/scripts/dbglfs.py +++ b/scripts/dbglfs.py @@ -43,8 +43,8 @@ TAG_DID = 0x032c TAG_UATTR = 0x0400 TAG_SATTR = 0x0600 TAG_SHRUB = 0x1000 -TAG_CKSUM = 0x2000 -TAG_ECKSUM = 0x2100 +TAG_CKSUM = 0x3000 +TAG_ECKSUM = 0x3100 TAG_ALT = 0x4000 TAG_GT = 0x2000 TAG_R = 0x1000 @@ -336,7 +336,7 @@ class Rbyd: weight = weight_ # evaluate trunks - if (tag & 0xe000) != TAG_CKSUM and ( + if (tag & 0xf000) != TAG_CKSUM and ( not trunk or trunk >= j_-d or wastrunk): # new trunk? if not wastrunk: diff --git a/scripts/dbgmtree.py b/scripts/dbgmtree.py index b1d65cf8..257cc27c 100755 --- a/scripts/dbgmtree.py +++ b/scripts/dbgmtree.py @@ -42,8 +42,8 @@ TAG_DID = 0x032c TAG_UATTR = 0x0400 TAG_SATTR = 0x0600 TAG_SHRUB = 0x1000 -TAG_CKSUM = 0x2000 -TAG_ECKSUM = 0x2100 +TAG_CKSUM = 0x3000 +TAG_ECKSUM = 0x3100 TAG_ALT = 0x4000 TAG_GT = 0x2000 TAG_R = 0x1000 @@ -335,7 +335,7 @@ class Rbyd: weight = weight_ # evaluate trunks - if (tag & 0xe000) != TAG_CKSUM and ( + if (tag & 0xf000) != TAG_CKSUM and ( not trunk or trunk >= j_-d or wastrunk): # new trunk? if not wastrunk: diff --git a/scripts/dbgrbyd.py b/scripts/dbgrbyd.py index 54454065..c04cf619 100755 --- a/scripts/dbgrbyd.py +++ b/scripts/dbgrbyd.py @@ -51,8 +51,8 @@ TAG_DID = 0x032c TAG_UATTR = 0x0400 TAG_SATTR = 0x0600 TAG_SHRUB = 0x1000 -TAG_CKSUM = 0x2000 -TAG_ECKSUM = 0x2100 +TAG_CKSUM = 0x3000 +TAG_ECKSUM = 0x3100 TAG_ALT = 0x4000 TAG_GT = 0x2000 TAG_R = 0x1000 @@ -339,12 +339,12 @@ def dbg_log(data, block_size, rev, eoff, weight, *, j_ += size # evaluate trunks - if (tag & 0xe000) != TAG_CKSUM: + if (tag & 0xf000) != TAG_CKSUM: if not wastrunk: wastrunk = True lower_, upper_ = 0, 0 - if (tag & 0xe000) == TAG_ALT: + if (tag & 0xf000) == TAG_ALT: lower_ += w else: upper_ += w @@ -356,7 +356,7 @@ def dbg_log(data, block_size, rev, eoff, weight, *, weight_ = lower_+upper_ rid = lower_ + w-1 - if (tag & 0xe000) != TAG_CKSUM and not tag & TAG_ALT: + if (tag & 0xf000) != TAG_CKSUM and not tag & TAG_ALT: # note we ignore out-of-bounds here for debugging if delta > 0: # grow lifetimes @@ -468,7 +468,7 @@ def dbg_log(data, block_size, rev, eoff, weight, *, j_ += size # evaluate trunks - if (tag & 0xe000) != TAG_CKSUM: + if (tag & 0xf000) != TAG_CKSUM: if not wastrunk: wastrunk = True weight__ = 0 @@ -516,7 +516,7 @@ def dbg_log(data, block_size, rev, eoff, weight, *, j_ += size # evaluate trunks - if (tag & 0xe000) != TAG_CKSUM: + if (tag & 0xf000) != TAG_CKSUM: if not wastrunk: wastrunk = True lower_, upper_ = 0, 0 @@ -923,7 +923,7 @@ def main(disk, blocks=None, *, weight = weight_ # evaluate trunks - if (tag & 0xe000) != TAG_CKSUM and ( + if (tag & 0xf000) != TAG_CKSUM and ( not trunk or trunk >= j_-d or wastrunk): # new trunk? if not wastrunk: