On 07/01/2015 11:03 AM, Zoltan Kiss wrote: > The current way has a few problems: > > - if cache->len < n, we copy our elements into the cache first, then > into obj_table, that's unnecessary > - if n >= cache_size (or the backfill fails), and we can't fulfil the > request from the ring alone, we don't try to combine with the cache > - if refill fails, we don't return anything, even if the ring has enough > for our request > > This patch rewrites it severely: > - at the first part of the function we only try the cache if cache->len < n > - otherwise take our elements straight from the ring > - if that fails but we have something in the cache, try to combine them > - the refill happens at the end, and its failure doesn't modify our return > value > > Signed-off-by: Zoltan Kiss <zoltan.kiss at linaro.org>
Acked-by: Olivier Matz <olivier.matz at 6wind.com>