From 74f07fbd56faa9e4d04fa4df37f305b39fe12487 Mon Sep 17 00:00:00 2001 From: Josh Durgin Date: Tue, 20 Sep 2011 13:09:53 -0700 Subject: [PATCH] librbd: use pre-existing helper methods for tmap operations Signed-off-by: Josh Durgin --- src/librbd.cc | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/src/librbd.cc b/src/librbd.cc index d982650e9c133..e6c7fcd826fcb 100644 --- a/src/librbd.cc +++ b/src/librbd.cc @@ -755,12 +755,7 @@ int create(IoCtx& io_ctx, const char *imgname, uint64_t size, int *order) bl.append((const char *)&header, sizeof(header)); ldout(cct, 2) << "adding rbd image to directory..." << dendl; - bufferlist cmdbl, emptybl; - __u8 c = CEPH_OSD_TMAP_SET; - ::encode(c, cmdbl); - ::encode(imgname, cmdbl); - ::encode(emptybl, cmdbl); - r = io_ctx.tmap_update(RBD_DIRECTORY, cmdbl); + r = tmap_set(io_ctx, imgname); if (r < 0) { lderr(cct) << "error adding img to directory: " << strerror(-r)<< dendl; return r; @@ -857,11 +852,7 @@ int remove(IoCtx& io_ctx, const char *imgname, ProgressContext& prog_ctx) } ldout(cct, 2) << "removing rbd image from directory..." << dendl; - bufferlist cmdbl; - __u8 c = CEPH_OSD_TMAP_RM; - ::encode(c, cmdbl); - ::encode(imgname, cmdbl); - r = io_ctx.tmap_update(RBD_DIRECTORY, cmdbl); + r = tmap_rm(io_ctx, imgname); if (r < 0) { lderr(cct) << "error removing img from directory: " << strerror(-r) << dendl; return r; -- 2.47.3