Commit 7fae55da authored by Andreas Gruenbacher's avatar Andreas Gruenbacher Committed by Philipp Reisner

drbd: _drbd_send_bio(), _drbd_send_zc_bio(): Return 0 upon success and an error code otherwise

Signed-off-by: default avatarPhilipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: default avatarLars Ellenberg <lars.ellenberg@linbit.com>
parent 7b57b89d
...@@ -1473,12 +1473,15 @@ static int _drbd_send_bio(struct drbd_conf *mdev, struct bio *bio) ...@@ -1473,12 +1473,15 @@ static int _drbd_send_bio(struct drbd_conf *mdev, struct bio *bio)
int i; int i;
/* hint all but last page with MSG_MORE */ /* hint all but last page with MSG_MORE */
__bio_for_each_segment(bvec, bio, i, 0) { __bio_for_each_segment(bvec, bio, i, 0) {
if (_drbd_no_send_page(mdev, bvec->bv_page, int err;
bvec->bv_offset, bvec->bv_len,
i == bio->bi_vcnt -1 ? 0 : MSG_MORE)) err = _drbd_no_send_page(mdev, bvec->bv_page,
return 0; bvec->bv_offset, bvec->bv_len,
i == bio->bi_vcnt - 1 ? 0 : MSG_MORE);
if (err)
return err;
} }
return 1; return 0;
} }
static int _drbd_send_zc_bio(struct drbd_conf *mdev, struct bio *bio) static 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,12 +1490,15 @@ static int _drbd_send_zc_bio(struct drbd_conf *mdev, struct bio *bio)
int i; int i;
/* hint all but last page with MSG_MORE */ /* hint all but last page with MSG_MORE */
__bio_for_each_segment(bvec, bio, i, 0) { __bio_for_each_segment(bvec, bio, i, 0) {
if (_drbd_send_page(mdev, bvec->bv_page, int err;
bvec->bv_offset, bvec->bv_len,
i == bio->bi_vcnt -1 ? 0 : MSG_MORE)) err = _drbd_send_page(mdev, bvec->bv_page,
return 0; bvec->bv_offset, bvec->bv_len,
i == bio->bi_vcnt - 1 ? 0 : MSG_MORE);
if (err)
return err;
} }
return 1; return 0;
} }
static int _drbd_send_zc_ee(struct drbd_conf *mdev, static 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,9 +1582,9 @@ int drbd_send_dblock(struct drbd_conf *mdev, struct drbd_request *req)
* receiving side, we sure have detected corruption elsewhere. * receiving side, we sure have detected corruption elsewhere.
*/ */
if (mdev->tconn->net_conf->wire_protocol == DRBD_PROT_A || dgs) if (mdev->tconn->net_conf->wire_protocol == DRBD_PROT_A || dgs)
ok = _drbd_send_bio(mdev, req->master_bio); ok = !_drbd_send_bio(mdev, req->master_bio);
else else
ok = _drbd_send_zc_bio(mdev, req->master_bio); ok = !_drbd_send_zc_bio(mdev, req->master_bio);
/* double check digest, sometimes buffers have been modified in flight. */ /* double check digest, sometimes buffers have been modified in flight. */
if (dgs > 0 && dgs <= 64) { if (dgs > 0 && dgs <= 64) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment