aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph/msgpool.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ceph/msgpool.c')
-rw-r--r--fs/ceph/msgpool.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/fs/ceph/msgpool.c b/fs/ceph/msgpool.c
index 39d4d7ed82ce..7599b3382076 100644
--- a/fs/ceph/msgpool.c
+++ b/fs/ceph/msgpool.c
@@ -101,14 +101,28 @@ int ceph_msgpool_resv(struct ceph_msgpool *pool, int delta)
101 return ret; 101 return ret;
102} 102}
103 103
104struct ceph_msg *ceph_msgpool_get(struct ceph_msgpool *pool) 104struct ceph_msg *ceph_msgpool_get(struct ceph_msgpool *pool, int front_len)
105{ 105{
106 wait_queue_t wait; 106 wait_queue_t wait;
107 struct ceph_msg *msg; 107 struct ceph_msg *msg;
108 108
109 if (front_len && front_len > pool->front_len) {
110 pr_err("msgpool_get pool %p need front %d, pool size is %d\n",
111 pool, front_len, pool->front_len);
112 WARN_ON(1);
113
114 /* try to alloc a fresh message */
115 msg = ceph_msg_new(0, front_len, 0, 0, NULL);
116 if (!IS_ERR(msg))
117 return msg;
118 }
119
120 if (!front_len)
121 front_len = pool->front_len;
122
109 if (pool->blocking) { 123 if (pool->blocking) {
110 /* mempool_t behavior; first try to alloc */ 124 /* mempool_t behavior; first try to alloc */
111 msg = ceph_msg_new(0, pool->front_len, 0, 0, NULL); 125 msg = ceph_msg_new(0, front_len, 0, 0, NULL);
112 if (!IS_ERR(msg)) 126 if (!IS_ERR(msg))
113 return msg; 127 return msg;
114 } 128 }
@@ -133,7 +147,7 @@ struct ceph_msg *ceph_msgpool_get(struct ceph_msgpool *pool)
133 WARN_ON(1); 147 WARN_ON(1);
134 148
135 /* maybe we can allocate it now? */ 149 /* maybe we can allocate it now? */
136 msg = ceph_msg_new(0, pool->front_len, 0, 0, NULL); 150 msg = ceph_msg_new(0, front_len, 0, 0, NULL);
137 if (!IS_ERR(msg)) 151 if (!IS_ERR(msg))
138 return msg; 152 return msg;
139 153