All of lore.kernel.org
 help / color / mirror / Atom feed
From: Min Chen <minchen@ubuntukylin.com>
To: josh.durgin@inktank.com
Cc: ceph-devel@vger.kernel.org
Subject: [PATCH 1/3] *v2* librbd: copy-on-read for clones, add an option for copy-on-read
Date: Tue, 13 May 2014 17:12:13 +0800	[thread overview]
Message-ID: <d96faf1bd10b6f714aba6851fd51f6707d7e85bd.1399970127.git.minchen@ubuntukylin.com> (raw)
In-Reply-To: <cover.1399970127.git.minchen@ubuntukylin.com>
In-Reply-To: <cover.1399970127.git.minchen@ubuntukylin.com>

Add an option rbd_clone_cor to enable copy-on-read

Signed-off-by: Min Chen <minchen@ubuntukylin.com>
Signed-off-by: Li Wang <liwang@ubuntukylin.com>
Signed-off-by: Yunchuan Wen Chen <yunchuanwen@ubuntukylin.com>
---
 src/common/config_opts.h |    1 +
 src/librbd/AioRequest.cc |    4 ++++
 2 files changed, 5 insertions(+)

diff --git a/src/common/config_opts.h b/src/common/config_opts.h
index a065a77..15438ce 100644
--- a/src/common/config_opts.h
+++ b/src/common/config_opts.h
@@ -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
diff --git a/src/librbd/AioRequest.cc b/src/librbd/AioRequest.cc
index 5cf9a11..4cc6b4e 100644
--- a/src/librbd/AioRequest.cc
+++ b/src/librbd/AioRequest.cc
@@ -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);
-- 
1.7.10.4


  reply	other threads:[~2014-05-13  9:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-13  9:12 [PATCH 0/3] librbd copy-on-read v2 Min Chen
2014-05-13  9:12 ` Min Chen [this message]
2014-05-13  9:12 ` [PATCH 2/3] *v2* librbd: copy-on-read for clones, read entire object from parent Min Chen
2014-05-13  9:12 ` [PATCH 3/3] *v2* librbd: copy-on-read for clones, write entire object into child asychronously Min Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d96faf1bd10b6f714aba6851fd51f6707d7e85bd.1399970127.git.minchen@ubuntukylin.com \
    --to=minchen@ubuntukylin.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=josh.durgin@inktank.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.