diff options
author | Ilya Dryomov <idryomov@gmail.com> | 2016-04-27 12:32:56 -0400 |
---|---|---|
committer | Ilya Dryomov <idryomov@gmail.com> | 2016-05-25 18:36:21 -0400 |
commit | 711da55d36a6f1eddcd340969be7223110d2f6b0 (patch) | |
tree | f93225ad1cad76fc6da550f4853362e6a8012f2d /net | |
parent | 13d1ad16d05eebb4db977eb955716b9da2c19fbd (diff) |
libceph: change how osd_op_reply message size is calculated
For a message pool message, preallocate a page, just like we do for
osd_op. For a normal message, take ceph_object_id into account and
don't bother subtracting CEPH_OSD_SLAB_OPS ceph_osd_ops.
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/ceph/osd_client.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index d66dacc9d0d4..75e27bd3d372 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c | |||
@@ -19,7 +19,6 @@ | |||
19 | #include <linux/ceph/auth.h> | 19 | #include <linux/ceph/auth.h> |
20 | #include <linux/ceph/pagelist.h> | 20 | #include <linux/ceph/pagelist.h> |
21 | 21 | ||
22 | #define OSD_OP_FRONT_LEN 4096 | ||
23 | #define OSD_OPREPLY_FRONT_LEN 512 | 22 | #define OSD_OPREPLY_FRONT_LEN 512 |
24 | 23 | ||
25 | static struct kmem_cache *ceph_osd_request_cache; | 24 | static struct kmem_cache *ceph_osd_request_cache; |
@@ -440,11 +439,8 @@ int ceph_osdc_alloc_messages(struct ceph_osd_request *req, gfp_t gfp) | |||
440 | 439 | ||
441 | /* create reply message */ | 440 | /* create reply message */ |
442 | msg_size = OSD_OPREPLY_FRONT_LEN; | 441 | msg_size = OSD_OPREPLY_FRONT_LEN; |
443 | if (req->r_num_ops > CEPH_OSD_SLAB_OPS) { | 442 | msg_size += req->r_base_oid.name_len; |
444 | /* ceph_osd_op and rval */ | 443 | msg_size += req->r_num_ops * sizeof(struct ceph_osd_op); |
445 | msg_size += (req->r_num_ops - CEPH_OSD_SLAB_OPS) * | ||
446 | (sizeof(struct ceph_osd_op) + 4); | ||
447 | } | ||
448 | 444 | ||
449 | if (req->r_mempool) | 445 | if (req->r_mempool) |
450 | msg = ceph_msgpool_get(&osdc->msgpool_op_reply, 0); | 446 | msg = ceph_msgpool_get(&osdc->msgpool_op_reply, 0); |
@@ -2702,13 +2698,11 @@ int ceph_osdc_init(struct ceph_osd_client *osdc, struct ceph_client *client) | |||
2702 | goto out; | 2698 | goto out; |
2703 | 2699 | ||
2704 | err = ceph_msgpool_init(&osdc->msgpool_op, CEPH_MSG_OSD_OP, | 2700 | err = ceph_msgpool_init(&osdc->msgpool_op, CEPH_MSG_OSD_OP, |
2705 | OSD_OP_FRONT_LEN, 10, true, | 2701 | PAGE_SIZE, 10, true, "osd_op"); |
2706 | "osd_op"); | ||
2707 | if (err < 0) | 2702 | if (err < 0) |
2708 | goto out_mempool; | 2703 | goto out_mempool; |
2709 | err = ceph_msgpool_init(&osdc->msgpool_op_reply, CEPH_MSG_OSD_OPREPLY, | 2704 | err = ceph_msgpool_init(&osdc->msgpool_op_reply, CEPH_MSG_OSD_OPREPLY, |
2710 | OSD_OPREPLY_FRONT_LEN, 10, true, | 2705 | PAGE_SIZE, 10, true, "osd_op_reply"); |
2711 | "osd_op_reply"); | ||
2712 | if (err < 0) | 2706 | if (err < 0) |
2713 | goto out_msgpool; | 2707 | goto out_msgpool; |
2714 | 2708 | ||