CEPH filesystem development
 help / color / mirror / Atom feed
From: Alex Elder <elder@ieee.org>
To: Ilya Dryomov <idryomov@gmail.com>
Cc: ceph-devel@vger.kernel.org, Varada Kari <varada.kari@sandisk.com>
Subject: Re: [PATCH 4/4] libceph: use sizeof_footer() more
Date: Sun, 21 Feb 2016 09:08:52 -0600	[thread overview]
Message-ID: <56C9D304.6040600@ieee.org> (raw)
In-Reply-To: <1456065337-25628-1-git-send-email-idryomov@gmail.com>

On 02/21/2016 08:35 AM, Ilya Dryomov wrote:
> Don't open-code sizeof_footer() in read_partial_message() and
> ceph_msg_revoke().  Also, after switching to sizeof_footer(), it's now
> possible to use con_out_kvec_add() in prepare_write_message_footer().
> 
> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>

There you go, that's a nice result!

Reviewed-by: Alex Elder <elder@linaro.org>

> ---
>  net/ceph/messenger.c | 19 +++----------------
>  1 file changed, 3 insertions(+), 16 deletions(-)
> 
> diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
> index 9382619a405b..d9681bc839c7 100644
> --- a/net/ceph/messenger.c
> +++ b/net/ceph/messenger.c
> @@ -1221,25 +1221,19 @@ static void prepare_message_data(struct ceph_msg *msg, u32 data_len)
>  static void prepare_write_message_footer(struct ceph_connection *con)
>  {
>  	struct ceph_msg *m = con->out_msg;
> -	int v = con->out_kvec_left;
>  
>  	m->footer.flags |= CEPH_MSG_FOOTER_COMPLETE;
>  
>  	dout("prepare_write_message_footer %p\n", con);
> -	con->out_kvec[v].iov_base = &m->footer;
> +	con_out_kvec_add(con, sizeof_footer(con), &m->footer);
>  	if (con->peer_features & CEPH_FEATURE_MSG_AUTH) {
>  		if (con->ops->sign_message)
>  			con->ops->sign_message(m);
>  		else
>  			m->footer.sig = 0;
> -		con->out_kvec[v].iov_len = sizeof(m->footer);
> -		con->out_kvec_bytes += sizeof(m->footer);
>  	} else {
>  		m->old_footer.flags = m->footer.flags;
> -		con->out_kvec[v].iov_len = sizeof(m->old_footer);
> -		con->out_kvec_bytes += sizeof(m->old_footer);
>  	}
> -	con->out_kvec_left++;
>  	con->out_more = m->more_to_follow;
>  	con->out_msg_done = true;
>  }
> @@ -2409,11 +2403,7 @@ static int read_partial_message(struct ceph_connection *con)
>  	}
>  
>  	/* footer */
> -	if (need_sign)
> -		size = sizeof(m->footer);
> -	else
> -		size = sizeof(m->old_footer);
> -
> +	size = sizeof_footer(con);
>  	end += size;
>  	ret = read_partial(con, end, size, &m->footer);
>  	if (ret <= 0)
> @@ -3089,10 +3079,7 @@ void ceph_msg_revoke(struct ceph_msg *msg)
>  			con->out_skip += con_out_kvec_skip(con);
>  		} else {
>  			BUG_ON(!msg->data_length);
> -			if (con->peer_features & CEPH_FEATURE_MSG_AUTH)
> -				con->out_skip += sizeof(msg->footer);
> -			else
> -				con->out_skip += sizeof(msg->old_footer);
> +			con->out_skip += sizeof_footer(con);
>  		}
>  		/* data, middle, front */
>  		if (msg->data_length)
> 


  reply	other threads:[~2016-02-21 17:56 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-20 16:45 [PATCH 0/4] libceph: message skipping fixes Ilya Dryomov
2016-02-20 16:45 ` [PATCH 1/4] libceph: don't bail early from try_read() when skipping a message Ilya Dryomov
2016-02-20 18:28   ` Alex Elder
2016-02-20 20:21     ` Ilya Dryomov
2016-02-20 20:38       ` Alex Elder
2016-02-20 16:45 ` [PATCH 2/4] libceph: use the right footer size " Ilya Dryomov
2016-02-20 18:44   ` Alex Elder
2016-02-20 20:05     ` Ilya Dryomov
2016-02-20 20:15       ` Alex Elder
2016-02-21 14:31       ` Ilya Dryomov
2016-02-21 14:35         ` [PATCH 4/4] libceph: use sizeof_footer() more Ilya Dryomov
2016-02-21 15:08           ` Alex Elder [this message]
2016-02-20 16:45 ` [PATCH 3/4] libceph: don't spam dmesg with stray reply warnings Ilya Dryomov
2016-02-20 18:46   ` Alex Elder
2016-02-20 16:45 ` [PATCH 4/4] libceph: use sizeof_footer() in ceph_msg_revoke() Ilya Dryomov
2016-02-20 18:47   ` Alex Elder
2016-02-20 19:51     ` Ilya Dryomov
2016-02-20 19:56   ` Alex Elder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56C9D304.6040600@ieee.org \
    --to=elder@ieee.org \
    --cc=ceph-devel@vger.kernel.org \
    --cc=idryomov@gmail.com \
    --cc=varada.kari@sandisk.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox