diff options
author | Qiaowei Ren <qiaowei.ren@intel.com> | 2018-09-11 10:54:20 +0800 |
---|---|---|
committer | Qiaowei Ren <qiaowei.ren@intel.com> | 2018-09-11 10:54:20 +0800 |
commit | d65e22d27ab305d38059046dae60d7a66ff4a4e0 (patch) | |
tree | d0bd06459534ef33d0b930f6c164c4501bd527d7 /src/ceph/0003-librbd-fix-bufferlist-point.patch | |
parent | 828acdd1d5c5c2aeef287aa69e473bf44fcbce70 (diff) |
ceph: shared persistent read-only rbd cache
This patch introduces introduces RBD shared persistent RO cache which
can provide client-side sharing cache for rbd clone/snapshot case.
Change-Id: Icad8063f4f10b1ab4ce31920e90d5affa7d0abdc
Signed-off-by: Qiaowei Ren <qiaowei.ren@intel.com>
Signed-off-by: Dehao Shang <dehao.shang@intel.com>
Signed-off-by: Tushar Gohad <tushar.gohad@intel.com>
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
Signed-off-by: Yuan Zhou <yuan.zhou@intel.com>
Diffstat (limited to 'src/ceph/0003-librbd-fix-bufferlist-point.patch')
-rw-r--r-- | src/ceph/0003-librbd-fix-bufferlist-point.patch | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/src/ceph/0003-librbd-fix-bufferlist-point.patch b/src/ceph/0003-librbd-fix-bufferlist-point.patch new file mode 100644 index 0000000..b0030ea --- /dev/null +++ b/src/ceph/0003-librbd-fix-bufferlist-point.patch @@ -0,0 +1,71 @@ +From 656b499b00fb237c83b8ccccc519a1577d981199 Mon Sep 17 00:00:00 2001 +From: Yuan Zhou <yuan.zhou@intel.com> +Date: Mon, 6 Aug 2018 15:38:35 +0800 +Subject: [PATCH 03/10] librbd: fix bufferlist point + +Signed-off-by: Yuan Zhou <yuan.zhou@intel.com> +--- + src/tools/rbd_cache/ObjectCacheStore.cc | 10 +++++----- + src/tools/rbd_cache/ObjectCacheStore.h | 2 +- + 2 files changed, 6 insertions(+), 6 deletions(-) + +diff --git a/src/tools/rbd_cache/ObjectCacheStore.cc b/src/tools/rbd_cache/ObjectCacheStore.cc +index 9572a1a..2a87469 100644 +--- a/src/tools/rbd_cache/ObjectCacheStore.cc ++++ b/src/tools/rbd_cache/ObjectCacheStore.cc +@@ -63,13 +63,13 @@ int ObjectCacheStore::do_promote(std::string pool_name, std::string object_name) + m_cache_table.emplace(cache_file_name, PROMOTING); + } + +- librados::bufferlist read_buf; ++ librados::bufferlist* read_buf = new librados::bufferlist(); + int object_size = 4096*1024; //TODO(): read config from image metadata + + //TODO(): async promote + ret = promote_object(ioctx, object_name, read_buf, object_size); + if (ret == -ENOENT) { +- read_buf.append(std::string(object_size, '0')); ++ read_buf->append(std::string(object_size, '0')); + ret = 0; + } + +@@ -81,7 +81,7 @@ int ObjectCacheStore::do_promote(std::string pool_name, std::string object_name) + // persistent to cache + librbd::cache::SyncFile cache_file(m_cct, cache_file_name); + cache_file.open(); +- ret = cache_file.write_object_to_file(read_buf, object_size); ++ ret = cache_file.write_object_to_file(*read_buf, object_size); + + assert(m_cache_table.find(cache_file_name) != m_cache_table.end()); + +@@ -132,12 +132,12 @@ int ObjectCacheStore::lock_cache(std::string vol_name) { + return 0; + } + +-int ObjectCacheStore::promote_object(librados::IoCtx* ioctx, std::string object_name, librados::bufferlist read_buf, uint64_t read_len) { ++int ObjectCacheStore::promote_object(librados::IoCtx* ioctx, std::string object_name, librados::bufferlist* read_buf, uint64_t read_len) { + int ret; + + librados::AioCompletion* read_completion = librados::Rados::aio_create_completion(); + +- ret = ioctx->aio_read(object_name, read_completion, &read_buf, read_len, 0); ++ ret = ioctx->aio_read(object_name, read_completion, read_buf, read_len, 0); + if(ret < 0) { + lderr(m_cct) << "fail to read from rados" << dendl; + return ret; +diff --git a/src/tools/rbd_cache/ObjectCacheStore.h b/src/tools/rbd_cache/ObjectCacheStore.h +index a81beea..db09efa 100644 +--- a/src/tools/rbd_cache/ObjectCacheStore.h ++++ b/src/tools/rbd_cache/ObjectCacheStore.h +@@ -45,7 +45,7 @@ class ObjectCacheStore + int do_promote(std::string pool_name, std::string object_name); + + int promote_object(librados::IoCtx*, std::string object_name, +- librados::bufferlist read_buf, ++ librados::bufferlist* read_buf, + uint64_t length); + + enum { +-- +2.7.4 + |