You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Invalidate the lookahead buffer. This is done during mounting and
// failed traversals
static void lfs_alloc_reset(lfs_t *lfs) {
lfs->free.off = lfs->seed % lfs->cfg->block_size;
lfs->free.size = 0;
lfs->free.i = 0;
lfs_alloc_ack(lfs);
}
In this code, lfs->free.off is initialized with a range-bound version of lfs->seed - however it is bounded based on the configured block_size. Everywhere else that uses/updates lfs->free.off bounds it based on block_count (which makes more sense, as you are trying to find an index such that 0 <= index < block_count).
I don't think that this is necessarily going to cause immediate issues, as everywhere else it is used it appears to be subject to another modulus operation, however in certain configurations where block_size is small compared to block_count this may bias the wear leveling.
The text was updated successfully, but these errors were encountered:
The code for lfs_alloc_reset is:
In this code, lfs->free.off is initialized with a range-bound version of lfs->seed - however it is bounded based on the configured block_size. Everywhere else that uses/updates lfs->free.off bounds it based on block_count (which makes more sense, as you are trying to find an index such that 0 <= index < block_count).
I don't think that this is necessarily going to cause immediate issues, as everywhere else it is used it appears to be subject to another modulus operation, however in certain configurations where block_size is small compared to block_count this may bias the wear leveling.
The text was updated successfully, but these errors were encountered: