From patchwork Fri Sep 20 22:44:40 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yan, Zheng" X-Patchwork-Id: 2921831 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id BB5CC9F1F1 for ; Fri, 20 Sep 2013 22:45:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F355020497 for ; Fri, 20 Sep 2013 22:45:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1218B2049D for ; Fri, 20 Sep 2013 22:45:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753232Ab3ITWo7 (ORCPT ); Fri, 20 Sep 2013 18:44:59 -0400 Received: from mga02.intel.com ([134.134.136.20]:46406 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753045Ab3ITWo6 (ORCPT ); Fri, 20 Sep 2013 18:44:58 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP; 20 Sep 2013 15:44:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.90,948,1371106800"; d="scan'208";a="398863877" Received: from unknown (HELO zyan5-mobl.ccr.corp.intel.com) ([10.255.20.224]) by fmsmga001.fm.intel.com with ESMTP; 20 Sep 2013 15:44:56 -0700 From: "Yan, Zheng" To: ceph-devel@vger.kernel.org Cc: sage@inktank.com, "Yan, Zheng" Subject: [PATCH 3/3] ceph: drop unconnected inodes Date: Sat, 21 Sep 2013 06:44:40 +0800 Message-Id: <1379717080-15626-4-git-send-email-zheng.z.yan@intel.com> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1379717080-15626-1-git-send-email-zheng.z.yan@intel.com> References: <1379717080-15626-1-git-send-email-zheng.z.yan@intel.com> Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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: "Yan, Zheng" Positve dentry and corresponding inode are always accompanied in MDS reply. So no need to keep inode in the cache after dropping all its aliases. Signed-off-by: Yan, Zheng Reviewed-by: Sage Weil --- fs/ceph/inode.c | 10 ++++++++++ fs/ceph/super.c | 1 + fs/ceph/super.h | 1 + 3 files changed, 12 insertions(+) diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index 833a4d5..49d4de0 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c @@ -436,6 +436,16 @@ void ceph_destroy_inode(struct inode *inode) call_rcu(&inode->i_rcu, ceph_i_callback); } +int ceph_drop_inode(struct inode *inode) +{ + /* + * Positve dentry and corresponding inode are always accompanied + * in MDS reply. So no need to keep inode in the cache after + * dropping all its aliases. + */ + return 1; +} + /* * Helpers to fill in size, ctime, mtime, and atime. We have to be * careful because either the client or MDS may have more up to date diff --git a/fs/ceph/super.c b/fs/ceph/super.c index 6a0951e..e58bd4a 100644 --- a/fs/ceph/super.c +++ b/fs/ceph/super.c @@ -686,6 +686,7 @@ static const struct super_operations ceph_super_ops = { .alloc_inode = ceph_alloc_inode, .destroy_inode = ceph_destroy_inode, .write_inode = ceph_write_inode, + .drop_inode = ceph_drop_inode, .sync_fs = ceph_sync_fs, .put_super = ceph_put_super, .show_options = ceph_show_options, diff --git a/fs/ceph/super.h b/fs/ceph/super.h index 6014b0a..a538b51 100644 --- a/fs/ceph/super.h +++ b/fs/ceph/super.h @@ -691,6 +691,7 @@ extern const struct inode_operations ceph_file_iops; extern struct inode *ceph_alloc_inode(struct super_block *sb); extern void ceph_destroy_inode(struct inode *inode); +extern int ceph_drop_inode(struct inode *inode); extern struct inode *ceph_get_inode(struct super_block *sb, struct ceph_vino vino);