Re: [dm-devel] Re: [2.6 patch] dm: remove unused functions (fwd)
From: Kevin Corry
Date: Wed Dec 01 2004 - 09:43:21 EST
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
kmem_cache_t.
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@xxxxxxxxxx
http://evms.sourceforge.net/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/