From 69b34644bdf7281577bf6ca86f7cda6a9987c7d2 Mon Sep 17 00:00:00 2001 From: Christopher Haster Date: Thu, 14 Nov 2019 14:43:48 -0600 Subject: [PATCH] Added debug statement for block allocation scan This may be useful for determining when allocation passes occur, especially as performance and latency becomes a growing concern. --- lfs.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lfs.c b/lfs.c index 95a3b6a..b4d1240 100644 --- a/lfs.c +++ b/lfs.c @@ -466,9 +466,15 @@ static int lfs_alloc(lfs_t *lfs, lfs_block_t *block) { } } + // no free blocks in lookahead buffer, need to scan tree + LFS_DEBUG("Scanning for free blocks %"PRIx32"-%"PRIx32, + lfs->free.i + lfs->free.off, + (lfs->free.i + lfs->free.off + 8*lfs->cfg->lookahead_size) + % lfs->cfg->block_count); + // check if we have looked at all blocks since last ack if (lfs->free.ack == 0) { - LFS_ERROR("No more free space %"PRIu32, + LFS_ERROR("No more free space %"PRIx32, lfs->free.i + lfs->free.off); return LFS_ERR_NOSPC; }