CEPH filesystem development
 help / color / mirror / Atom feed
From: "Yan, Zheng" <zyan@redhat.com>
To: ceph-devel@vger.kernel.org
Cc: idryomov@gmail.com, "Yan, Zheng" <zyan@redhat.com>
Subject: [PATCH V2 5/6] libceph: add helper that duplicates last extent operation
Date: Tue, 19 Jan 2016 16:08:10 +0800	[thread overview]
Message-ID: <1453190891-40937-6-git-send-email-zyan@redhat.com> (raw)
In-Reply-To: <1453190891-40937-1-git-send-email-zyan@redhat.com>

This helper duplicates last extent operation in OSD request, then
adjusts the new extent operation's offset and length. The helper
is for scatterd page writeback, which adds nonconsecutive dirty
pages to single OSD request.

Signed-off-by: Yan, Zheng <zyan@redhat.com>
---
 include/linux/ceph/osd_client.h |  2 ++
 net/ceph/osd_client.c           | 21 +++++++++++++++++++++
 2 files changed, 23 insertions(+)

diff --git a/include/linux/ceph/osd_client.h b/include/linux/ceph/osd_client.h
index 6430766..aa07591 100644
--- a/include/linux/ceph/osd_client.h
+++ b/include/linux/ceph/osd_client.h
@@ -267,6 +267,8 @@ extern void osd_req_op_extent_init(struct ceph_osd_request *osd_req,
 					u64 truncate_size, u32 truncate_seq);
 extern void osd_req_op_extent_update(struct ceph_osd_request *osd_req,
 					unsigned int which, u64 length);
+extern void osd_req_op_extent_dup_last(struct ceph_osd_request *osd_req,
+				       u64 offset_inc);
 
 extern struct ceph_osd_data *osd_req_op_extent_osd_data(
 					struct ceph_osd_request *osd_req,
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index c9df912..c0a5665 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -600,6 +600,27 @@ void osd_req_op_extent_update(struct ceph_osd_request *osd_req,
 }
 EXPORT_SYMBOL(osd_req_op_extent_update);
 
+void osd_req_op_extent_dup_last(struct ceph_osd_request *osd_req,
+				u64 offset_inc)
+{
+	struct ceph_osd_req_op *op, *prev_op;
+	int which;
+
+	BUG_ON(osd_req->r_num_ops == 0);
+	which = osd_req->r_num_ops;
+
+	prev_op = &osd_req->r_ops[which - 1];
+	op = _osd_req_op_init(osd_req, which, prev_op->op, prev_op->flags);
+	/* dup previous one */
+	op->payload_len = prev_op->payload_len;
+	op->extent = prev_op->extent;
+	/* adjust offset */
+	op->extent.offset += offset_inc;
+	op->extent.length -= offset_inc;
+	op->payload_len -= offset_inc;
+}
+EXPORT_SYMBOL(osd_req_op_extent_dup_last);
+
 void osd_req_op_cls_init(struct ceph_osd_request *osd_req, unsigned int which,
 			u16 opcode, const char *class, const char *method)
 {
-- 
2.5.0


  parent reply	other threads:[~2016-01-19  8:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-19  8:08 [PATCH V2 0/6] scattered page writeback Yan, Zheng
2016-01-19  8:08 ` [PATCH V2 1/6] libceph: enlarge max number of operations in OSD request Yan, Zheng
2016-01-19  8:08 ` [PATCH V2 2/6] libceph: move r_reply_op_{len,result} into struct ceph_osd_req_op Yan, Zheng
2016-01-19  8:08 ` [PATCH V2 3/6] libceph: allow reserving operations in OSD request Yan, Zheng
2016-01-19  8:08 ` [PATCH V2 4/6] libceph: add helper that extends numner of " Yan, Zheng
2016-01-19  8:08 ` Yan, Zheng [this message]
2016-01-19  8:08 ` [PATCH V2 6/6] ceph: scattered page writeback Yan, Zheng

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=1453190891-40937-6-git-send-email-zyan@redhat.com \
    --to=zyan@redhat.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=idryomov@gmail.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