]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: use pre-existing helper methods for tmap operations
authorJosh Durgin <josh.durgin@dreamhost.com>
Tue, 20 Sep 2011 20:09:53 +0000 (13:09 -0700)
committerJosh Durgin <josh.durgin@dreamhost.com>
Tue, 27 Sep 2011 01:10:39 +0000 (18:10 -0700)
Signed-off-by: Josh Durgin <josh.durgin@dreamhost.com>
src/librbd.cc

index d982650e9c13369bfe8b922ecaadbd0d08f07e05..e6c7fcd826fcbed838992af6cd5fa60813790b0a 100644 (file)
@@ -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;