Commit b987427b authored by Andreas Gruenbacher's avatar Andreas Gruenbacher Committed by Philipp Reisner

drbd: _drbd_no_send_page(): 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 73218a3c
...@@ -1405,11 +1405,17 @@ static void drbd_update_congested(struct drbd_tconn *tconn) ...@@ -1405,11 +1405,17 @@ static void drbd_update_congested(struct drbd_tconn *tconn)
static int _drbd_no_send_page(struct drbd_conf *mdev, struct page *page, static int _drbd_no_send_page(struct drbd_conf *mdev, struct page *page,
int offset, size_t size, unsigned msg_flags) int offset, size_t size, unsigned msg_flags)
{ {
int sent = drbd_send(mdev->tconn, mdev->tconn->data.socket, kmap(page) + offset, size, msg_flags); struct socket *socket;
void *addr;
int err;
socket = mdev->tconn->data.socket;
addr = kmap(page) + offset;
err = drbd_send_all(mdev->tconn, socket, addr, size, msg_flags);
kunmap(page); kunmap(page);
if (sent == size) if (!err)
mdev->send_cnt += size>>9; mdev->send_cnt += size >> 9;
return sent == size; return err;
} }
static int _drbd_send_page(struct drbd_conf *mdev, struct page *page, static int _drbd_send_page(struct drbd_conf *mdev, struct page *page,
...@@ -1426,7 +1432,7 @@ static int _drbd_send_page(struct drbd_conf *mdev, struct page *page, ...@@ -1426,7 +1432,7 @@ static int _drbd_send_page(struct drbd_conf *mdev, struct page *page,
* __page_cache_release a page that would actually still be referenced * __page_cache_release a page that would actually still be referenced
* by someone, leading to some obscure delayed Oops somewhere else. */ * by someone, leading to some obscure delayed Oops somewhere else. */
if (disable_sendpage || (page_count(page) < 1) || PageSlab(page)) if (disable_sendpage || (page_count(page) < 1) || PageSlab(page))
return _drbd_no_send_page(mdev, page, offset, size, msg_flags); return !_drbd_no_send_page(mdev, page, offset, size, msg_flags);
msg_flags |= MSG_NOSIGNAL; msg_flags |= MSG_NOSIGNAL;
drbd_update_congested(mdev->tconn); drbd_update_congested(mdev->tconn);
...@@ -1465,7 +1471,7 @@ static int _drbd_send_bio(struct drbd_conf *mdev, struct bio *bio) ...@@ -1465,7 +1471,7 @@ 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, if (_drbd_no_send_page(mdev, bvec->bv_page,
bvec->bv_offset, bvec->bv_len, bvec->bv_offset, bvec->bv_len,
i == bio->bi_vcnt -1 ? 0 : MSG_MORE)) i == bio->bi_vcnt -1 ? 0 : MSG_MORE))
return 0; return 0;
......
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