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

drbd: _drbd_send_ack(): 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 d4e67d7c
...@@ -1249,7 +1249,6 @@ void drbd_send_b_ack(struct drbd_conf *mdev, u32 barrier_nr, u32 set_size) ...@@ -1249,7 +1249,6 @@ void drbd_send_b_ack(struct drbd_conf *mdev, u32 barrier_nr, u32 set_size)
static int _drbd_send_ack(struct drbd_conf *mdev, enum drbd_packet cmd, static int _drbd_send_ack(struct drbd_conf *mdev, enum drbd_packet cmd,
u64 sector, u32 blksize, u64 block_id) u64 sector, u32 blksize, u64 block_id)
{ {
int ok;
struct p_block_ack p; struct p_block_ack p;
p.sector = sector; p.sector = sector;
...@@ -1258,9 +1257,8 @@ static int _drbd_send_ack(struct drbd_conf *mdev, enum drbd_packet cmd, ...@@ -1258,9 +1257,8 @@ static int _drbd_send_ack(struct drbd_conf *mdev, enum drbd_packet cmd,
p.seq_num = cpu_to_be32(atomic_inc_return(&mdev->packet_seq)); p.seq_num = cpu_to_be32(atomic_inc_return(&mdev->packet_seq));
if (!mdev->tconn->meta.socket || mdev->state.conn < C_CONNECTED) if (!mdev->tconn->meta.socket || mdev->state.conn < C_CONNECTED)
return false; return -EIO;
ok = !drbd_send_cmd(mdev, &mdev->tconn->meta, cmd, &p.head, sizeof(p)); return drbd_send_cmd(mdev, &mdev->tconn->meta, cmd, &p.head, sizeof(p));
return ok;
} }
/* dp->sector and dp->block_id already/still in network byte order, /* dp->sector and dp->block_id already/still in network byte order,
...@@ -1271,14 +1269,14 @@ int drbd_send_ack_dp(struct drbd_conf *mdev, enum drbd_packet cmd, ...@@ -1271,14 +1269,14 @@ int drbd_send_ack_dp(struct drbd_conf *mdev, enum drbd_packet cmd,
{ {
data_size -= (mdev->tconn->agreed_pro_version >= 87 && mdev->tconn->integrity_r_tfm) ? data_size -= (mdev->tconn->agreed_pro_version >= 87 && mdev->tconn->integrity_r_tfm) ?
crypto_hash_digestsize(mdev->tconn->integrity_r_tfm) : 0; crypto_hash_digestsize(mdev->tconn->integrity_r_tfm) : 0;
return _drbd_send_ack(mdev, cmd, dp->sector, cpu_to_be32(data_size), return !_drbd_send_ack(mdev, cmd, dp->sector, cpu_to_be32(data_size),
dp->block_id); dp->block_id);
} }
int drbd_send_ack_rp(struct drbd_conf *mdev, enum drbd_packet cmd, int drbd_send_ack_rp(struct drbd_conf *mdev, enum drbd_packet cmd,
struct p_block_req *rp) struct p_block_req *rp)
{ {
return _drbd_send_ack(mdev, cmd, rp->sector, rp->blksize, rp->block_id); return !_drbd_send_ack(mdev, cmd, rp->sector, rp->blksize, rp->block_id);
} }
/** /**
...@@ -1290,7 +1288,7 @@ int drbd_send_ack_rp(struct drbd_conf *mdev, enum drbd_packet cmd, ...@@ -1290,7 +1288,7 @@ int drbd_send_ack_rp(struct drbd_conf *mdev, enum drbd_packet cmd,
int drbd_send_ack(struct drbd_conf *mdev, enum drbd_packet cmd, int drbd_send_ack(struct drbd_conf *mdev, enum drbd_packet cmd,
struct drbd_peer_request *peer_req) struct drbd_peer_request *peer_req)
{ {
return _drbd_send_ack(mdev, cmd, return !_drbd_send_ack(mdev, cmd,
cpu_to_be64(peer_req->i.sector), cpu_to_be64(peer_req->i.sector),
cpu_to_be32(peer_req->i.size), cpu_to_be32(peer_req->i.size),
peer_req->block_id); peer_req->block_id);
...@@ -1301,7 +1299,7 @@ int drbd_send_ack(struct drbd_conf *mdev, enum drbd_packet cmd, ...@@ -1301,7 +1299,7 @@ int drbd_send_ack(struct drbd_conf *mdev, enum drbd_packet cmd,
int drbd_send_ack_ex(struct drbd_conf *mdev, enum drbd_packet cmd, int drbd_send_ack_ex(struct drbd_conf *mdev, enum drbd_packet cmd,
sector_t sector, int blksize, u64 block_id) sector_t sector, int blksize, u64 block_id)
{ {
return _drbd_send_ack(mdev, cmd, return !_drbd_send_ack(mdev, cmd,
cpu_to_be64(sector), cpu_to_be64(sector),
cpu_to_be32(blksize), cpu_to_be32(blksize),
cpu_to_be64(block_id)); cpu_to_be64(block_id));
......
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