From: Josh Durgin <josh.durgin@inktank.com>
To: Alex Elder <elder@inktank.com>
Cc: ceph-devel@vger.kernel.org
Subject: Re: [PATCH] libceph: simplify data length calculation
Date: Sat, 16 Feb 2013 16:46:58 -0800 [thread overview]
Message-ID: <51202882.3090807@inktank.com> (raw)
In-Reply-To: <511FBCF5.7090506@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
On 02/16/2013 09:08 AM, Alex Elder wrote:
> Simplify the way the data length recorded in a message header is
> calculated in ceph_osdc_build_request().
>
> Signed-off-by: Alex Elder <elder@inktank.com>
> ---
> net/ceph/osd_client.c | 12 ++++--------
> 1 file changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
> index bbd1575..b58748e 100644
> --- a/net/ceph/osd_client.c
> +++ b/net/ceph/osd_client.c
> @@ -335,7 +335,7 @@ void ceph_osdc_build_request(struct ceph_osd_request
> *req,
> void *p;
> size_t msg_size = sizeof(*head) + num_op*sizeof(*op);
> int flags = req->r_flags;
> - u64 data_len = 0;
> + u64 data_len;
> int i;
>
> WARN_ON((flags & (CEPH_OSD_FLAG_READ|CEPH_OSD_FLAG_WRITE)) == 0);
> @@ -363,8 +363,6 @@ void ceph_osdc_build_request(struct ceph_osd_request
> *req,
> while (num_op--)
> osd_req_encode_op(req, op++, src_op++);
>
> - data_len += req->r_trail.length;
> -
> if (snapc) {
> head->snap_seq = cpu_to_le64(snapc->seq);
> head->num_snaps = cpu_to_le32(snapc->num_snaps);
> @@ -374,14 +372,12 @@ void ceph_osdc_build_request(struct
> ceph_osd_request *req,
> }
> }
>
> + data_len = req->r_trail.length;
> if (flags & CEPH_OSD_FLAG_WRITE) {
> req->r_request->hdr.data_off = cpu_to_le16(off);
> - req->r_request->hdr.data_len = cpu_to_le32(len + data_len);
> - } else if (data_len) {
> - req->r_request->hdr.data_off = 0;
> - req->r_request->hdr.data_len = cpu_to_le32(data_len);
> + data_len += len;
> }
> -
> + req->r_request->hdr.data_len = cpu_to_le32(data_len);
> req->r_request->page_alignment = req->r_page_alignment;
>
> BUG_ON(p > msg->front.iov_base + msg->front.iov_len);
>
prev parent reply other threads:[~2013-02-17 0:47 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-16 17:08 [PATCH] libceph: simplify data length calculation Alex Elder
2013-02-17 0:46 ` Josh Durgin [this message]
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=51202882.3090807@inktank.com \
--to=josh.durgin@inktank.com \
--cc=ceph-devel@vger.kernel.org \
--cc=elder@inktank.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.