aboutsummaryrefslogtreecommitdiffstats
path: root/net/ceph
diff options
context:
space:
mode:
authorAlex Elder <elder@inktank.com>2013-04-03 02:28:57 -0400
committerSage Weil <sage@inktank.com>2013-05-02 00:18:05 -0400
commit9fc6e0647180f72392f03a29863b6602e22aa024 (patch)
tree4393a8d8905fbe2a4e4dfc0d79c777bf1cf28df1 /net/ceph
parent6010a451c38b04cf10808a508f33e5bf32e7de63 (diff)
libceph: compute incoming bytes once
This is a simple change, extracting the number of incoming data bytes just once in handle_reply(). Signed-off-by: Alex Elder <elder@inktank.com> Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Diffstat (limited to 'net/ceph')
-rw-r--r--net/ceph/osd_client.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index 426ca1f2a721..1379b3313348 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -1293,6 +1293,7 @@ static void handle_reply(struct ceph_osd_client *osdc, struct ceph_msg *msg,
1293 u64 reassert_version; 1293 u64 reassert_version;
1294 u32 osdmap_epoch; 1294 u32 osdmap_epoch;
1295 int already_completed; 1295 int already_completed;
1296 u32 bytes;
1296 int i; 1297 int i;
1297 1298
1298 tid = le64_to_cpu(msg->hdr.tid); 1299 tid = le64_to_cpu(msg->hdr.tid);
@@ -1347,9 +1348,10 @@ static void handle_reply(struct ceph_osd_client *osdc, struct ceph_msg *msg,
1347 payload_len += len; 1348 payload_len += len;
1348 p += sizeof(*op); 1349 p += sizeof(*op);
1349 } 1350 }
1350 if (payload_len != le32_to_cpu(msg->hdr.data_len)) { 1351 bytes = le32_to_cpu(msg->hdr.data_len);
1352 if (payload_len != bytes) {
1351 pr_warning("sum of op payload lens %d != data_len %d", 1353 pr_warning("sum of op payload lens %d != data_len %d",
1352 payload_len, le32_to_cpu(msg->hdr.data_len)); 1354 payload_len, bytes);
1353 goto bad_put; 1355 goto bad_put;
1354 } 1356 }
1355 1357
@@ -1359,10 +1361,8 @@ static void handle_reply(struct ceph_osd_client *osdc, struct ceph_msg *msg,
1359 req->r_reply_op_result[i] = ceph_decode_32(&p); 1361 req->r_reply_op_result[i] = ceph_decode_32(&p);
1360 1362
1361 if (!req->r_got_reply) { 1363 if (!req->r_got_reply) {
1362 unsigned int bytes;
1363 1364
1364 req->r_result = result; 1365 req->r_result = result;
1365 bytes = le32_to_cpu(msg->hdr.data_len);
1366 dout("handle_reply result %d bytes %d\n", req->r_result, 1366 dout("handle_reply result %d bytes %d\n", req->r_result,
1367 bytes); 1367 bytes);
1368 if (req->r_result == 0) 1368 if (req->r_result == 0)