* [2.6 patch] dm: remove unused functions (fwd)
@ 2004-11-29 2:29 Adrian Bunk
2004-11-30 23:05 ` Alasdair G Kergon
0 siblings, 1 reply; 4+ messages in thread
From: Adrian Bunk @ 2004-11-29 2:29 UTC (permalink / raw)
To: Andrew Morton; +Cc: dm-devel, linux-kernel
The patch forwarded below still applies and compiles against
2.6.10-rc2-mm3.
Please apply or comment on it.
----- Forwarded message from Adrian Bunk <bunk@stusta.de> -----
Date: Fri, 29 Oct 2004 02:15:49 +0200
From: Adrian Bunk <bunk@stusta.de>
To: dm-devel@redhat.com
Cc: linux-kernel@vger.kernel.org
Subject: [2.6 patch] dm: remove unused functions
[ this time without the problems due to a digital signature... ]
The patch below removes two unsed functions from dm code.
diffstat output:
drivers/md/dm-io.c | 16 ----------------
drivers/md/dm-snap.c | 5 -----
2 files changed, 21 deletions(-)
Signed-off-by: Adrian Bunk <bunk@stusta.de>
--- linux-2.6.10-rc1-mm1-full/drivers/md/dm-io.c.old 2004-10-28 23:03:35.000000000 +0200
+++ linux-2.6.10-rc1-mm1-full/drivers/md/dm-io.c 2004-10-28 23:03:44.000000000 +0200
@@ -149,22 +149,6 @@
return 0;
}
-static inline void bs_bio_init(struct bio *bio)
-{
- bio->bi_next = NULL;
- bio->bi_flags = 1 << BIO_UPTODATE;
- bio->bi_rw = 0;
- bio->bi_vcnt = 0;
- bio->bi_idx = 0;
- bio->bi_phys_segments = 0;
- bio->bi_hw_segments = 0;
- bio->bi_size = 0;
- bio->bi_max_vecs = 0;
- bio->bi_end_io = NULL;
- atomic_set(&bio->bi_cnt, 1);
- bio->bi_private = NULL;
-}
-
static unsigned _bio_count = 0;
struct bio *bio_set_alloc(struct bio_set *bs, int gfp_mask, int nr_iovecs)
{
--- linux-2.6.10-rc1-mm1-full/drivers/md/dm-snap.c.old 2004-10-28 23:04:16.000000000 +0200
+++ linux-2.6.10-rc1-mm1-full/drivers/md/dm-snap.c 2004-10-28 23:04:24.000000000 +0200
@@ -271,11 +271,6 @@
return e;
}
-static inline void free_exception(struct exception *e)
-{
- kmem_cache_free(exception_cache, e);
-}
-
static inline struct pending_exception *alloc_pending_exception(void)
{
return mempool_alloc(pending_pool, GFP_NOIO);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
----- End forwarded message -----
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [2.6 patch] dm: remove unused functions (fwd)
2004-11-29 2:29 [2.6 patch] dm: remove unused functions (fwd) Adrian Bunk
@ 2004-11-30 23:05 ` Alasdair G Kergon
2004-12-01 4:54 ` Adrian Bunk
2004-12-01 14:41 ` [dm-devel] " Kevin Corry
0 siblings, 2 replies; 4+ messages in thread
From: Alasdair G Kergon @ 2004-11-30 23:05 UTC (permalink / raw)
To: Adrian Bunk; +Cc: Andrew Morton, dm-devel, linux-kernel
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...
Alasdair
--
agk@redhat.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [2.6 patch] dm: remove unused functions (fwd)
2004-11-30 23:05 ` Alasdair G Kergon
@ 2004-12-01 4:54 ` Adrian Bunk
2004-12-01 14:41 ` [dm-devel] " Kevin Corry
1 sibling, 0 replies; 4+ messages in thread
From: Adrian Bunk @ 2004-12-01 4:54 UTC (permalink / raw)
To: Andrew Morton, dm-devel, linux-kernel
On Tue, Nov 30, 2004 at 11:05:25PM +0000, 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...
I have to admit that I don't thoroughly check the code where I find
unused code. That's why I asked for comments on this patch. Ususally the
maintainers of the code in question know best whether such a patch is
correct or not.
Simply consider my patches as some kind of "list of unused functions".
> Alasdair
cu
Adrian
--
"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dm-devel] Re: [2.6 patch] dm: remove unused functions (fwd)
2004-11-30 23:05 ` Alasdair G Kergon
2004-12-01 4:54 ` Adrian Bunk
@ 2004-12-01 14:41 ` Kevin Corry
1 sibling, 0 replies; 4+ messages in thread
From: Kevin Corry @ 2004-12-01 14:41 UTC (permalink / raw)
To: dm-devel; +Cc: Alasdair G Kergon, Adrian Bunk, Andrew Morton, linux-kernel
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@us.ibm.com
http://evms.sourceforge.net/
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2004-12-01 14:41 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-29 2:29 [2.6 patch] dm: remove unused functions (fwd) Adrian Bunk
2004-11-30 23:05 ` Alasdair G Kergon
2004-12-01 4:54 ` Adrian Bunk
2004-12-01 14:41 ` [dm-devel] " Kevin Corry
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).