diff options
Diffstat (limited to 'drivers/block/drbd/drbd_bitmap.c')
-rw-r--r-- | drivers/block/drbd/drbd_bitmap.c | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/drivers/block/drbd/drbd_bitmap.c b/drivers/block/drbd/drbd_bitmap.c index 912f585a760f..3030201c69d8 100644 --- a/drivers/block/drbd/drbd_bitmap.c +++ b/drivers/block/drbd/drbd_bitmap.c | |||
@@ -289,25 +289,25 @@ static unsigned int bm_bit_to_page_idx(struct drbd_bitmap *b, u64 bitnr) | |||
289 | return page_nr; | 289 | return page_nr; |
290 | } | 290 | } |
291 | 291 | ||
292 | static unsigned long *__bm_map_pidx(struct drbd_bitmap *b, unsigned int idx, const enum km_type km) | 292 | static unsigned long *__bm_map_pidx(struct drbd_bitmap *b, unsigned int idx) |
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 | ||
298 | static unsigned long *bm_map_pidx(struct drbd_bitmap *b, unsigned int idx) | 298 | static 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 | ||
303 | static void __bm_unmap(unsigned long *p_addr, const enum km_type km) | 303 | static void __bm_unmap(unsigned long *p_addr) |
304 | { | 304 | { |
305 | kunmap_atomic(p_addr, km); | 305 | kunmap_atomic(p_addr); |
306 | }; | 306 | }; |
307 | 307 | ||
308 | static void bm_unmap(unsigned long *p_addr) | 308 | static 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,15 +543,15 @@ 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 */ |
553 | last_word = ((b->bm_bits - 1) & BITS_PER_PAGE_MASK) >> LN2_BPL; | 553 | last_word = ((b->bm_bits - 1) & BITS_PER_PAGE_MASK) >> LN2_BPL; |
554 | p_addr = __bm_map_pidx(b, idx, KM_USER0); | 554 | p_addr = __bm_map_pidx(b, idx); |
555 | for (i = 0; i < last_word; i++) | 555 | for (i = 0; i < last_word; i++) |
556 | bits += hweight_long(p_addr[i]); | 556 | bits += hweight_long(p_addr[i]); |
557 | p_addr[last_word] &= cpu_to_lel(mask); | 557 | p_addr[last_word] &= cpu_to_lel(mask); |
@@ -559,7 +559,7 @@ static unsigned long bm_count_bits(struct drbd_bitmap *b) | |||
559 | /* 32bit arch, may have an unused padding long */ | 559 | /* 32bit arch, may have an unused padding long */ |
560 | if (BITS_PER_LONG == 32 && (last_word & 1) == 0) | 560 | if (BITS_PER_LONG == 32 && (last_word & 1) == 0) |
561 | p_addr[last_word+1] = 0; | 561 | p_addr[last_word+1] = 0; |
562 | __bm_unmap(p_addr, KM_USER0); | 562 | __bm_unmap(p_addr); |
563 | return bits; | 563 | return bits; |
564 | } | 564 | } |
565 | 565 | ||
@@ -970,11 +970,11 @@ static void bm_page_io_async(struct bm_aio_ctx *ctx, int page_nr, int rw) __must | |||
970 | * to use pre-allocated page pool */ | 970 | * to use pre-allocated page pool */ |
971 | void *src, *dest; | 971 | void *src, *dest; |
972 | page = alloc_page(__GFP_HIGHMEM|__GFP_WAIT); | 972 | page = alloc_page(__GFP_HIGHMEM|__GFP_WAIT); |
973 | dest = kmap_atomic(page, KM_USER0); | 973 | dest = kmap_atomic(page); |
974 | src = kmap_atomic(b->bm_pages[page_nr], KM_USER1); | 974 | src = kmap_atomic(b->bm_pages[page_nr]); |
975 | memcpy(dest, src, PAGE_SIZE); | 975 | memcpy(dest, src, PAGE_SIZE); |
976 | kunmap_atomic(src, KM_USER1); | 976 | kunmap_atomic(src); |
977 | kunmap_atomic(dest, KM_USER0); | 977 | kunmap_atomic(dest); |
978 | bm_store_page_idx(page, page_nr); | 978 | bm_store_page_idx(page, page_nr); |
979 | } else | 979 | } else |
980 | page = b->bm_pages[page_nr]; | 980 | page = b->bm_pages[page_nr]; |
@@ -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 | */ |
1165 | static unsigned long __bm_find_next(struct drbd_conf *mdev, unsigned long bm_fo, | 1165 | static 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 | |||
1239 | unsigned long _drbd_bm_find_next(struct drbd_conf *mdev, unsigned long bm_fo) | 1239 | unsigned 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 | ||
1245 | unsigned long _drbd_bm_find_next_zero(struct drbd_conf *mdev, unsigned long bm_fo) | 1245 | unsigned 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, |