From: Jason Dillaman Date: Tue, 14 Jul 2015 18:13:14 +0000 (-0400) Subject: librbd: add support for removing the journal from disk X-Git-Tag: v10.0.1~52^2~19 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d480ad76cee51fb3e031eb1847a667b858bc3d07;p=ceph.git librbd: add support for removing the journal from disk Signed-off-by: Jason Dillaman --- diff --git a/src/librbd/Journal.cc b/src/librbd/Journal.cc index e7ec7e37b438..0e5f00eba953 100644 --- a/src/librbd/Journal.cc +++ b/src/librbd/Journal.cc @@ -78,6 +78,25 @@ int Journal::remove(librados::IoCtx &io_ctx, const std::string &image_id) { CephContext *cct = reinterpret_cast(io_ctx.cct()); ldout(cct, 5) << __func__ << ": image=" << image_id << dendl; + // TODO configurable commit flush interval + ::journal::Journaler journaler(io_ctx, image_id, "", 5); + + C_SaferCond cond; + journaler.init(&cond); + + int r = cond.wait(); + if (r == -ENOENT) { + return 0; + } else if (r < 0) { + lderr(cct) << "failed to initialize journal: " << cpp_strerror(r) << dendl; + return r; + } + + r = journaler.remove(); + if (r < 0) { + lderr(cct) << "failed to remove journal: " << cpp_strerror(r) << dendl; + return r; + } return 0; }