Since pending entries are under read, they should not be reused. This change allows recursive use of the cache (reading pages from within readpage itself). Although this feature is not used by makedumpfile right now, this was the original intention of the pending list. The cache_alloc() function may return NULL if and only if the recursion level is bigger than CACHE_SIZE. Signed-off-by: Petr Tesarik <ptesarik at suse.cz> --- cache.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/cache.c b/cache.c index ad9f0f1..344b4f6 100644 --- a/cache.c +++ b/cache.c @@ -101,16 +101,13 @@ cache_alloc(unsigned long long paddr) if (avail) { entry = pool[--avail]; - add_entry(&pending, entry); - } else if (pending.tail) { - entry = pending.tail; } else if (used.tail) { entry = used.tail; remove_entry(&used, entry); - add_entry(&pending, entry); } else return NULL; + add_entry(&pending, entry); entry->paddr = paddr; return entry; } -- 1.8.4.5