diff mbox

[02/20] libceph: compute incoming bytes once

Message ID 515ED937.5080509@inktank.com (mailing list archive)
State New, archived
Headers show

Commit Message

Alex Elder April 5, 2013, 2:01 p.m. UTC
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>
---
 net/ceph/osd_client.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

 	tid = le64_to_cpu(msg->hdr.tid);
@@ -1347,9 +1348,10 @@ static void handle_reply(struct ceph_osd_client
*osdc, struct ceph_msg *msg,
 		payload_len += len;
 		p += sizeof(*op);
 	}
-	if (payload_len != le32_to_cpu(msg->hdr.data_len)) {
+	bytes = le32_to_cpu(msg->hdr.data_len);
+	if (payload_len != bytes) {
 		pr_warning("sum of op payload lens %d != data_len %d",
-			   payload_len, le32_to_cpu(msg->hdr.data_len));
+			   payload_len, bytes);
 		goto bad_put;
 	}

@@ -1359,10 +1361,8 @@ static void handle_reply(struct ceph_osd_client
*osdc, struct ceph_msg *msg,
 		req->r_reply_op_result[i] = ceph_decode_32(&p);

 	if (!req->r_got_reply) {
-		unsigned int bytes;

 		req->r_result = result;
-		bytes = le32_to_cpu(msg->hdr.data_len);
 		dout("handle_reply result %d bytes %d\n", req->r_result,
 		     bytes);
 		if (req->r_result == 0)

Comments

Josh Durgin April 5, 2013, 6:14 p.m. UTC | #1
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>

On 04/05/2013 07:01 AM, Alex Elder wrote:
> 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>
> ---
>   net/ceph/osd_client.c |    8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
> index 426ca1f..1379b33 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,
>   	u64 reassert_version;
>   	u32 osdmap_epoch;
>   	int already_completed;
> +	u32 bytes;
>   	int i;
>
>   	tid = le64_to_cpu(msg->hdr.tid);
> @@ -1347,9 +1348,10 @@ static void handle_reply(struct ceph_osd_client
> *osdc, struct ceph_msg *msg,
>   		payload_len += len;
>   		p += sizeof(*op);
>   	}
> -	if (payload_len != le32_to_cpu(msg->hdr.data_len)) {
> +	bytes = le32_to_cpu(msg->hdr.data_len);
> +	if (payload_len != bytes) {
>   		pr_warning("sum of op payload lens %d != data_len %d",
> -			   payload_len, le32_to_cpu(msg->hdr.data_len));
> +			   payload_len, bytes);
>   		goto bad_put;
>   	}
>
> @@ -1359,10 +1361,8 @@ static void handle_reply(struct ceph_osd_client
> *osdc, struct ceph_msg *msg,
>   		req->r_reply_op_result[i] = ceph_decode_32(&p);
>
>   	if (!req->r_got_reply) {
> -		unsigned int bytes;
>
>   		req->r_result = result;
> -		bytes = le32_to_cpu(msg->hdr.data_len);
>   		dout("handle_reply result %d bytes %d\n", req->r_result,
>   		     bytes);
>   		if (req->r_result == 0)
>

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index 426ca1f..1379b33 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,
 	u64 reassert_version;
 	u32 osdmap_epoch;
 	int already_completed;
+	u32 bytes;
 	int i;