aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/drbd/drbd_actlog.c2
-rw-r--r--drivers/block/drbd/drbd_bitmap.c37
-rw-r--r--drivers/block/drbd/drbd_receiver.c6
-rw-r--r--drivers/block/drbd/drbd_worker.c7
4 files changed, 31 insertions, 21 deletions
diff --git a/drivers/block/drbd/drbd_actlog.c b/drivers/block/drbd/drbd_actlog.c
index 09ef9a878ef0..cf0e63dd97da 100644
--- a/drivers/block/drbd/drbd_actlog.c
+++ b/drivers/block/drbd/drbd_actlog.c
@@ -79,7 +79,7 @@ static int _drbd_md_sync_page_io(struct drbd_conf *mdev,
79 md_io.error = 0; 79 md_io.error = 0;
80 80
81 if ((rw & WRITE) && !test_bit(MD_NO_FUA, &mdev->flags)) 81 if ((rw & WRITE) && !test_bit(MD_NO_FUA, &mdev->flags))
82 rw |= REQ_FUA; 82 rw |= REQ_FUA | REQ_FLUSH;
83 rw |= REQ_SYNC; 83 rw |= REQ_SYNC;
84 84
85 bio = bio_alloc(GFP_NOIO, 1); 85 bio = bio_alloc(GFP_NOIO, 1);
diff --git a/drivers/block/drbd/drbd_bitmap.c b/drivers/block/drbd/drbd_bitmap.c
index f440a02dfdb1..7b976296b564 100644
--- a/drivers/block/drbd/drbd_bitmap.c
+++ b/drivers/block/drbd/drbd_bitmap.c
@@ -112,9 +112,6 @@ struct drbd_bitmap {
112 struct task_struct *bm_task; 112 struct task_struct *bm_task;
113}; 113};
114 114
115static int __bm_change_bits_to(struct drbd_conf *mdev, const unsigned long s,
116 unsigned long e, int val, const enum km_type km);
117
118#define bm_print_lock_info(m) __bm_print_lock_info(m, __func__) 115#define bm_print_lock_info(m) __bm_print_lock_info(m, __func__)
119static void __bm_print_lock_info(struct drbd_conf *mdev, const char *func) 116static void __bm_print_lock_info(struct drbd_conf *mdev, const char *func)
120{ 117{
@@ -994,6 +991,9 @@ static void bm_page_io_async(struct bm_aio_ctx *ctx, int page_nr, int rw) __must
994 bio_endio(bio, -EIO); 991 bio_endio(bio, -EIO);
995 } else { 992 } else {
996 submit_bio(rw, bio); 993 submit_bio(rw, bio);
994 /* this should not count as user activity and cause the
995 * resync to throttle -- see drbd_rs_should_slow_down(). */
996 atomic_add(len >> 9, &mdev->rs_sect_ev);
997 } 997 }
998} 998}
999 999
@@ -1256,7 +1256,7 @@ unsigned long _drbd_bm_find_next_zero(struct drbd_conf *mdev, unsigned long bm_f
1256 * expected to be called for only a few bits (e - s about BITS_PER_LONG). 1256 * expected to be called for only a few bits (e - s about BITS_PER_LONG).
1257 * Must hold bitmap lock already. */ 1257 * Must hold bitmap lock already. */
1258static int __bm_change_bits_to(struct drbd_conf *mdev, const unsigned long s, 1258static int __bm_change_bits_to(struct drbd_conf *mdev, const unsigned long s,
1259 unsigned long e, int val, const enum km_type km) 1259 unsigned long e, int val)
1260{ 1260{
1261 struct drbd_bitmap *b = mdev->bitmap; 1261 struct drbd_bitmap *b = mdev->bitmap;
1262 unsigned long *p_addr = NULL; 1262 unsigned long *p_addr = NULL;
@@ -1274,14 +1274,14 @@ static int __bm_change_bits_to(struct drbd_conf *mdev, const unsigned long s,
1274 unsigned int page_nr = bm_bit_to_page_idx(b, bitnr); 1274 unsigned int page_nr = bm_bit_to_page_idx(b, bitnr);
1275 if (page_nr != last_page_nr) { 1275 if (page_nr != last_page_nr) {
1276 if (p_addr) 1276 if (p_addr)
1277 __bm_unmap(p_addr, km); 1277 __bm_unmap(p_addr, KM_IRQ1);
1278 if (c < 0) 1278 if (c < 0)
1279 bm_set_page_lazy_writeout(b->bm_pages[last_page_nr]); 1279 bm_set_page_lazy_writeout(b->bm_pages[last_page_nr]);
1280 else if (c > 0) 1280 else if (c > 0)
1281 bm_set_page_need_writeout(b->bm_pages[last_page_nr]); 1281 bm_set_page_need_writeout(b->bm_pages[last_page_nr]);
1282 changed_total += c; 1282 changed_total += c;
1283 c = 0; 1283 c = 0;
1284 p_addr = __bm_map_pidx(b, page_nr, km); 1284 p_addr = __bm_map_pidx(b, page_nr, KM_IRQ1);
1285 last_page_nr = page_nr; 1285 last_page_nr = page_nr;
1286 } 1286 }
1287 if (val) 1287 if (val)
@@ -1290,7 +1290,7 @@ static int __bm_change_bits_to(struct drbd_conf *mdev, const unsigned long s,
1290 c -= (0 != __test_and_clear_bit_le(bitnr & BITS_PER_PAGE_MASK, p_addr)); 1290 c -= (0 != __test_and_clear_bit_le(bitnr & BITS_PER_PAGE_MASK, p_addr));
1291 } 1291 }
1292 if (p_addr) 1292 if (p_addr)
1293 __bm_unmap(p_addr, km); 1293 __bm_unmap(p_addr, KM_IRQ1);
1294 if (c < 0) 1294 if (c < 0)
1295 bm_set_page_lazy_writeout(b->bm_pages[last_page_nr]); 1295 bm_set_page_lazy_writeout(b->bm_pages[last_page_nr]);
1296 else if (c > 0) 1296 else if (c > 0)
@@ -1318,7 +1318,7 @@ static int bm_change_bits_to(struct drbd_conf *mdev, const unsigned long s,
1318 if ((val ? BM_DONT_SET : BM_DONT_CLEAR) & b->bm_flags) 1318 if ((val ? BM_DONT_SET : BM_DONT_CLEAR) & b->bm_flags)
1319 bm_print_lock_info(mdev); 1319 bm_print_lock_info(mdev);
1320 1320
1321 c = __bm_change_bits_to(mdev, s, e, val, KM_IRQ1); 1321 c = __bm_change_bits_to(mdev, s, e, val);
1322 1322
1323 spin_unlock_irqrestore(&b->bm_lock, flags); 1323 spin_unlock_irqrestore(&b->bm_lock, flags);
1324 return c; 1324 return c;
@@ -1343,16 +1343,17 @@ static inline void bm_set_full_words_within_one_page(struct drbd_bitmap *b,
1343{ 1343{
1344 int i; 1344 int i;
1345 int bits; 1345 int bits;
1346 unsigned long *paddr = kmap_atomic(b->bm_pages[page_nr], KM_USER0); 1346 unsigned long *paddr = kmap_atomic(b->bm_pages[page_nr], KM_IRQ1);
1347 for (i = first_word; i < last_word; i++) { 1347 for (i = first_word; i < last_word; i++) {
1348 bits = hweight_long(paddr[i]); 1348 bits = hweight_long(paddr[i]);
1349 paddr[i] = ~0UL; 1349 paddr[i] = ~0UL;
1350 b->bm_set += BITS_PER_LONG - bits; 1350 b->bm_set += BITS_PER_LONG - bits;
1351 } 1351 }
1352 kunmap_atomic(paddr, KM_USER0); 1352 kunmap_atomic(paddr, KM_IRQ1);
1353} 1353}
1354 1354
1355/* Same thing as drbd_bm_set_bits, but without taking the spin_lock_irqsave. 1355/* Same thing as drbd_bm_set_bits,
1356 * but more efficient for a large bit range.
1356 * You must first drbd_bm_lock(). 1357 * You must first drbd_bm_lock().
1357 * Can be called to set the whole bitmap in one go. 1358 * Can be called to set the whole bitmap in one go.
1358 * Sets bits from s to e _inclusive_. */ 1359 * Sets bits from s to e _inclusive_. */
@@ -1366,6 +1367,7 @@ void _drbd_bm_set_bits(struct drbd_conf *mdev, const unsigned long s, const unsi
1366 * Do not use memset, because we must account for changes, 1367 * Do not use memset, because we must account for changes,
1367 * so we need to loop over the words with hweight() anyways. 1368 * so we need to loop over the words with hweight() anyways.
1368 */ 1369 */
1370 struct drbd_bitmap *b = mdev->bitmap;
1369 unsigned long sl = ALIGN(s,BITS_PER_LONG); 1371 unsigned long sl = ALIGN(s,BITS_PER_LONG);
1370 unsigned long el = (e+1) & ~((unsigned long)BITS_PER_LONG-1); 1372 unsigned long el = (e+1) & ~((unsigned long)BITS_PER_LONG-1);
1371 int first_page; 1373 int first_page;
@@ -1376,15 +1378,19 @@ void _drbd_bm_set_bits(struct drbd_conf *mdev, const unsigned long s, const unsi
1376 1378
1377 if (e - s <= 3*BITS_PER_LONG) { 1379 if (e - s <= 3*BITS_PER_LONG) {
1378 /* don't bother; el and sl may even be wrong. */ 1380 /* don't bother; el and sl may even be wrong. */
1379 __bm_change_bits_to(mdev, s, e, 1, KM_USER0); 1381 spin_lock_irq(&b->bm_lock);
1382 __bm_change_bits_to(mdev, s, e, 1);
1383 spin_unlock_irq(&b->bm_lock);
1380 return; 1384 return;
1381 } 1385 }
1382 1386
1383 /* difference is large enough that we can trust sl and el */ 1387 /* difference is large enough that we can trust sl and el */
1384 1388
1389 spin_lock_irq(&b->bm_lock);
1390
1385 /* bits filling the current long */ 1391 /* bits filling the current long */
1386 if (sl) 1392 if (sl)
1387 __bm_change_bits_to(mdev, s, sl-1, 1, KM_USER0); 1393 __bm_change_bits_to(mdev, s, sl-1, 1);
1388 1394
1389 first_page = sl >> (3 + PAGE_SHIFT); 1395 first_page = sl >> (3 + PAGE_SHIFT);
1390 last_page = el >> (3 + PAGE_SHIFT); 1396 last_page = el >> (3 + PAGE_SHIFT);
@@ -1397,8 +1403,10 @@ void _drbd_bm_set_bits(struct drbd_conf *mdev, const unsigned long s, const unsi
1397 /* first and full pages, unless first page == last page */ 1403 /* first and full pages, unless first page == last page */
1398 for (page_nr = first_page; page_nr < last_page; page_nr++) { 1404 for (page_nr = first_page; page_nr < last_page; page_nr++) {
1399 bm_set_full_words_within_one_page(mdev->bitmap, page_nr, first_word, last_word); 1405 bm_set_full_words_within_one_page(mdev->bitmap, page_nr, first_word, last_word);
1406 spin_unlock_irq(&b->bm_lock);
1400 cond_resched(); 1407 cond_resched();
1401 first_word = 0; 1408 first_word = 0;
1409 spin_lock_irq(&b->bm_lock);
1402 } 1410 }
1403 1411
1404 /* last page (respectively only page, for first page == last page) */ 1412 /* last page (respectively only page, for first page == last page) */
@@ -1411,7 +1419,8 @@ void _drbd_bm_set_bits(struct drbd_conf *mdev, const unsigned long s, const unsi
1411 * it would trigger an assert in __bm_change_bits_to() 1419 * it would trigger an assert in __bm_change_bits_to()
1412 */ 1420 */
1413 if (el <= e) 1421 if (el <= e)
1414 __bm_change_bits_to(mdev, el, e, 1, KM_USER0); 1422 __bm_change_bits_to(mdev, el, e, 1);
1423 spin_unlock_irq(&b->bm_lock);
1415} 1424}
1416 1425
1417/* returns bit state 1426/* returns bit state
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c
index 25d32c5aa50a..43beaca53179 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -4602,6 +4602,11 @@ int drbd_asender(struct drbd_thread *thi)
4602 dev_err(DEV, "meta connection shut down by peer.\n"); 4602 dev_err(DEV, "meta connection shut down by peer.\n");
4603 goto reconnect; 4603 goto reconnect;
4604 } else if (rv == -EAGAIN) { 4604 } else if (rv == -EAGAIN) {
4605 /* If the data socket received something meanwhile,
4606 * that is good enough: peer is still alive. */
4607 if (time_after(mdev->last_received,
4608 jiffies - mdev->meta.socket->sk->sk_rcvtimeo))
4609 continue;
4605 if (ping_timeout_active) { 4610 if (ping_timeout_active) {
4606 dev_err(DEV, "PingAck did not arrive in time.\n"); 4611 dev_err(DEV, "PingAck did not arrive in time.\n");
4607 goto reconnect; 4612 goto reconnect;
@@ -4637,6 +4642,7 @@ int drbd_asender(struct drbd_thread *thi)
4637 goto reconnect; 4642 goto reconnect;
4638 } 4643 }
4639 if (received == expect) { 4644 if (received == expect) {
4645 mdev->last_received = jiffies;
4640 D_ASSERT(cmd != NULL); 4646 D_ASSERT(cmd != NULL);
4641 if (!cmd->process(mdev, h)) 4647 if (!cmd->process(mdev, h))
4642 goto reconnect; 4648 goto reconnect;
diff --git a/drivers/block/drbd/drbd_worker.c b/drivers/block/drbd/drbd_worker.c
index 4d76b06b6b20..4d3e6f6213ba 100644
--- a/drivers/block/drbd/drbd_worker.c
+++ b/drivers/block/drbd/drbd_worker.c
@@ -536,12 +536,7 @@ static int w_make_resync_request(struct drbd_conf *mdev,
536 return 1; 536 return 1;
537 } 537 }
538 538
539 /* starting with drbd 8.3.8, we can handle multi-bio EEs, 539 max_bio_size = queue_max_hw_sectors(mdev->rq_queue) << 9;
540 * if it should be necessary */
541 max_bio_size =
542 mdev->agreed_pro_version < 94 ? queue_max_hw_sectors(mdev->rq_queue) << 9 :
543 mdev->agreed_pro_version < 95 ? DRBD_MAX_SIZE_H80_PACKET : DRBD_MAX_BIO_SIZE;
544
545 number = drbd_rs_number_requests(mdev); 540 number = drbd_rs_number_requests(mdev);
546 if (number == 0) 541 if (number == 0)
547 goto requeue; 542 goto requeue;