aboutsummaryrefslogtreecommitdiff
path: root/net/ceph
diff options
context:
space:
mode:
authorAlex Elder2013-02-14 12:16:43 -0600
committerAlex Elder2013-02-19 19:14:02 -0600
commitf44246e394eadf0754bd6716f8ba1fabf362a87d (patch)
tree2c76c5e1558f0dd8070bad387af29b499ffdc8ea /net/ceph
parent0eb40bf65e2fcc1c23ed7c9a10cd0890ee59e68f (diff)
libceph: simplify data length calculation
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> Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Diffstat (limited to 'net/ceph')
-rw-r--r--net/ceph/osd_client.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index bbd157592c6c..b58748ec405d 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);