[Drbd-dev] [PATCH 14/21] drbd: clean-up receive_SyncParam()

Fabian Frederick fabf at skynet.be
Fri Nov 27 22:29:29 CET 2015


Initialize header_size then data_size once.

Signed-off-by: Fabian Frederick <fabf at skynet.be>
---
 drivers/block/drbd/drbd_receiver.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c
index ad9b99b..3ca6516 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -3556,18 +3556,16 @@ static int receive_SyncParam(struct drbd_connection *connection, struct packet_i
 		return -EIO;
 	}
 
-	if (apv <= 88) {
+	if (apv <= 88)
 		header_size = sizeof(struct p_rs_param);
-		data_size = pi->size - header_size;
-	} else if (apv <= 94) {
+	else if (apv <= 94)
 		header_size = sizeof(struct p_rs_param_89);
-		data_size = pi->size - header_size;
-		D_ASSERT(device, data_size == 0);
-	} else {
+	else
 		header_size = sizeof(struct p_rs_param_95);
-		data_size = pi->size - header_size;
+
+	data_size = pi->size - header_size;
+	if (apv > 88)
 		D_ASSERT(device, data_size == 0);
-	}
 
 	/* initialize verify_alg and csums_alg */
 	p = pi->data;
-- 
2.1.4



More information about the drbd-dev mailing list