From: "Yan, Zheng" <zyan@redhat.com>
To: ceph-devel@vger.kernel.org
Cc: idryomov@gmail.com, "Yan, Zheng" <zyan@redhat.com>
Subject: [PATCH V2 3/6] libceph: allow reserving operations in OSD request
Date: Tue, 19 Jan 2016 16:08:08 +0800 [thread overview]
Message-ID: <1453190891-40937-4-git-send-email-zyan@redhat.com> (raw)
In-Reply-To: <1453190891-40937-1-git-send-email-zyan@redhat.com>
This allows us to reserve some operations for furture use. we do
not need to use all reserved operations.
Signed-off-by: Yan, Zheng <zyan@redhat.com>
---
include/linux/ceph/osd_client.h | 1 +
net/ceph/osd_client.c | 7 +++++--
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/include/linux/ceph/osd_client.h b/include/linux/ceph/osd_client.h
index fda3a05..9802df1 100644
--- a/include/linux/ceph/osd_client.h
+++ b/include/linux/ceph/osd_client.h
@@ -139,6 +139,7 @@ struct ceph_osd_request {
u32 r_sent; /* >0 if r_request is sending/sent */
/* request osd ops array */
+ unsigned int r_max_ops;
unsigned int r_num_ops;
struct ceph_osd_req_op *r_ops;
struct ceph_osd_req_op r_inline_ops[CEPH_OSD_INITIAL_OP];
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index 3852006..9c0cf2e 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -385,7 +385,8 @@ struct ceph_osd_request *ceph_osdc_alloc_request(struct ceph_osd_client *osdc,
req->r_osdc = osdc;
req->r_mempool = use_mempool;
- req->r_num_ops = num_ops;
+ req->r_num_ops = 0;
+ req->r_max_ops = num_ops;
if (num_ops <= CEPH_OSD_INITIAL_OP) {
req->r_ops = req->r_inline_ops;
@@ -480,8 +481,10 @@ _osd_req_op_init(struct ceph_osd_request *osd_req, unsigned int which,
{
struct ceph_osd_req_op *op;
- BUG_ON(which >= osd_req->r_num_ops);
+ BUG_ON(which >= osd_req->r_max_ops);
BUG_ON(!osd_req_opcode_valid(opcode));
+ if (which >= osd_req->r_num_ops)
+ osd_req->r_num_ops = which + 1;
op = &osd_req->r_ops[which];
memset(op, 0, sizeof (*op));
--
2.5.0
next prev 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 ` Yan, Zheng [this message]
2016-01-19 8:08 ` [PATCH V2 4/6] libceph: add helper that extends numner of operations in OSD request Yan, Zheng
2016-01-19 8:08 ` [PATCH V2 5/6] libceph: add helper that duplicates last extent operation Yan, Zheng
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-4-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