It will be needed for unit tests with a mocked ImageCtx.
Signed-off-by: Mykola Golub <mgolub@mirantis.com>
} else {
exclusive_lock_policy = new exclusive_lock::StandardPolicy(this);
}
- journal_policy = new journal::StandardPolicy(this);
+ journal_policy = new journal::StandardPolicy<ImageCtx>(this);
}
ImageCtx::~ImageCtx() {
namespace librbd {
namespace journal {
-void StandardPolicy::allocate_tag_on_lock(Context *on_finish) {
+template<typename I>
+void StandardPolicy<I>::allocate_tag_on_lock(Context *on_finish) {
assert(m_image_ctx->journal != nullptr);
if (!m_image_ctx->journal->is_tag_owner()) {
} // namespace journal
} // namespace librbd
+
+template class librbd::journal::StandardPolicy<librbd::ImageCtx>;
namespace journal {
+template<typename ImageCtxT = ImageCtx>
class StandardPolicy : public Policy {
public:
- StandardPolicy(ImageCtx *image_ctx) : m_image_ctx(image_ctx) {
+ StandardPolicy(ImageCtxT *image_ctx) : m_image_ctx(image_ctx) {
}
virtual bool append_disabled() const {
virtual void allocate_tag_on_lock(Context *on_finish);
private:
- ImageCtx *m_image_ctx;
+ ImageCtxT *m_image_ctx;
};
} // namespace journal
} // namespace librbd
+extern template class librbd::journal::StandardPolicy<librbd::ImageCtx>;
+
#endif // CEPH_LIBRBD_JOURNAL_STANDARD_POLICY_H