Reverted 16-bit mbid/mrid mids to full 32-bits
The possibility of 16-bit mbid/mrids being a problematic limit is too
high for me to be able to confidently move forward with this internal
encoding.
Consider a filesystem with small blocks and/or large amounts of metadata
per file. If a single file almost fills up an mdir, it risks an
effective limit on the filesystem of 2^16 files. Not a deal-breaker, but
certainly a surprising limit on a supposed "32-bit" filesystem.
We can add more granular integer-limit configurations, but with simple
configurations, the option to increase the integer-limit filesystem-wide
to 64-bits would cost more RAM than just increasing the mbid/mrids
limits.
Though this is always up for reconsideration in the future.
code stack
before: 20762 1720
after: 20590 (-0.8%) 1784 (+3.7%)
It's interesting to not the code/RAM tradeoff here. RAM sees a
significant hit, but code improves, likely because of better instruction
sequences for 32-bit operations (this is targeting ARM thumb,
32-bit MCUs).
Though the code savings likely varies widely across instruction sets,
and I would guess swings negative on 16/8-bit MCUs.
This commit is contained in:
@@ -47,10 +47,10 @@ typedef uint32_t lfs_block_t;
|
||||
typedef uint16_t lfsr_tag_t;
|
||||
typedef int16_t lfsr_stag_t;
|
||||
|
||||
typedef uint16_t lfsr_mbid_t;
|
||||
typedef int16_t lfsr_smbid_t;
|
||||
typedef uint16_t lfsr_mrid_t;
|
||||
typedef int16_t lfsr_smrid_t;
|
||||
typedef uint32_t lfsr_mbid_t;
|
||||
typedef int32_t lfsr_smbid_t;
|
||||
typedef uint32_t lfsr_mrid_t;
|
||||
typedef int32_t lfsr_smrid_t;
|
||||
|
||||
typedef struct lfsr_mid {
|
||||
lfsr_smbid_t bid;
|
||||
@@ -405,11 +405,11 @@ typedef struct lfsr_openedmdir {
|
||||
|
||||
// space for:
|
||||
// - type - 1 leb128 - 1 byte (worst case)
|
||||
// - mid0 - 1 leb128 - 3 bytes (worst case)
|
||||
// - rid0 - 1 leb128 - 3 bytes (worst case)
|
||||
// - mid1 - 1 leb128 - 3 bytes (worst case)
|
||||
// - rid1 - 1 leb128 - 3 bytes (worst case)
|
||||
#define LFSR_GRM_DSIZE (1+3+3+3+3)
|
||||
// - mid0 - 1 leb128 - 5 bytes (worst case)
|
||||
// - rid0 - 1 leb128 - 5 bytes (worst case)
|
||||
// - mid1 - 1 leb128 - 5 bytes (worst case)
|
||||
// - rid1 - 1 leb128 - 5 bytes (worst case)
|
||||
#define LFSR_GRM_DSIZE (1+5+5+5+5)
|
||||
|
||||
typedef struct lfsr_grm {
|
||||
lfsr_mid_t mids[2];
|
||||
|
||||
Reference in New Issue
Block a user