]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: copy-on-read for clones, add an option for copy-on-read
authorMin Chen <minchen@ubuntukylin.com>
Fri, 25 Jul 2014 02:12:33 +0000 (10:12 +0800)
committerJason Dillaman <dillaman@redhat.com>
Tue, 20 Jan 2015 15:11:39 +0000 (10:11 -0500)
Signed-off-by: Min Chen <minchen@ubuntukylin.com>
Signed-off-by: Li Wang <liwang@ubuntukylin.com>
Signed-off-by: Yunchuan Wen <yunchuanwen@ubuntukylin.com>
src/common/config_opts.h
src/librbd/AioRequest.cc

index 937aee6a75ec1bb5efbbfe24dd686933af73f6c0..622e9f4bd7c22f3cc0f8f8554c50c4ee0c7b5aa7 100644 (file)
@@ -850,6 +850,7 @@ OPTION(rbd_localize_parent_reads, OPT_BOOL, true)
 OPTION(rbd_readahead_trigger_requests, OPT_INT, 10) // number of sequential requests necessary to trigger readahead
 OPTION(rbd_readahead_max_bytes, OPT_LONGLONG, 512 * 1024) // set to 0 to disable readahead
 OPTION(rbd_readahead_disable_after_bytes, OPT_LONGLONG, 50 * 1024 * 1024) // how many bytes are read in total before readahead is disabled
+OPTION(rbd_clone_copy_on_read, OPT_BOOL, false)//copy-on-read option for rbd clones
 
 /*
  * The following options change the behavior for librbd's image creation methods that
index ab54a65810ba295821534540cc1694f782efec34..b42056e4fb1d678fffefb9339d5ceeabdeb04cea 100644 (file)
@@ -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_copy_on_read) && (!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);