From: Josh Durgin Date: Tue, 20 Sep 2011 20:09:53 +0000 (-0700) Subject: librbd: use pre-existing helper methods for tmap operations X-Git-Tag: v0.37~154 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=74f07fbd56faa9e4d04fa4df37f305b39fe12487;p=ceph.git librbd: use pre-existing helper methods for tmap operations Signed-off-by: Josh Durgin --- diff --git a/src/librbd.cc b/src/librbd.cc index d982650e9c13..e6c7fcd826fc 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;