@@ -711,6 +711,7 @@ OPTION(rbd_balance_snap_reads, OPT_BOOL, false)
OPTION(rbd_localize_snap_reads, OPT_BOOL, false)
OPTION(rbd_balance_parent_reads, OPT_BOOL, false)
OPTION(rbd_localize_parent_reads, OPT_BOOL, true)
+OPTION(rbd_clone_cor, OPT_BOOL, false)//copy-on-read option for rbd clones
/*
* The following options change the behavior for librbd's image creation methods that
@@ -59,6 +59,10 @@ namespace librbd {
ldout(m_ictx->cct, 20) << "should_complete " << this << " " << m_oid << " " << m_object_off << "~" << m_object_len
<< " r = " << r << dendl;
+ //get copy-on-read option and check image if read_only
+ bool COR = (m_ictx->cct->_conf->rbd_clone_cor) && (!m_ictx->read_only);
+ ldout(m_ictx->cct, 20) << "should_complete COR = " << COR << " read_only = " << m_ictx->read_only << dendl;
+
if (!m_tried_parent && r == -ENOENT) {
RWLock::RLocker l(m_ictx->snap_lock);
RWLock::RLocker l2(m_ictx->parent_lock);