@@ -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];
@@ -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;
@@ -479,8 +480,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));
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(-)