aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/drbd/drbd_main.c
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruen@linbit.com>2011-03-16 06:46:33 -0400
committerPhilipp Reisner <philipp.reisner@linbit.com>2012-11-08 10:44:42 -0500
commit7fae55da38e810c75b97cc56380aa6f735504216 (patch)
treeafc53e73ba3221250a0838f00370298d124e69ef /drivers/block/drbd/drbd_main.c
parent7b57b89d624cfdefc91d0a8b015c494c25a49292 (diff)
drbd: _drbd_send_bio(), _drbd_send_zc_bio(): Return 0 upon success and an error code otherwise
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com> Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Diffstat (limited to 'drivers/block/drbd/drbd_main.c')
-rw-r--r--drivers/block/drbd/drbd_main.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
index 8fee2fe4c853..77c957ff7a0e 100644
--- a/drivers/block/drbd/drbd_main.c
+++ b/drivers/block/drbd/drbd_main.c
@@ -1473,12 +1473,15 @@ static int _drbd_send_bio(struct drbd_conf *mdev, struct bio *bio)
1473 int i; 1473 int i;
1474 /* hint all but last page with MSG_MORE */ 1474 /* hint all but last page with MSG_MORE */
1475 __bio_for_each_segment(bvec, bio, i, 0) { 1475 __bio_for_each_segment(bvec, bio, i, 0) {
1476 if (_drbd_no_send_page(mdev, bvec->bv_page, 1476 int err;
1477 bvec->bv_offset, bvec->bv_len, 1477
1478 i == bio->bi_vcnt -1 ? 0 : MSG_MORE)) 1478 err = _drbd_no_send_page(mdev, bvec->bv_page,
1479 return 0; 1479 bvec->bv_offset, bvec->bv_len,
1480 i == bio->bi_vcnt - 1 ? 0 : MSG_MORE);
1481 if (err)
1482 return err;
1480 } 1483 }
1481 return 1; 1484 return 0;
1482} 1485}
1483 1486
1484static int _drbd_send_zc_bio(struct drbd_conf *mdev, struct bio *bio) 1487static int _drbd_send_zc_bio(struct drbd_conf *mdev, struct bio *bio)
@@ -1487,12 +1490,15 @@ static int _drbd_send_zc_bio(struct drbd_conf *mdev, struct bio *bio)
1487 int i; 1490 int i;
1488 /* hint all but last page with MSG_MORE */ 1491 /* hint all but last page with MSG_MORE */
1489 __bio_for_each_segment(bvec, bio, i, 0) { 1492 __bio_for_each_segment(bvec, bio, i, 0) {
1490 if (_drbd_send_page(mdev, bvec->bv_page, 1493 int err;
1491 bvec->bv_offset, bvec->bv_len, 1494
1492 i == bio->bi_vcnt -1 ? 0 : MSG_MORE)) 1495 err = _drbd_send_page(mdev, bvec->bv_page,
1493 return 0; 1496 bvec->bv_offset, bvec->bv_len,
1497 i == bio->bi_vcnt - 1 ? 0 : MSG_MORE);
1498 if (err)
1499 return err;
1494 } 1500 }
1495 return 1; 1501 return 0;
1496} 1502}
1497 1503
1498static int _drbd_send_zc_ee(struct drbd_conf *mdev, 1504static int _drbd_send_zc_ee(struct drbd_conf *mdev,
@@ -1576,9 +1582,9 @@ int drbd_send_dblock(struct drbd_conf *mdev, struct drbd_request *req)
1576 * receiving side, we sure have detected corruption elsewhere. 1582 * receiving side, we sure have detected corruption elsewhere.
1577 */ 1583 */
1578 if (mdev->tconn->net_conf->wire_protocol == DRBD_PROT_A || dgs) 1584 if (mdev->tconn->net_conf->wire_protocol == DRBD_PROT_A || dgs)
1579 ok = _drbd_send_bio(mdev, req->master_bio); 1585 ok = !_drbd_send_bio(mdev, req->master_bio);
1580 else 1586 else
1581 ok = _drbd_send_zc_bio(mdev, req->master_bio); 1587 ok = !_drbd_send_zc_bio(mdev, req->master_bio);
1582 1588
1583 /* double check digest, sometimes buffers have been modified in flight. */ 1589 /* double check digest, sometimes buffers have been modified in flight. */
1584 if (dgs > 0 && dgs <= 64) { 1590 if (dgs > 0 && dgs <= 64) {