kfree(rbdc);
}
-/* Caller has to fill in snapc->seq and snapc->snaps[0..snap_count-1] */
-
-static struct ceph_snap_context *rbd_snap_context_create(u32 snap_count)
-{
- struct ceph_snap_context *snapc;
- size_t size;
-
- size = sizeof (struct ceph_snap_context);
- size += snap_count * sizeof (snapc->snaps[0]);
- snapc = kzalloc(size, GFP_KERNEL);
- if (!snapc)
- return NULL;
-
- atomic_set(&snapc->nref, 1);
- snapc->num_snaps = snap_count;
-
- return snapc;
-}
-
-static inline void rbd_snap_context_get(struct ceph_snap_context *snapc)
-{
- (void)ceph_get_snap_context(snapc);
-}
-
-static inline void rbd_snap_context_put(struct ceph_snap_context *snapc)
-{
- ceph_put_snap_context(snapc);
-}
-
/*
* Drop reference to ceph client node. If it's not referenced anymore, release
* it.
header->image_size = le64_to_cpu(ondisk->image_size);
- header->snapc = rbd_snap_context_create(snap_count);
+ header->snapc = ceph_create_snap_context(snap_count, GFP_KERNEL);
if (!header->snapc)
goto out_err;
header->snapc->seq = le64_to_cpu(ondisk->snap_seq);
if (write_request) {
down_read(&rbd_dev->header_rwsem);
- rbd_snap_context_get(rbd_dev->header.snapc);
+ ceph_get_snap_context(rbd_dev->header.snapc);
up_read(&rbd_dev->header_rwsem);
}
rbd_assert(img_request->obj_request_count == 0);
if (img_request_write_test(img_request))
- rbd_snap_context_put(img_request->snapc);
+ ceph_put_snap_context(img_request->snapc);
if (img_request_child_test(img_request))
rbd_obj_request_put(img_request->obj_request);
kfree(rbd_dev->header.snap_sizes);
kfree(rbd_dev->header.snap_names);
/* osd requests may still refer to snapc */
- rbd_snap_context_put(rbd_dev->header.snapc);
+ ceph_put_snap_context(rbd_dev->header.snapc);
if (hver)
*hver = h.obj_version;
goto out;
ret = 0;
- snapc = rbd_snap_context_create(snap_count);
+ snapc = ceph_create_snap_context(snap_count, GFP_KERNEL);
if (!snapc) {
ret = -ENOMEM;
goto out;
/* Free dynamic fields from the header, then zero it out */
header = &rbd_dev->header;
- rbd_snap_context_put(header->snapc);
+ ceph_put_snap_context(header->snapc);
kfree(header->snap_sizes);
kfree(header->snap_names);
kfree(header->object_prefix);