aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/ceph/osd_client.c27
1 files changed, 4 insertions, 23 deletions
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index 2be50d82ccbc..37d43d5b828c 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -32,20 +32,6 @@ static void __unregister_linger_request(struct ceph_osd_client *osdc,
32static void __send_request(struct ceph_osd_client *osdc, 32static void __send_request(struct ceph_osd_client *osdc,
33 struct ceph_osd_request *req); 33 struct ceph_osd_request *req);
34 34
35static int op_needs_trail(int op)
36{
37 switch (op) {
38 case CEPH_OSD_OP_GETXATTR:
39 case CEPH_OSD_OP_SETXATTR:
40 case CEPH_OSD_OP_CMPXATTR:
41 case CEPH_OSD_OP_CALL:
42 case CEPH_OSD_OP_NOTIFY:
43 return 1;
44 default:
45 return 0;
46 }
47}
48
49static int op_has_extent(int op) 35static int op_has_extent(int op)
50{ 36{
51 return (op == CEPH_OSD_OP_READ || 37 return (op == CEPH_OSD_OP_READ ||
@@ -179,17 +165,12 @@ void ceph_osdc_release_request(struct kref *kref)
179} 165}
180EXPORT_SYMBOL(ceph_osdc_release_request); 166EXPORT_SYMBOL(ceph_osdc_release_request);
181 167
182static int get_num_ops(struct ceph_osd_req_op *ops, int *needs_trail) 168static int get_num_ops(struct ceph_osd_req_op *ops)
183{ 169{
184 int i = 0; 170 int i = 0;
185 171
186 if (needs_trail) 172 while (ops[i].op)
187 *needs_trail = 0;
188 while (ops[i].op) {
189 if (needs_trail && op_needs_trail(ops[i].op))
190 *needs_trail = 1;
191 i++; 173 i++;
192 }
193 174
194 return i; 175 return i;
195} 176}
@@ -205,7 +186,7 @@ struct ceph_osd_request *ceph_osdc_alloc_request(struct ceph_osd_client *osdc,
205{ 186{
206 struct ceph_osd_request *req; 187 struct ceph_osd_request *req;
207 struct ceph_msg *msg; 188 struct ceph_msg *msg;
208 int num_op = get_num_ops(ops, NULL); 189 int num_op = get_num_ops(ops);
209 size_t msg_size = sizeof(struct ceph_osd_request_head); 190 size_t msg_size = sizeof(struct ceph_osd_request_head);
210 191
211 msg_size += num_op*sizeof(struct ceph_osd_op); 192 msg_size += num_op*sizeof(struct ceph_osd_op);
@@ -365,7 +346,7 @@ void ceph_osdc_build_request(struct ceph_osd_request *req,
365 struct ceph_osd_req_op *src_op; 346 struct ceph_osd_req_op *src_op;
366 struct ceph_osd_op *op; 347 struct ceph_osd_op *op;
367 void *p; 348 void *p;
368 int num_op = get_num_ops(src_ops, NULL); 349 int num_op = get_num_ops(src_ops);
369 size_t msg_size = sizeof(*head) + num_op*sizeof(*op); 350 size_t msg_size = sizeof(*head) + num_op*sizeof(*op);
370 int flags = req->r_flags; 351 int flags = req->r_flags;
371 u64 data_len = 0; 352 u64 data_len = 0;