Commit 84127282 authored by Ilya Dryomov's avatar Ilya Dryomov

libceph: grab snapc in ceph_osdc_alloc_request()

ceph_osdc_build_request() is going away.  Grab snapc and initialize
->r_snapid in ceph_osdc_alloc_request().
Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
parent 3ed97d63
...@@ -391,6 +391,8 @@ struct ceph_osd_request *ceph_osdc_alloc_request(struct ceph_osd_client *osdc, ...@@ -391,6 +391,8 @@ struct ceph_osd_request *ceph_osdc_alloc_request(struct ceph_osd_client *osdc,
req->r_osdc = osdc; req->r_osdc = osdc;
req->r_mempool = use_mempool; req->r_mempool = use_mempool;
req->r_num_ops = num_ops; req->r_num_ops = num_ops;
req->r_snapid = CEPH_NOSNAP;
req->r_snapc = ceph_get_snap_context(snapc);
kref_init(&req->r_kref); kref_init(&req->r_kref);
init_completion(&req->r_completion); init_completion(&req->r_completion);
...@@ -2457,7 +2459,7 @@ void ceph_osdc_build_request(struct ceph_osd_request *req, u64 off, ...@@ -2457,7 +2459,7 @@ void ceph_osdc_build_request(struct ceph_osd_request *req, u64 off,
unsigned int i; unsigned int i;
req->r_snapid = snap_id; req->r_snapid = snap_id;
req->r_snapc = ceph_get_snap_context(snapc); WARN_ON(snapc != req->r_snapc);
/* encode request */ /* encode request */
msg->hdr.version = cpu_to_le16(4); msg->hdr.version = cpu_to_le16(4);
...@@ -2508,7 +2510,7 @@ void ceph_osdc_build_request(struct ceph_osd_request *req, u64 off, ...@@ -2508,7 +2510,7 @@ void ceph_osdc_build_request(struct ceph_osd_request *req, u64 off,
ceph_encode_64(&p, req->r_snapc ? req->r_snapc->seq : 0); ceph_encode_64(&p, req->r_snapc ? req->r_snapc->seq : 0);
ceph_encode_32(&p, req->r_snapc ? req->r_snapc->num_snaps : 0); ceph_encode_32(&p, req->r_snapc ? req->r_snapc->num_snaps : 0);
if (req->r_snapc) { if (req->r_snapc) {
for (i = 0; i < snapc->num_snaps; i++) { for (i = 0; i < req->r_snapc->num_snaps; i++) {
ceph_encode_64(&p, req->r_snapc->snaps[i]); ceph_encode_64(&p, req->r_snapc->snaps[i]);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment