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

drbd: Pass struct packet_info down to the asender receive functions

Signed-off-by: default avatarPhilipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: default avatarLars Ellenberg <lars.ellenberg@linbit.com>
parent 438c8374
...@@ -4459,7 +4459,7 @@ int drbdd_init(struct drbd_thread *thi) ...@@ -4459,7 +4459,7 @@ int drbdd_init(struct drbd_thread *thi)
/* ********* acknowledge sender ******** */ /* ********* acknowledge sender ******** */
static int got_conn_RqSReply(struct drbd_tconn *tconn, enum drbd_packet cmd) static int got_conn_RqSReply(struct drbd_tconn *tconn, struct packet_info *pi)
{ {
struct p_req_state_reply *p = tconn->meta.rbuf; struct p_req_state_reply *p = tconn->meta.rbuf;
int retcode = be32_to_cpu(p->retcode); int retcode = be32_to_cpu(p->retcode);
...@@ -4476,7 +4476,7 @@ static int got_conn_RqSReply(struct drbd_tconn *tconn, enum drbd_packet cmd) ...@@ -4476,7 +4476,7 @@ static int got_conn_RqSReply(struct drbd_tconn *tconn, enum drbd_packet cmd)
return true; return true;
} }
static int got_RqSReply(struct drbd_conf *mdev, enum drbd_packet cmd) static int got_RqSReply(struct drbd_conf *mdev, struct packet_info *pi)
{ {
struct p_req_state_reply *p = mdev->tconn->meta.rbuf; struct p_req_state_reply *p = mdev->tconn->meta.rbuf;
int retcode = be32_to_cpu(p->retcode); int retcode = be32_to_cpu(p->retcode);
...@@ -4493,13 +4493,13 @@ static int got_RqSReply(struct drbd_conf *mdev, enum drbd_packet cmd) ...@@ -4493,13 +4493,13 @@ static int got_RqSReply(struct drbd_conf *mdev, enum drbd_packet cmd)
return true; return true;
} }
static int got_Ping(struct drbd_tconn *tconn, enum drbd_packet cmd) static int got_Ping(struct drbd_tconn *tconn, struct packet_info *pi)
{ {
return drbd_send_ping_ack(tconn); return drbd_send_ping_ack(tconn);
} }
static int got_PingAck(struct drbd_tconn *tconn, enum drbd_packet cmd) static int got_PingAck(struct drbd_tconn *tconn, struct packet_info *pi)
{ {
/* restore idle timeout */ /* restore idle timeout */
tconn->meta.socket->sk->sk_rcvtimeo = tconn->net_conf->ping_int*HZ; tconn->meta.socket->sk->sk_rcvtimeo = tconn->net_conf->ping_int*HZ;
...@@ -4509,7 +4509,7 @@ static int got_PingAck(struct drbd_tconn *tconn, enum drbd_packet cmd) ...@@ -4509,7 +4509,7 @@ static int got_PingAck(struct drbd_tconn *tconn, enum drbd_packet cmd)
return true; return true;
} }
static int got_IsInSync(struct drbd_conf *mdev, enum drbd_packet cmd) static int got_IsInSync(struct drbd_conf *mdev, struct packet_info *pi)
{ {
struct p_block_ack *p = mdev->tconn->meta.rbuf; struct p_block_ack *p = mdev->tconn->meta.rbuf;
sector_t sector = be64_to_cpu(p->sector); sector_t sector = be64_to_cpu(p->sector);
...@@ -4554,7 +4554,7 @@ validate_req_change_req_state(struct drbd_conf *mdev, u64 id, sector_t sector, ...@@ -4554,7 +4554,7 @@ validate_req_change_req_state(struct drbd_conf *mdev, u64 id, sector_t sector,
return true; return true;
} }
static int got_BlockAck(struct drbd_conf *mdev, enum drbd_packet cmd) static int got_BlockAck(struct drbd_conf *mdev, struct packet_info *pi)
{ {
struct p_block_ack *p = mdev->tconn->meta.rbuf; struct p_block_ack *p = mdev->tconn->meta.rbuf;
sector_t sector = be64_to_cpu(p->sector); sector_t sector = be64_to_cpu(p->sector);
...@@ -4568,7 +4568,7 @@ static int got_BlockAck(struct drbd_conf *mdev, enum drbd_packet cmd) ...@@ -4568,7 +4568,7 @@ static int got_BlockAck(struct drbd_conf *mdev, enum drbd_packet cmd)
dec_rs_pending(mdev); dec_rs_pending(mdev);
return true; return true;
} }
switch (cmd) { switch (pi->cmd) {
case P_RS_WRITE_ACK: case P_RS_WRITE_ACK:
D_ASSERT(mdev->tconn->net_conf->wire_protocol == DRBD_PROT_C); D_ASSERT(mdev->tconn->net_conf->wire_protocol == DRBD_PROT_C);
what = WRITE_ACKED_BY_PEER_AND_SIS; what = WRITE_ACKED_BY_PEER_AND_SIS;
...@@ -4599,7 +4599,7 @@ static int got_BlockAck(struct drbd_conf *mdev, enum drbd_packet cmd) ...@@ -4599,7 +4599,7 @@ static int got_BlockAck(struct drbd_conf *mdev, enum drbd_packet cmd)
what, false); what, false);
} }
static int got_NegAck(struct drbd_conf *mdev, enum drbd_packet cmd) static int got_NegAck(struct drbd_conf *mdev, struct packet_info *pi)
{ {
struct p_block_ack *p = mdev->tconn->meta.rbuf; struct p_block_ack *p = mdev->tconn->meta.rbuf;
sector_t sector = be64_to_cpu(p->sector); sector_t sector = be64_to_cpu(p->sector);
...@@ -4632,7 +4632,7 @@ static int got_NegAck(struct drbd_conf *mdev, enum drbd_packet cmd) ...@@ -4632,7 +4632,7 @@ static int got_NegAck(struct drbd_conf *mdev, enum drbd_packet cmd)
return true; return true;
} }
static int got_NegDReply(struct drbd_conf *mdev, enum drbd_packet cmd) static int got_NegDReply(struct drbd_conf *mdev, struct packet_info *pi)
{ {
struct p_block_ack *p = mdev->tconn->meta.rbuf; struct p_block_ack *p = mdev->tconn->meta.rbuf;
sector_t sector = be64_to_cpu(p->sector); sector_t sector = be64_to_cpu(p->sector);
...@@ -4647,7 +4647,7 @@ static int got_NegDReply(struct drbd_conf *mdev, enum drbd_packet cmd) ...@@ -4647,7 +4647,7 @@ static int got_NegDReply(struct drbd_conf *mdev, enum drbd_packet cmd)
NEG_ACKED, false); NEG_ACKED, false);
} }
static int got_NegRSDReply(struct drbd_conf *mdev, enum drbd_packet cmd) static int got_NegRSDReply(struct drbd_conf *mdev, struct packet_info *pi)
{ {
sector_t sector; sector_t sector;
int size; int size;
...@@ -4662,7 +4662,7 @@ static int got_NegRSDReply(struct drbd_conf *mdev, enum drbd_packet cmd) ...@@ -4662,7 +4662,7 @@ static int got_NegRSDReply(struct drbd_conf *mdev, enum drbd_packet cmd)
if (get_ldev_if_state(mdev, D_FAILED)) { if (get_ldev_if_state(mdev, D_FAILED)) {
drbd_rs_complete_io(mdev, sector); drbd_rs_complete_io(mdev, sector);
switch (cmd) { switch (pi->cmd) {
case P_NEG_RS_DREPLY: case P_NEG_RS_DREPLY:
drbd_rs_failed_io(mdev, sector, size); drbd_rs_failed_io(mdev, sector, size);
case P_RS_CANCEL: case P_RS_CANCEL:
...@@ -4678,7 +4678,7 @@ static int got_NegRSDReply(struct drbd_conf *mdev, enum drbd_packet cmd) ...@@ -4678,7 +4678,7 @@ static int got_NegRSDReply(struct drbd_conf *mdev, enum drbd_packet cmd)
return true; return true;
} }
static int got_BarrierAck(struct drbd_conf *mdev, enum drbd_packet cmd) static int got_BarrierAck(struct drbd_conf *mdev, struct packet_info *pi)
{ {
struct p_barrier_ack *p = mdev->tconn->meta.rbuf; struct p_barrier_ack *p = mdev->tconn->meta.rbuf;
...@@ -4694,7 +4694,7 @@ static int got_BarrierAck(struct drbd_conf *mdev, enum drbd_packet cmd) ...@@ -4694,7 +4694,7 @@ static int got_BarrierAck(struct drbd_conf *mdev, enum drbd_packet cmd)
return true; return true;
} }
static int got_OVResult(struct drbd_conf *mdev, enum drbd_packet cmd) static int got_OVResult(struct drbd_conf *mdev, struct packet_info *pi)
{ {
struct p_block_ack *p = mdev->tconn->meta.rbuf; struct p_block_ack *p = mdev->tconn->meta.rbuf;
struct drbd_work *w; struct drbd_work *w;
...@@ -4739,7 +4739,7 @@ static int got_OVResult(struct drbd_conf *mdev, enum drbd_packet cmd) ...@@ -4739,7 +4739,7 @@ static int got_OVResult(struct drbd_conf *mdev, enum drbd_packet cmd)
return true; return true;
} }
static int got_skip(struct drbd_conf *mdev, enum drbd_packet cmd) static int got_skip(struct drbd_conf *mdev, struct packet_info *pi)
{ {
return true; return true;
} }
...@@ -4774,8 +4774,8 @@ struct asender_cmd { ...@@ -4774,8 +4774,8 @@ struct asender_cmd {
size_t pkt_size; size_t pkt_size;
enum mdev_or_conn fa_type; /* first argument's type */ enum mdev_or_conn fa_type; /* first argument's type */
union { union {
int (*mdev_fn)(struct drbd_conf *mdev, enum drbd_packet cmd); int (*mdev_fn)(struct drbd_conf *mdev, struct packet_info *);
int (*conn_fn)(struct drbd_tconn *tconn, enum drbd_packet cmd); int (*conn_fn)(struct drbd_tconn *tconn, struct packet_info *);
}; };
}; };
...@@ -4902,10 +4902,10 @@ int drbd_asender(struct drbd_thread *thi) ...@@ -4902,10 +4902,10 @@ int drbd_asender(struct drbd_thread *thi)
bool rv; bool rv;
if (cmd->fa_type == CONN) { if (cmd->fa_type == CONN) {
rv = cmd->conn_fn(tconn, pi.cmd); rv = cmd->conn_fn(tconn, &pi);
} else { } else {
struct drbd_conf *mdev = vnr_to_mdev(tconn, pi.vnr); struct drbd_conf *mdev = vnr_to_mdev(tconn, pi.vnr);
rv = cmd->mdev_fn(mdev, pi.cmd); rv = cmd->mdev_fn(mdev, &pi);
} }
if (!rv) if (!rv)
......
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