libceph: kill op_needs_trail()
Since every osd message is now prepared to include trailing data, there's no need to check ahead of time whether any operations will make use of the trail portion of the message. We can drop the second argument to get_num_ops(), and as a result we can also get rid of op_needs_trail() which is no longer used. Signed-off-by: Alex Elder <elder@inktank.com> Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
This commit is contained in:
parent
c885837f7d
commit
5b9d1b1cd4
|
@ -32,20 +32,6 @@ static void __unregister_linger_request(struct ceph_osd_client *osdc,
|
||||||
static void __send_request(struct ceph_osd_client *osdc,
|
static void __send_request(struct ceph_osd_client *osdc,
|
||||||
struct ceph_osd_request *req);
|
struct ceph_osd_request *req);
|
||||||
|
|
||||||
static int op_needs_trail(int op)
|
|
||||||
{
|
|
||||||
switch (op) {
|
|
||||||
case CEPH_OSD_OP_GETXATTR:
|
|
||||||
case CEPH_OSD_OP_SETXATTR:
|
|
||||||
case CEPH_OSD_OP_CMPXATTR:
|
|
||||||
case CEPH_OSD_OP_CALL:
|
|
||||||
case CEPH_OSD_OP_NOTIFY:
|
|
||||||
return 1;
|
|
||||||
default:
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static int op_has_extent(int op)
|
static int op_has_extent(int op)
|
||||||
{
|
{
|
||||||
return (op == CEPH_OSD_OP_READ ||
|
return (op == CEPH_OSD_OP_READ ||
|
||||||
|
@ -179,17 +165,12 @@ void ceph_osdc_release_request(struct kref *kref)
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(ceph_osdc_release_request);
|
EXPORT_SYMBOL(ceph_osdc_release_request);
|
||||||
|
|
||||||
static int get_num_ops(struct ceph_osd_req_op *ops, int *needs_trail)
|
static int get_num_ops(struct ceph_osd_req_op *ops)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
if (needs_trail)
|
while (ops[i].op)
|
||||||
*needs_trail = 0;
|
|
||||||
while (ops[i].op) {
|
|
||||||
if (needs_trail && op_needs_trail(ops[i].op))
|
|
||||||
*needs_trail = 1;
|
|
||||||
i++;
|
i++;
|
||||||
}
|
|
||||||
|
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
@ -205,7 +186,7 @@ struct ceph_osd_request *ceph_osdc_alloc_request(struct ceph_osd_client *osdc,
|
||||||
{
|
{
|
||||||
struct ceph_osd_request *req;
|
struct ceph_osd_request *req;
|
||||||
struct ceph_msg *msg;
|
struct ceph_msg *msg;
|
||||||
int num_op = get_num_ops(ops, NULL);
|
int num_op = get_num_ops(ops);
|
||||||
size_t msg_size = sizeof(struct ceph_osd_request_head);
|
size_t msg_size = sizeof(struct ceph_osd_request_head);
|
||||||
|
|
||||||
msg_size += num_op*sizeof(struct ceph_osd_op);
|
msg_size += num_op*sizeof(struct ceph_osd_op);
|
||||||
|
@ -365,7 +346,7 @@ void ceph_osdc_build_request(struct ceph_osd_request *req,
|
||||||
struct ceph_osd_req_op *src_op;
|
struct ceph_osd_req_op *src_op;
|
||||||
struct ceph_osd_op *op;
|
struct ceph_osd_op *op;
|
||||||
void *p;
|
void *p;
|
||||||
int num_op = get_num_ops(src_ops, NULL);
|
int num_op = get_num_ops(src_ops);
|
||||||
size_t msg_size = sizeof(*head) + num_op*sizeof(*op);
|
size_t msg_size = sizeof(*head) + num_op*sizeof(*op);
|
||||||
int flags = req->r_flags;
|
int flags = req->r_flags;
|
||||||
u64 data_len = 0;
|
u64 data_len = 0;
|
||||||
|
|
Loading…
Reference in New Issue