diff options
author | NeilBrown <neilb@suse.de> | 2012-03-18 21:46:41 -0400 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2012-03-18 21:46:41 -0400 |
commit | 792a1d4bbf960000f066358f0a8c6e769c8c72bc (patch) | |
tree | 97e9a5c0854551c3fa80e88851ad3317af24ca13 | |
parent | 5a6c824ebb7c9f8dbbc92ffd3528e6366cad1a54 (diff) |
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 <neilb@suse.de>
-rw-r--r-- | drivers/md/bitmap.c | 31 |
1 files changed, 3 insertions, 28 deletions
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c index e12b515bd471..534e0077d21a 100644 --- a/drivers/md/bitmap.c +++ b/drivers/md/bitmap.c | |||
@@ -36,31 +36,6 @@ static inline char *bmname(struct bitmap *bitmap) | |||
36 | } | 36 | } |
37 | 37 | ||
38 | /* | 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 | |||
63 | /* | ||
64 | * check a page and, if necessary, allocate it (or hijack it if the alloc fails) | 39 | * check a page and, if necessary, allocate it (or hijack it if the alloc fails) |
65 | * | 40 | * |
66 | * 1) check to see if this page is allocated, if it's not then try to alloc | 41 | * 1) check to see if this page is allocated, if it's not then try to alloc |
@@ -97,7 +72,7 @@ __acquires(bitmap->lock) | |||
97 | /* this page has not been allocated yet */ | 72 | /* this page has not been allocated yet */ |
98 | 73 | ||
99 | spin_unlock_irq(&bitmap->lock); | 74 | spin_unlock_irq(&bitmap->lock); |
100 | mappage = bitmap_alloc_page(bitmap); | 75 | mappage = kzalloc(PAGE_SIZE, GFP_NOIO); |
101 | spin_lock_irq(&bitmap->lock); | 76 | spin_lock_irq(&bitmap->lock); |
102 | 77 | ||
103 | if (mappage == NULL) { | 78 | if (mappage == NULL) { |
@@ -110,7 +85,7 @@ __acquires(bitmap->lock) | |||
110 | } else if (bitmap->bp[page].map || | 85 | } else if (bitmap->bp[page].map || |
111 | bitmap->bp[page].hijacked) { | 86 | bitmap->bp[page].hijacked) { |
112 | /* somebody beat us to getting the page */ | 87 | /* somebody beat us to getting the page */ |
113 | bitmap_free_page(bitmap, mappage); | 88 | kfree(mappage); |
114 | return 0; | 89 | return 0; |
115 | } else { | 90 | } else { |
116 | 91 | ||
@@ -142,7 +117,7 @@ static void bitmap_checkfree(struct bitmap *bitmap, unsigned long page) | |||
142 | ptr = bitmap->bp[page].map; | 117 | ptr = bitmap->bp[page].map; |
143 | bitmap->bp[page].map = NULL; | 118 | bitmap->bp[page].map = NULL; |
144 | bitmap->missing_pages++; | 119 | bitmap->missing_pages++; |
145 | bitmap_free_page(bitmap, ptr); | 120 | kfree(ptr); |
146 | } | 121 | } |
147 | } | 122 | } |
148 | 123 | ||