From: Josh Durgin <josh.durgin@inktank.com>
To: Alex Elder <elder@inktank.com>
Cc: "ceph-devel@vger.kernel.org" <ceph-devel@vger.kernel.org>
Subject: Re: [PATCH] libceph: be explicit in masking bottom 16 bits
Date: Wed, 03 Apr 2013 11:38:27 -0700 [thread overview]
Message-ID: <515C7723.6080700@inktank.com> (raw)
In-Reply-To: <51560237.2040000@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
On 03/29/2013 02:05 PM, Alex Elder wrote:
> In ceph_osdc_build_request() there is a call to cpu_to_le16() which
> provides a 64-bit value as its argument. Because of the implied
> byte swapping going on it looked pretty suspect to me.
>
> At the moment it turns out the behavior is well defined, but masking
> off those bottom bits explicitly eliminates this distraction, and is
> in fact more directly related to the purpose of the message header's
> data_off field.
>
> This resolves:
> http://tracker.ceph.com/issues/4125
>
> Signed-off-by: Alex Elder <elder@inktank.com>
> ---
> net/ceph/osd_client.c | 14 ++++++++++++--
> 1 file changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
> index 3b6657f..015bf9f 100644
> --- a/net/ceph/osd_client.c
> +++ b/net/ceph/osd_client.c
> @@ -419,8 +419,18 @@ void ceph_osdc_build_request(struct
> ceph_osd_request *req,
> p += 4;
>
> /* data */
> - if (flags & CEPH_OSD_FLAG_WRITE)
> - req->r_request->hdr.data_off = cpu_to_le16(off);
> + if (flags & CEPH_OSD_FLAG_WRITE) {
> + u16 data_off;
> +
> + /*
> + * The header "data_off" is a hint to the receiver
> + * allowing it to align received data into its
> + * buffers such that there's no need to re-copy
> + * it before writing it to disk (direct I/O).
> + */
> + data_off = (u16) (off & 0xffff);
> + req->r_request->hdr.data_off = cpu_to_le16(data_off);
> + }
> req->r_request->hdr.data_len = cpu_to_le32(data_len);
>
> BUG_ON(p > msg->front.iov_base + msg->front.iov_len);
>
prev parent reply other threads:[~2013-04-03 18:38 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-29 21:05 [PATCH] libceph: be explicit in masking bottom 16 bits Alex Elder
2013-04-03 18:38 ` 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=515C7723.6080700@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.