aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/drbd/drbd_bitmap.c
diff options
context:
space:
mode:
authorCong Wang <amwang@redhat.com>2011-11-25 10:14:18 -0500
committerCong Wang <xiyou.wangcong@gmail.com>2012-03-20 09:48:16 -0400
commitcfd8005c99c68882e962807d36603791adddfb9f (patch)
tree49ddae09cf9067a3729bbc58ab65c117cbca93ce /drivers/block/drbd/drbd_bitmap.c
parent496cda8e75d90301cb1e6bbebea643c6bac1e6d6 (diff)
block: remove the second argument of k[un]map_atomic()
Signed-off-by: Cong Wang <amwang@redhat.com>
Diffstat (limited to 'drivers/block/drbd/drbd_bitmap.c')
-rw-r--r--drivers/block/drbd/drbd_bitmap.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/drivers/block/drbd/drbd_bitmap.c b/drivers/block/drbd/drbd_bitmap.c
index 912f585a760f..39de9ff1cfb2 100644
--- a/drivers/block/drbd/drbd_bitmap.c
+++ b/drivers/block/drbd/drbd_bitmap.c
@@ -292,22 +292,22 @@ static unsigned int bm_bit_to_page_idx(struct drbd_bitmap *b, u64 bitnr)
292static unsigned long *__bm_map_pidx(struct drbd_bitmap *b, unsigned int idx, const enum km_type km) 292static unsigned long *__bm_map_pidx(struct drbd_bitmap *b, unsigned int idx, const enum km_type km)
293{ 293{
294 struct page *page = b->bm_pages[idx]; 294 struct page *page = b->bm_pages[idx];
295 return (unsigned long *) kmap_atomic(page, km); 295 return (unsigned long *) kmap_atomic(page);
296} 296}
297 297
298static unsigned long *bm_map_pidx(struct drbd_bitmap *b, unsigned int idx) 298static unsigned long *bm_map_pidx(struct drbd_bitmap *b, unsigned int idx)
299{ 299{
300 return __bm_map_pidx(b, idx, KM_IRQ1); 300 return __bm_map_pidx(b, idx);
301} 301}
302 302
303static void __bm_unmap(unsigned long *p_addr, const enum km_type km) 303static void __bm_unmap(unsigned long *p_addr)
304{ 304{
305 kunmap_atomic(p_addr, km); 305 kunmap_atomic(p_addr);
306}; 306};
307 307
308static void bm_unmap(unsigned long *p_addr) 308static void bm_unmap(unsigned long *p_addr)
309{ 309{
310 return __bm_unmap(p_addr, KM_IRQ1); 310 return __bm_unmap(p_addr);
311} 311}
312 312
313/* long word offset of _bitmap_ sector */ 313/* long word offset of _bitmap_ sector */
@@ -543,10 +543,10 @@ static unsigned long bm_count_bits(struct drbd_bitmap *b)
543 543
544 /* all but last page */ 544 /* all but last page */
545 for (idx = 0; idx < b->bm_number_of_pages - 1; idx++) { 545 for (idx = 0; idx < b->bm_number_of_pages - 1; idx++) {
546 p_addr = __bm_map_pidx(b, idx, KM_USER0); 546 p_addr = __bm_map_pidx(b, idx);
547 for (i = 0; i < LWPP; i++) 547 for (i = 0; i < LWPP; i++)
548 bits += hweight_long(p_addr[i]); 548 bits += hweight_long(p_addr[i]);
549 __bm_unmap(p_addr, KM_USER0); 549 __bm_unmap(p_addr);
550 cond_resched(); 550 cond_resched();
551 } 551 }
552 /* last (or only) page */ 552 /* last (or only) page */
@@ -1163,7 +1163,7 @@ int drbd_bm_write_page(struct drbd_conf *mdev, unsigned int idx) __must_hold(loc
1163 * this returns a bit number, NOT a sector! 1163 * this returns a bit number, NOT a sector!
1164 */ 1164 */
1165static unsigned long __bm_find_next(struct drbd_conf *mdev, unsigned long bm_fo, 1165static unsigned long __bm_find_next(struct drbd_conf *mdev, unsigned long bm_fo,
1166 const int find_zero_bit, const enum km_type km) 1166 const int find_zero_bit)
1167{ 1167{
1168 struct drbd_bitmap *b = mdev->bitmap; 1168 struct drbd_bitmap *b = mdev->bitmap;
1169 unsigned long *p_addr; 1169 unsigned long *p_addr;
@@ -1178,7 +1178,7 @@ static unsigned long __bm_find_next(struct drbd_conf *mdev, unsigned long bm_fo,
1178 while (bm_fo < b->bm_bits) { 1178 while (bm_fo < b->bm_bits) {
1179 /* bit offset of the first bit in the page */ 1179 /* bit offset of the first bit in the page */
1180 bit_offset = bm_fo & ~BITS_PER_PAGE_MASK; 1180 bit_offset = bm_fo & ~BITS_PER_PAGE_MASK;
1181 p_addr = __bm_map_pidx(b, bm_bit_to_page_idx(b, bm_fo), km); 1181 p_addr = __bm_map_pidx(b, bm_bit_to_page_idx(b, bm_fo));
1182 1182
1183 if (find_zero_bit) 1183 if (find_zero_bit)
1184 i = find_next_zero_bit_le(p_addr, 1184 i = find_next_zero_bit_le(p_addr,
@@ -1187,7 +1187,7 @@ static unsigned long __bm_find_next(struct drbd_conf *mdev, unsigned long bm_fo,
1187 i = find_next_bit_le(p_addr, 1187 i = find_next_bit_le(p_addr,
1188 PAGE_SIZE*8, bm_fo & BITS_PER_PAGE_MASK); 1188 PAGE_SIZE*8, bm_fo & BITS_PER_PAGE_MASK);
1189 1189
1190 __bm_unmap(p_addr, km); 1190 __bm_unmap(p_addr);
1191 if (i < PAGE_SIZE*8) { 1191 if (i < PAGE_SIZE*8) {
1192 bm_fo = bit_offset + i; 1192 bm_fo = bit_offset + i;
1193 if (bm_fo >= b->bm_bits) 1193 if (bm_fo >= b->bm_bits)
@@ -1215,7 +1215,7 @@ static unsigned long bm_find_next(struct drbd_conf *mdev,
1215 if (BM_DONT_TEST & b->bm_flags) 1215 if (BM_DONT_TEST & b->bm_flags)
1216 bm_print_lock_info(mdev); 1216 bm_print_lock_info(mdev);
1217 1217
1218 i = __bm_find_next(mdev, bm_fo, find_zero_bit, KM_IRQ1); 1218 i = __bm_find_next(mdev, bm_fo, find_zero_bit);
1219 1219
1220 spin_unlock_irq(&b->bm_lock); 1220 spin_unlock_irq(&b->bm_lock);
1221 return i; 1221 return i;
@@ -1239,13 +1239,13 @@ unsigned long drbd_bm_find_next_zero(struct drbd_conf *mdev, unsigned long bm_fo
1239unsigned long _drbd_bm_find_next(struct drbd_conf *mdev, unsigned long bm_fo) 1239unsigned long _drbd_bm_find_next(struct drbd_conf *mdev, unsigned long bm_fo)
1240{ 1240{
1241 /* WARN_ON(!(BM_DONT_SET & mdev->b->bm_flags)); */ 1241 /* WARN_ON(!(BM_DONT_SET & mdev->b->bm_flags)); */
1242 return __bm_find_next(mdev, bm_fo, 0, KM_USER1); 1242 return __bm_find_next(mdev, bm_fo, 0);
1243} 1243}
1244 1244
1245unsigned long _drbd_bm_find_next_zero(struct drbd_conf *mdev, unsigned long bm_fo) 1245unsigned long _drbd_bm_find_next_zero(struct drbd_conf *mdev, unsigned long bm_fo)
1246{ 1246{
1247 /* WARN_ON(!(BM_DONT_SET & mdev->b->bm_flags)); */ 1247 /* WARN_ON(!(BM_DONT_SET & mdev->b->bm_flags)); */
1248 return __bm_find_next(mdev, bm_fo, 1, KM_USER1); 1248 return __bm_find_next(mdev, bm_fo, 1);
1249} 1249}
1250 1250
1251/* returns number of bits actually changed. 1251/* returns number of bits actually changed.
@@ -1273,14 +1273,14 @@ static int __bm_change_bits_to(struct drbd_conf *mdev, const unsigned long s,
1273 unsigned int page_nr = bm_bit_to_page_idx(b, bitnr); 1273 unsigned int page_nr = bm_bit_to_page_idx(b, bitnr);
1274 if (page_nr != last_page_nr) { 1274 if (page_nr != last_page_nr) {
1275 if (p_addr) 1275 if (p_addr)
1276 __bm_unmap(p_addr, KM_IRQ1); 1276 __bm_unmap(p_addr);
1277 if (c < 0) 1277 if (c < 0)
1278 bm_set_page_lazy_writeout(b->bm_pages[last_page_nr]); 1278 bm_set_page_lazy_writeout(b->bm_pages[last_page_nr]);
1279 else if (c > 0) 1279 else if (c > 0)
1280 bm_set_page_need_writeout(b->bm_pages[last_page_nr]); 1280 bm_set_page_need_writeout(b->bm_pages[last_page_nr]);
1281 changed_total += c; 1281 changed_total += c;
1282 c = 0; 1282 c = 0;
1283 p_addr = __bm_map_pidx(b, page_nr, KM_IRQ1); 1283 p_addr = __bm_map_pidx(b, page_nr);
1284 last_page_nr = page_nr; 1284 last_page_nr = page_nr;
1285 } 1285 }
1286 if (val) 1286 if (val)
@@ -1289,7 +1289,7 @@ static int __bm_change_bits_to(struct drbd_conf *mdev, const unsigned long s,
1289 c -= (0 != __test_and_clear_bit_le(bitnr & BITS_PER_PAGE_MASK, p_addr)); 1289 c -= (0 != __test_and_clear_bit_le(bitnr & BITS_PER_PAGE_MASK, p_addr));
1290 } 1290 }
1291 if (p_addr) 1291 if (p_addr)
1292 __bm_unmap(p_addr, KM_IRQ1); 1292 __bm_unmap(p_addr);
1293 if (c < 0) 1293 if (c < 0)
1294 bm_set_page_lazy_writeout(b->bm_pages[last_page_nr]); 1294 bm_set_page_lazy_writeout(b->bm_pages[last_page_nr]);
1295 else if (c > 0) 1295 else if (c > 0)
@@ -1342,13 +1342,13 @@ static inline void bm_set_full_words_within_one_page(struct drbd_bitmap *b,
1342{ 1342{
1343 int i; 1343 int i;
1344 int bits; 1344 int bits;
1345 unsigned long *paddr = kmap_atomic(b->bm_pages[page_nr], KM_IRQ1); 1345 unsigned long *paddr = kmap_atomic(b->bm_pages[page_nr]);
1346 for (i = first_word; i < last_word; i++) { 1346 for (i = first_word; i < last_word; i++) {
1347 bits = hweight_long(paddr[i]); 1347 bits = hweight_long(paddr[i]);
1348 paddr[i] = ~0UL; 1348 paddr[i] = ~0UL;
1349 b->bm_set += BITS_PER_LONG - bits; 1349 b->bm_set += BITS_PER_LONG - bits;
1350 } 1350 }
1351 kunmap_atomic(paddr, KM_IRQ1); 1351 kunmap_atomic(paddr);
1352} 1352}
1353 1353
1354/* Same thing as drbd_bm_set_bits, 1354/* Same thing as drbd_bm_set_bits,