[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [dm-devel] Re: [2.6 patch] dm: remove unused functions (fwd)

On Tuesday 30 November 2004 5:05 pm, Alasdair G Kergon wrote:
> On Mon, Nov 29, 2004 at 03:29:40AM +0100, Adrian Bunk wrote:
> > Please apply or comment on it.
> Please check *why* the functions aren't used first.
> e.g. An alloc function with a corresponding free that
> never gets called suggests a leak to me...

That one isn't a leak (referring to "kmem_cache_t *exception_cache" in 
dm-snap.c). Items are allocated from this cache using alloc_exception(). This 
can happen either when an existing snapshot is activated and it's exception 
table is read from disk into an in-memory hash-table, or when a copy-on-write 
completes and a new exception is added to this hash-table. As long as the 
snapshot is active, this hash-table remains in memory and items cannot be 
removed from it. When the snapshot is deactivated, we call 
exit_exception_table() and pass it a pointer to this hash-table and 
exception_cache. This routine calls kmem_cache_free() directly instead of 
using the free_exception() routine. The reason it doesn't use 
free_exception() is that exit_exception_table() is used to tear down two 
different but somewhat similar hash-tables, each of which uses a different 

So, it may be nice to keep the symmetric routines defined (alloc_exception() 
and free_exception()), but Adrian is correct in that the later is not being 
used, and it really can't be used without some more significant code changes.

As for bs_bio_init(), it can be safely removed. It was just a duplicate of 
bio_init() from fs/bio.c. The use of that call in dm-io.c was changed to use 
bio_init(), but apparently the routine itself was never removed.

Kevin Corry
kevcorry us ibm com

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]