Renamed block-size flag in scripts from -B -> b

So now these should be invoked like so:

  $ ./scripts/dbglfs.py -b4096x256 disk

The motivation for this change is to better match other filesystem
tooling. Some prior art:

- mkfs.btrfs
  - -n/--nodesize   => node size in bytes, power of 2 >= sector
  - -s/--sectorsize => sector size in bytes, power of 2
- zfs create
  - -b => block size in bytes
- mkfs.xfs
  - -b => block size in bytes, power of 2 >= sector
  - -s => sector size in bytes, power of 2 >= 512
- mkfs.ext[234]
  - -b => block size in bytes, power of 2 >= 1024
- mkfs.ntfs
  - -c/--cluster-size => cluster size in bytes, power of 2 >= sector
  - -s/--sector-size  => sector size in bytes, power of 2 >= 256
- mkfs.fat
  - -s => cluster size in sectors, power of 2
  - -S => sector size in bytes, power of 2 >= 512

Why care so much about the flag naming for internal scripts? The
intention is for external tooling to eventually use the same set of
flags. And maybe even create publically consumable versions of the dbg
scripts. It's important that if/when this happens flags stay consistent.
Everyone familiar with the ssh -p/scp -P situation knows how annoying
this can be.

It's especially important for littlefs's -b/--block-size flag, since
this will likely end up used everywhere. Unlike other filesystems,
littlefs can't mount without knowing the block-size, so any tool that
mounts littlefs is going to need the -b/--block-size flag.

---

The original motivation for -B was to avoid conflicts with the -b/--by
flag that was already in use in all of the measurement scripts. But
these are internal, and not really littlefs-related, so I don't think
that's a good reason any more. Worst case we can just make the --by flag
-B, or just not have a short form (--by is only 4 letters after all).

Somehow we ended up with no scripts needing both -b/--block-size and
-b/--by so far.

Some other conflicts/inconsistencies tweaks were needed, here are all
the flag changes:

- -B/--block-size   -> -b/--block-size
- -M/--mleaf-weight -> -m/--mleaf-weight
- -b/--btree        -> -B/--btree
- -C/--block-cycles -> -c/--block-cycles  (in tracebd.py)
- -c/--coalesce     -> -S/--coalesce      (in tracebd.py)
- -m/--mdirs        -> -M/--mdirs         (in dbgbmap.py)
- -b/--btrees       -> -B/--btrees        (in dbgbmap.py)
- -d/--datas        -> -D/--datas         (in dbgbmap.py)
This commit is contained in:
Christopher Haster
2024-02-14 12:45:30 -06:00
parent 7d95a2ff29
commit 2d2c0f19ff
7 changed files with 18 additions and 18 deletions

View File

@@ -159,7 +159,7 @@ if __name__ == "__main__":
type=rbydaddr,
help="Block address.")
parser.add_argument(
'-B', '--block-size',
'-b', '--block-size',
type=bdgeom,
help="Block size/geometry in bytes.")
parser.add_argument(

View File

@@ -1758,7 +1758,7 @@ if __name__ == "__main__":
type=rbydaddr,
help="Block address of the mroots. Defaults to 0x{0,1}.")
parser.add_argument(
'-B', '--block-size',
'-b', '--block-size',
type=bdgeom,
help="Block size/geometry in bytes.")
parser.add_argument(
@@ -1766,7 +1766,7 @@ if __name__ == "__main__":
type=lambda x: int(x, 0),
help="Block count in blocks.")
parser.add_argument(
'-M', '--mleaf-weight',
'-m', '--mleaf-weight',
type=lambda x: int(x, 0),
help="Maximum weight of mdirs for mid decoding. Defaults to a "
"block_size derived value.")
@@ -1790,15 +1790,15 @@ if __name__ == "__main__":
for x in x.split(',')),
help="Show this many bytes, may be a range.")
parser.add_argument(
'-m', '--mdirs',
'-M', '--mdirs',
action='store_true',
help="Render mdir blocks.")
parser.add_argument(
'-b', '--btrees',
'-B', '--btrees',
action='store_true',
help="Render btree blocks.")
parser.add_argument(
'-d', '--datas',
'-D', '--datas',
action='store_true',
help="Render data blocks.")
parser.add_argument(

View File

@@ -1012,7 +1012,7 @@ if __name__ == "__main__":
type=rbydaddr,
help="Block address of the roots of the tree.")
parser.add_argument(
'-B', '--block-size',
'-b', '--block-size',
type=bdgeom,
help="Block size/geometry in bytes.")
parser.add_argument(
@@ -1045,7 +1045,7 @@ if __name__ == "__main__":
action='store_true',
help="Show the underlying rbyd trees.")
parser.add_argument(
'-b', '--btree',
'-B', '--btree',
action='store_true',
help="Show the underlying B-tree.")
parser.add_argument(

View File

@@ -2177,7 +2177,7 @@ if __name__ == "__main__":
type=rbydaddr,
help="Block address of the mroots. Defaults to 0x{0,1}.")
parser.add_argument(
'-B', '--block-size',
'-b', '--block-size',
type=bdgeom,
help="Block size/geometry in bytes.")
parser.add_argument(
@@ -2185,7 +2185,7 @@ if __name__ == "__main__":
type=lambda x: int(x, 0),
help="Block count in blocks.")
parser.add_argument(
'-M', '--mleaf-weight',
'-m', '--mleaf-weight',
type=lambda x: int(x, 0),
help="Maximum weight of mdirs for mid decoding. Defaults to a "
"block_size derived value.")
@@ -2245,7 +2245,7 @@ if __name__ == "__main__":
action='store_true',
help="Show the underlying rbyd trees.")
parser.add_argument(
'-b', '--btree',
'-B', '--btree',
action='store_true',
help="Show the underlying B-tree.")
parser.add_argument(

View File

@@ -1664,7 +1664,7 @@ if __name__ == "__main__":
type=rbydaddr,
help="Block address of the mroots. Defaults to 0x{0,1}.")
parser.add_argument(
'-B', '--block-size',
'-b', '--block-size',
type=bdgeom,
help="Block size/geometry in bytes.")
parser.add_argument(
@@ -1672,7 +1672,7 @@ if __name__ == "__main__":
type=lambda x: int(x, 0),
help="Block count in blocks.")
parser.add_argument(
'-M', '--mleaf-weight',
'-m', '--mleaf-weight',
type=lambda x: int(x, 0),
help="Maximum weight of mdirs for mid decoding. Defaults to a "
"block_size derived value.")
@@ -1698,7 +1698,7 @@ if __name__ == "__main__":
action='store_true',
help="Show the underlying rbyd trees.")
parser.add_argument(
'-b', '--btree',
'-B', '--btree',
action='store_true',
help="Show the underlying B-tree.")
parser.add_argument(

View File

@@ -1037,7 +1037,7 @@ if __name__ == "__main__":
type=rbydaddr,
help="Block address of metadata blocks.")
parser.add_argument(
'-B', '--block-size',
'-b', '--block-size',
type=bdgeom,
help="Block size/geometry in bytes.")
parser.add_argument(

View File

@@ -1057,7 +1057,7 @@ if __name__ == "__main__":
nargs='?',
help="Path to read from.")
parser.add_argument(
'-B', '--block-size',
'-b', '--block-size',
type=bdgeom,
help="Block size/geometry in bytes.")
parser.add_argument(
@@ -1065,7 +1065,7 @@ if __name__ == "__main__":
type=lambda x: int(x, 0),
help="Block count in blocks.")
parser.add_argument(
'-C', '--block-cycles',
'-c', '--block-cycles',
type=lambda x: int(x, 0),
help="Assumed maximum number of erase cycles when measuring wear.")
parser.add_argument(
@@ -1172,7 +1172,7 @@ if __name__ == "__main__":
action='store_true',
help="Render as a space-filling Z-curve.")
parser.add_argument(
'-c', '--coalesce',
'-S', '--coalesce',
type=lambda x: int(x, 0),
help="Number of operations to coalesce together.")
parser.add_argument(