From: Zhiqiang Wang Date: Wed, 2 Sep 2015 03:20:12 +0000 (+0800) Subject: librbd: do write_full for whole object write X-Git-Tag: v9.1.0~97^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=7bfb7f9025a8ee0d2305f49bf0336d2424da5b5b;p=ceph.git librbd: do write_full for whole object write This is useful when ec is the base tier in the cache tiering setup. The write_full can be proxied from the cache tier to the base tier. So that we don't need to promote the object. Signed-off-by: Zhiqiang Wang Suggested-by: Nick Fisk --- diff --git a/src/librbd/AioRequest.cc b/src/librbd/AioRequest.cc index 0bfadc841b5a0..b6fc1f918a6a1 100644 --- a/src/librbd/AioRequest.cc +++ b/src/librbd/AioRequest.cc @@ -508,7 +508,11 @@ namespace librbd { void AioWrite::add_write_ops(librados::ObjectWriteOperation *wr) { if (m_ictx->enable_alloc_hint && !m_ictx->object_map.object_may_exist(m_object_no)) wr->set_alloc_hint(m_ictx->get_object_size(), m_ictx->get_object_size()); - wr->write(m_object_off, m_write_data); + if (m_object_off == 0 && m_object_len == m_ictx->get_object_size()) { + wr->write_full(m_write_data); + } else { + wr->write(m_object_off, m_write_data); + } wr->set_op_flags2(m_op_flags); }