From patchwork Mon May 25 03:32:16 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Wang X-Patchwork-Id: 6472491 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 18C9CC0020 for ; Mon, 25 May 2015 03:34:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 54E2A20465 for ; Mon, 25 May 2015 03:34:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7B73920462 for ; Mon, 25 May 2015 03:33:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751783AbbEYDdz (ORCPT ); Sun, 24 May 2015 23:33:55 -0400 Received: from m199-177.yeah.net ([123.58.177.199]:58207 "EHLO m199-177.yeah.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750783AbbEYDdz (ORCPT ); Sun, 24 May 2015 23:33:55 -0400 Received: from localhost.localdomain (unknown [113.240.220.93]) by m199-177.yeah.net (HMail) with ESMTPA id 14ED81100F58; Mon, 25 May 2015 11:33:38 +0800 (CST) From: Li Wang To: Sage Weil Cc: ceph-devel@vger.kernel.org, Min Chen Subject: [PATCH 1/2] Rados: cache-tierng support CEPH_OP_FLAG_TIER_NOCACHE Date: Mon, 25 May 2015 11:32:16 +0800 Message-Id: X-Mailer: git-send-email 1.9.1 In-Reply-To: References: In-Reply-To: References: X-HM-Spam-Status: e1koWUFPN1dZCBgUCR5ZQUlMVU5PQkJCQklITEtNS05PTFdZCQ4XHghZQV koKz0kKDQ9Lz06MjckMjUkMz46Pz4pQUtVS0A2IyQiPigkMjUkMz46Pz4pQUtVS0ArLykkNTQkMj UkMz46Pz4pQUlVS0A4NC41LykiJDg1QUtVS0ApPjwyNDUkOigyOkFLVUtAKyk0LTI1OD4kMy41Oj VBS1VLQD8iNTo2MjgkMiskNTQkMjUkMz46Pz4pQUtVS0ApPjo3JDIrJDI1JCk5NyQyNSQzPjo*Pi lBSklVS0A2LjcvMiQpOCsvJD8yPT0#KT41LyQyNSQzPjo*PilBSVVLQDIrJE4kNjI1Li8#JDg1Ly RLJEpLQUtVS0AyKyRISyQ2MjUuLz4kODUvJEskTktBS1VLQDIrJEokMzQuKSQ4NS8kSyRKS0tBS1 VLQDIrJEokNjI1Li8#JDg1LyRLJEpLQUtVS0AyKyQvND86IiQ4NS8kSyRKS0tBS1VLQCguOTE#OC 8kTiQ2MjUuLz4kODUvJEskSktBS1VLQCguOTE#OC8kLzQ*OiIkODUvJEskSktLQUtVS0AoLjkxPj gvJEokMzQuKSQ4NS8kSyRKS0tBS1VLQDU0LyQ9OjY0LigkPzQ2OjI1JCgrPSQ9OjI3QUpLVUtAKC 45JD5BSlVOTlkG X-HM-Sender-Digest: e1kSHx4VD1lBWUc6OCI6Tgw5Szo3DgEuHyEoFjw#Qw9PFEhVSlVKT0hJ TklPQ0pDSUJMVTMWGhIXVRcSDBoVHDsOGQ4VDw4QAhcSFVUYFBZFWVdZDB4ZWUEdGhcIHldZCAFZ QU9OSkk3V1kSC1lBWUpKSFVJT0tVSUlLVUJIWQY+ X-HM-Tid: 0a4d892206fe642714ed81100f58 Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Min Chen Signed-off-by: Min Chen Reviewed-by: Li Wang --- src/include/rados.h | 1 + src/include/rados/librados.h | 1 + src/include/rados/librados.hpp | 1 + src/librados/librados.cc | 2 ++ src/osd/ReplicatedPG.cc | 5 +++++ src/osd/osd_types.cc | 1 + 6 files changed, 11 insertions(+) diff --git a/src/include/rados.h b/src/include/rados.h index 424bef1..203e9ad 100644 --- a/src/include/rados.h +++ b/src/include/rados.h @@ -410,6 +410,7 @@ enum { pool uses pool snaps */ CEPH_OSD_FLAG_REDIRECTED = 0x200000, /* op has been redirected */ CEPH_OSD_FLAG_KNOWN_REDIR = 0x400000, /* redirect bit is authoritative */ + CEPH_OSD_FLAG_TIER_NOCACHE = 0x800000, /* DO NOT cache data in any cache-mode */ }; enum { diff --git a/src/include/rados/librados.h b/src/include/rados/librados.h index 8d8d11b..41c3b14 100644 --- a/src/include/rados/librados.h +++ b/src/include/rados/librados.h @@ -120,6 +120,7 @@ enum { LIBRADOS_OPERATION_IGNORE_CACHE = 8, LIBRADOS_OPERATION_SKIPRWLOCKS = 16, LIBRADOS_OPERATION_IGNORE_OVERLAY = 32, + LIBRADOS_OPERATION_TIER_NOCACHE = 64, }; /** @} */ diff --git a/src/include/rados/librados.hpp b/src/include/rados/librados.hpp index 6a0253d..3aeecc9 100644 --- a/src/include/rados/librados.hpp +++ b/src/include/rados/librados.hpp @@ -259,6 +259,7 @@ namespace librados OPERATION_IGNORE_CACHE = LIBRADOS_OPERATION_IGNORE_CACHE, OPERATION_SKIPRWLOCKS = LIBRADOS_OPERATION_SKIPRWLOCKS, OPERATION_IGNORE_OVERLAY = LIBRADOS_OPERATION_IGNORE_OVERLAY, + OPERATION_TIER_NOCACHE = LIBRADOS_OPERATION_TIER_NOCACHE, }; /* diff --git a/src/librados/librados.cc b/src/librados/librados.cc index a9eadfa..d5dd5fb 100644 --- a/src/librados/librados.cc +++ b/src/librados/librados.cc @@ -1290,6 +1290,8 @@ static int translate_flags(int flags) op_flags |= CEPH_OSD_FLAG_SKIPRWLOCKS; if (flags & librados::OPERATION_IGNORE_OVERLAY) op_flags |= CEPH_OSD_FLAG_IGNORE_OVERLAY; + if (flags & librados::OPERATION_TIER_NOCACHE) + op_flags |= CEPH_OSD_FLAG_TIER_NOCACHE; return op_flags; } diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 4c549a5..36a6269 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -1807,6 +1807,11 @@ bool ReplicatedPG::maybe_handle_cache(OpRequestRef op, MOSDOp *m = static_cast(op->get_req()); const object_locator_t& oloc = m->get_object_locator(); + if (m->has_flag(CEPH_OSD_FLAG_TIER_NOCACHE)) { + do_cache_redirect(op); + return true; + } + if (must_promote || op->need_promote()) { promote_object(obc, missing_oid, oloc, op); return true; diff --git a/src/osd/osd_types.cc b/src/osd/osd_types.cc index a73b46f..8caae62 100644 --- a/src/osd/osd_types.cc +++ b/src/osd/osd_types.cc @@ -50,6 +50,7 @@ const char *ceph_osd_flag_name(unsigned flag) case CEPH_OSD_FLAG_ENFORCE_SNAPC: return "enforce_snapc"; case CEPH_OSD_FLAG_REDIRECTED: return "redirected"; case CEPH_OSD_FLAG_KNOWN_REDIR: return "known_if_redirected"; + case CEPH_OSD_FLAG_TIER_NOCACHE: return "tier_nocache"; default: return "???"; } }