Rearranged on-disk compat flags

Other than moving things around to make space for planned features, this
also adopts the idea of allowing compat flags to be ored into a single
32-bit integer, at least in the short-term.

Note though that these are still stored in separate wcompat/rcompat
tags, to make compat tests easier, and we may introduce conflicting
flags in the future if we run out of 32-bits. This is just an indulgence
to potentially make tooling/debugging easier until that happens.

Rcompat flags:

  RCOMPAT_NONSTANDARD+
                     0x00000001  ---- ---- ---- ---- ---- ---- ---- ---1
  RCOMPAT_WRONLY+    0x00000004  ---- ---- ---- ---- ---- ---- ---- -1--
  RCOMPAT_MMOSS      0x00000010  ---- ---- ---- ---- ---- ---- ---1 ----
  RCOMPAT_MSPROUT+   0x00000020  ---- ---- ---- ---- ---- ---- --1- ----
  RCOMPAT_MSHRUB+    0x00000040  ---- ---- ---- ---- ---- ---- -1-- ----
  RCOMPAT_MTREE      0x00000080  ---- ---- ---- ---- ---- ---- 1--- ----
  RCOMPAT_BMOSS+     0x00000100  ---- ---- ---- ---- ---- ---1 ---- ----
  RCOMPAT_BSPROUT+   0x00000200  ---- ---- ---- ---- ---- --1- ---- ----
  RCOMPAT_BSHRUB     0x00000400  ---- ---- ---- ---- ---- -1-- ---- ----
  RCOMPAT_BTREE      0x00000800  ---- ---- ---- ---- ---- 1--- ---- ----
  RCOMPAT_MDIRR1*    0x00001000  ---- ---- ---- ---- ---1 ---- ---- ----
  RCOMPAT_MDIRR2*    0x00002000  ---- ---- ---- ---- --1- ---- ---- ----
  RCOMPAT_MDIRR3*    0x00003000  ---- ---- ---- ---- --11 ---- ---- ----
  RCOMPAT_BTREER1*   0x00004000  ---- ---- ---- ---- -1-- ---- ---- ----
  RCOMPAT_BTREER2*   0x00008000  ---- ---- ---- ---- 1--- ---- ---- ----
  RCOMPAT_BTREER3*   0x0000c000  ---- ---- ---- ---- 11-- ---- ---- ----
  RCOMPAT_GRM        0x00010000  ---- ---- ---- ---1 ---- ---- ---- ----
  RCOMPAT_GMV?       0x00020000  ---- ---- ---- --1- ---- ---- ---- ----
  RCOMPAT_GDDTREE*   0x00100000  ---- ---- ---1 ---- ---- ---- ---- ----
  RCOMPAT_GPTREE*    0x00200000  ---- ---- --1- ---- ---- ---- ---- ----
  RCOMPAT_DATAR1*    0x00400000  ---- ---- -1-- ---- ---- ---- ---- ----
  RCOMPAT_DATAR2*    0x00800000  ---- ---- 1--- ---- ---- ---- ---- ----
  RCOMPAT_DATAR3*    0x00c00000  ---- ---- 11-- ---- ---- ---- ---- ----
  rcompat_OVERFLOW+  0x80000000  1--- ---- ---- ---- ---- ---- ---- ----

  * Planned
  + Reserved
  ? Hypothetical

Wcompat flags:

  WCOMPAT_NONSTANDARD+
                     0x00000001  ---- ---- ---- ---- ---- ---- ---- ---1
  WCOMPAT_RDONLY+    0x00000002  ---- ---- ---- ---- ---- ---- ---- --1-
  WCOMPAT_GCKSUM     0x00040000  ---- ---- ---- -1-- ---- ---- ---- ----
  WCOMPAT_GBMAP      0x00080000  ---- ---- ---- 1--- ---- ---- ---- ----
  WCOMPAT_DIR        0x01000000  ---- ---1 ---- ---- ---- ---- ---- ----
  WCOMPAT_SYMLINK?   0x02000000  ---- --1- ---- ---- ---- ---- ---- ----
  WCOMPAT_SNAPSHOT?  0x04000000  ---- -1-- ---- ---- ---- ---- ---- ----
  wcompat_OVERFLOW+  0x80000000  1--- ---- ---- ---- ---- ---- ---- ----

  + Reserved
  ? Hypothetical

Ocompat flags:

  OCOMPAT_NONSTANDARD+
                     0x00000001  ---- ---- ---- ---- ---- ---- ---- ---1
  ocompat_OVERFLOW+  0x80000000  1--- ---- ---- ---- ---- ---- ---- ----

  + Reserved

Other notes:

- M* and B* struct flags were reordered to match META -> DATA order
  elsewhere. This no longer matches the tag ordering, but there's an
  argument the B* tags apply more generally (all btrees) than the B*
  compat flag (only file btrees).

- MDIR/BTREE/DATA redund flags were moved near relevant flags, rather
  than sticking them in the higher-order bits as we are planning to do
  in the M_*/F_* flags. The compat flags already won't match because of
  the mdir/btree split (which is IMO too much detail to include in
  M_*/F_* flags, but hard to argue against in the compat flags), and
  this keeps the highest bit free for OVERFLOW, which is useful
  internally.

- Moving DIR to the current-highest bit makes it easy to add 6 more file
  types (7 if you ignore OVERFLOW), before things start getting cramped.

No code changes.
This commit is contained in:
Christopher Haster
2025-11-13 15:46:15 -06:00
parent 8233ac9dfe
commit 2d68db965b
5 changed files with 72 additions and 71 deletions
+13 -13
View File
@@ -95,22 +95,22 @@ SI2_PREFIXES = {
RCOMPAT_NONSTANDARD = 0x00000001 # Non-standard filesystem format
RCOMPAT_WRONLY = 0x00000002 # Reading is disallowed
RCOMPAT_BMOSS = 0x00000010 # Files may use inlined data
RCOMPAT_BSPROUT = 0x00000020 # Files may use block pointers
RCOMPAT_BSHRUB = 0x00000040 # Files may use inlined btrees
RCOMPAT_BTREE = 0x00000080 # Files may use btrees
RCOMPAT_MMOSS = 0x00000100 # May use an inlined mdir
RCOMPAT_MSPROUT = 0x00000200 # May use an mdir pointer
RCOMPAT_MSHRUB = 0x00000400 # May use an inlined mtree
RCOMPAT_MTREE = 0x00000800 # May use an mdir btree
RCOMPAT_GRM = 0x00001000 # Global-remove in use
RCOMPAT_WRONLY = 0x00000004 # Reading is disallowed
RCOMPAT_MMOSS = 0x00000010 # May use an inlined mdir
RCOMPAT_MSPROUT = 0x00000020 # May use an mdir pointer
RCOMPAT_MSHRUB = 0x00000040 # May use an inlined mtree
RCOMPAT_MTREE = 0x00000080 # May use an mdir btree
RCOMPAT_BMOSS = 0x00000100 # Files may use inlined data
RCOMPAT_BSPROUT = 0x00000200 # Files may use block pointers
RCOMPAT_BSHRUB = 0x00000400 # Files may use inlined btrees
RCOMPAT_BTREE = 0x00000800 # Files may use btrees
RCOMPAT_GRM = 0x00010000 # Global-remove in use
WCOMPAT_NONSTANDARD = 0x00000001 # Non-standard filesystem format
WCOMPAT_RDONLY = 0x00000002 # Writing is disallowed
WCOMPAT_DIR = 0x00000010 # Directory file types in use
WCOMPAT_GCKSUM = 0x00001000 # Global-checksum in use
WCOMPAT_GBMAP = 0x00002000 # Global on-disk block-map in use
WCOMPAT_GCKSUM = 0x00040000 # Global-checksum in use
WCOMPAT_GBMAP = 0x00080000 # Global on-disk block-map in use
WCOMPAT_DIR = 0x01000000 # Directory file types in use
TAG_NULL = 0x0000 ## v--- ---- +--- ----
TAG_CONFIG = 0x0000 ## v--- ---- +ttt tttt