Some small tweaks to mdir comparison functions
- lfsr_mid_cmp no longer uses a union. This was undefined behavior and the lfsr_mid_t type isn't word aligned, so this could break pretty badly on machine/compiler change. Also dropped ordering based on endianness, since we need to marshal these into an int for the comparison anyways. - Changed lfsr_mdir_cmp to use min/max functions as part of the comparison. The result is also "ordered" now, though the ordering is nonsensical. I guess the mrootanchor is less than all other mdirs? Also considered only comparing a single min/max block, since it would be an error for mdirs to share blocks, but note we rely on lfsr_mdir_cmp to check for relocations in lfsr_mdir_commit. These relocations can end up being partial in the case of bad block detection.
This commit is contained in:
@@ -53,13 +53,8 @@ typedef uint16_t lfsr_mrid_t;
|
||||
typedef int16_t lfsr_smrid_t;
|
||||
|
||||
typedef struct lfsr_mid {
|
||||
#ifdef LFS_BIG_ENDIAN
|
||||
lfsr_smbid_t bid;
|
||||
lfsr_smrid_t rid;
|
||||
#else
|
||||
lfsr_smrid_t rid;
|
||||
lfsr_smbid_t bid;
|
||||
#endif
|
||||
} lfsr_mid_t;
|
||||
|
||||
// Maximum name size in bytes, may be redefined to reduce the size of the
|
||||
|
||||
Reference in New Issue
Block a user