summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIlya Dryomov <idryomov@gmail.com>2018-10-15 15:26:27 +0200
committerIlya Dryomov <idryomov@gmail.com>2018-10-22 10:28:22 +0200
commit39e58c3425b1816c84724e8a77f9f9daa0143263 (patch)
tree3e32e02e54a5a75fbcf990869bf6d1031c81a493
parent81c65213d73cc51f2f2e4326d602e107c07afb05 (diff)
downloadlinux-39e58c3425b1816c84724e8a77f9f9daa0143263.tar.bz2
libceph: introduce alloc_watch_request()
ceph_osdc_alloc_messages() call will be moved out of alloc_linger_request() in the next commit, which means that ceph_osdc_watch() will need to call ceph_osdc_alloc_messages() twice. Add a helper for that. Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
-rw-r--r--net/ceph/osd_client.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index 17d1d2a04a7a..a5fbb38086b6 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -4492,6 +4492,23 @@ alloc_linger_request(struct ceph_osd_linger_request *lreq)
return req;
}
+static struct ceph_osd_request *
+alloc_watch_request(struct ceph_osd_linger_request *lreq, u8 watch_opcode)
+{
+ struct ceph_osd_request *req;
+
+ req = alloc_linger_request(lreq);
+ if (!req)
+ return NULL;
+
+ /*
+ * Pass 0 for cookie because we don't know it yet, it will be
+ * filled in by linger_submit().
+ */
+ osd_req_op_watch_init(req, 0, 0, watch_opcode);
+ return req;
+}
+
/*
* Returns a handle, caller owns a ref.
*/
@@ -4521,25 +4538,18 @@ ceph_osdc_watch(struct ceph_osd_client *osdc,
lreq->t.flags = CEPH_OSD_FLAG_WRITE;
ktime_get_real_ts64(&lreq->mtime);
- lreq->reg_req = alloc_linger_request(lreq);
+ lreq->reg_req = alloc_watch_request(lreq, CEPH_OSD_WATCH_OP_WATCH);
if (!lreq->reg_req) {
ret = -ENOMEM;
goto err_put_lreq;
}
- lreq->ping_req = alloc_linger_request(lreq);
+ lreq->ping_req = alloc_watch_request(lreq, CEPH_OSD_WATCH_OP_PING);
if (!lreq->ping_req) {
ret = -ENOMEM;
goto err_put_lreq;
}
- /*
- * Pass 0 for cookie because we don't know it yet, it will be
- * filled in by linger_submit().
- */
- osd_req_op_watch_init(lreq->reg_req, 0, 0, CEPH_OSD_WATCH_OP_WATCH);
- osd_req_op_watch_init(lreq->ping_req, 0, 0, CEPH_OSD_WATCH_OP_PING);
-
linger_submit(lreq);
ret = linger_reg_commit_wait(lreq);
if (ret) {