If no work was performed then prealloc_data_structs() wasn't ever called
so there isn't any need to call prealloc_free_structs().
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
static void process_deferred_bios(struct cache *cache)
{
static void process_deferred_bios(struct cache *cache)
{
+ bool prealloc_used = false;
unsigned long flags;
struct bio_list bios;
struct bio *bio;
unsigned long flags;
struct bio_list bios;
struct bio *bio;
process_discard_bio(cache, &structs, bio);
else
process_bio(cache, &structs, bio);
process_discard_bio(cache, &structs, bio);
else
process_bio(cache, &structs, bio);
- prealloc_free_structs(cache, &structs);
+ if (prealloc_used)
+ prealloc_free_structs(cache, &structs);
}
static void process_deferred_cells(struct cache *cache)
{
}
static void process_deferred_cells(struct cache *cache)
{
+ bool prealloc_used = false;
unsigned long flags;
struct dm_bio_prison_cell *cell, *tmp;
struct list_head cells;
unsigned long flags;
struct dm_bio_prison_cell *cell, *tmp;
struct list_head cells;
}
process_cell(cache, &structs, cell);
}
process_cell(cache, &structs, cell);
- prealloc_free_structs(cache, &structs);
+ if (prealloc_used)
+ prealloc_free_structs(cache, &structs);
}
static void process_deferred_flush_bios(struct cache *cache, bool submit_bios)
}
static void process_deferred_flush_bios(struct cache *cache, bool submit_bios)
static void writeback_some_dirty_blocks(struct cache *cache)
{
static void writeback_some_dirty_blocks(struct cache *cache)
{
+ bool prealloc_used = false;
dm_oblock_t oblock;
dm_cblock_t cblock;
struct prealloc structs;
dm_oblock_t oblock;
dm_cblock_t cblock;
struct prealloc structs;
}
writeback(cache, &structs, oblock, cblock, old_ocell);
}
writeback(cache, &structs, oblock, cblock, old_ocell);
- prealloc_free_structs(cache, &structs);
+ if (prealloc_used)
+ prealloc_free_structs(cache, &structs);
}
/*----------------------------------------------------------------
}
/*----------------------------------------------------------------