Skip to content

Commit 792a1d4

Browse files
committed
md/bitmap: remove unnecessary indirection when allocating.
These funcitons don't add anything useful except possibly the trace points, and I don't think they are worth the extra indirection. So remove them. Signed-off-by: NeilBrown <[email protected]>
1 parent 5a6c824 commit 792a1d4

File tree

1 file changed

+3
-28
lines changed

1 file changed

+3
-28
lines changed

drivers/md/bitmap.c

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -35,31 +35,6 @@ static inline char *bmname(struct bitmap *bitmap)
3535
return bitmap->mddev ? mdname(bitmap->mddev) : "mdX";
3636
}
3737

38-
/*
39-
* just a placeholder - calls kmalloc for bitmap pages
40-
*/
41-
static unsigned char *bitmap_alloc_page(struct bitmap *bitmap)
42-
{
43-
unsigned char *page;
44-
45-
page = kzalloc(PAGE_SIZE, GFP_NOIO);
46-
if (!page)
47-
printk("%s: bitmap_alloc_page FAILED\n", bmname(bitmap));
48-
else
49-
pr_debug("%s: bitmap_alloc_page: allocated page at %p\n",
50-
bmname(bitmap), page);
51-
return page;
52-
}
53-
54-
/*
55-
* for now just a placeholder -- just calls kfree for bitmap pages
56-
*/
57-
static void bitmap_free_page(struct bitmap *bitmap, unsigned char *page)
58-
{
59-
pr_debug("%s: bitmap_free_page: free page %p\n", bmname(bitmap), page);
60-
kfree(page);
61-
}
62-
6338
/*
6439
* check a page and, if necessary, allocate it (or hijack it if the alloc fails)
6540
*
@@ -97,7 +72,7 @@ __acquires(bitmap->lock)
9772
/* this page has not been allocated yet */
9873

9974
spin_unlock_irq(&bitmap->lock);
100-
mappage = bitmap_alloc_page(bitmap);
75+
mappage = kzalloc(PAGE_SIZE, GFP_NOIO);
10176
spin_lock_irq(&bitmap->lock);
10277

10378
if (mappage == NULL) {
@@ -110,7 +85,7 @@ __acquires(bitmap->lock)
11085
} else if (bitmap->bp[page].map ||
11186
bitmap->bp[page].hijacked) {
11287
/* somebody beat us to getting the page */
113-
bitmap_free_page(bitmap, mappage);
88+
kfree(mappage);
11489
return 0;
11590
} else {
11691

@@ -142,7 +117,7 @@ static void bitmap_checkfree(struct bitmap *bitmap, unsigned long page)
142117
ptr = bitmap->bp[page].map;
143118
bitmap->bp[page].map = NULL;
144119
bitmap->missing_pages++;
145-
bitmap_free_page(bitmap, ptr);
120+
kfree(ptr);
146121
}
147122
}
148123

0 commit comments

Comments
 (0)