From patchwork Mon Feb 4 13:18:01 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 2091821 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 53FB63FD56 for ; Mon, 4 Feb 2013 13:18:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754853Ab3BDNSR (ORCPT ); Mon, 4 Feb 2013 08:18:17 -0500 Received: from mail-gg0-f171.google.com ([209.85.161.171]:41481 "EHLO mail-gg0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754819Ab3BDNSQ (ORCPT ); Mon, 4 Feb 2013 08:18:16 -0500 Received: by mail-gg0-f171.google.com with SMTP id j1so181024ggn.16 for ; Mon, 04 Feb 2013 05:18:16 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:sender:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state; bh=Hrl0RdjUEKInbQhwyrPVf9xhh1QlaWG4YESs3mNAfLs=; b=jkSD7nAQJ8zFUafBRHRPD+/t1dAWU5PCprkO22nxBE5QTPQOmFS6zg1k63bKcLeaG8 gcLXGN5HaPrvDqOUGQ4oA76kK9aZ9GvL7p2mOOXn19dgMrCVgQgrWDyIO7nWVEyyiFXn ZBb0TIGM/WLL/nGT+uivFtAYrzUj6Y6fJTWAprGsrHacOklqXKgTFroVIeIyq1h1KTdd EYluTPo+0lkNzThfzQNX1D8zOeaxT7QyXmGbZFlaaljyA7/7itVeMOsVlTfe/obe7hFm OZ+i3yVi7oAn0GwpefjkxQ+FBC8bep0kvkKbK+XMUDPlmXFuPYHHB9bHvxGTADiuzGDS lyrQ== X-Received: by 10.101.175.17 with SMTP id c17mr7258282anp.52.1359983896251; Mon, 04 Feb 2013 05:18:16 -0800 (PST) Received: from salusa.poochiereds.net (cpe-107-015-113-143.nc.res.rr.com. [107.15.113.143]) by mx.google.com with ESMTPS id d80sm980595yhg.4.2013.02.04.05.18.14 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 04 Feb 2013 05:18:15 -0800 (PST) From: Jeff Layton To: bfields@fieldses.org Cc: linux-nfs@vger.kernel.org Subject: [PATCH v2 2/8] nfsd: track the number of DRC entries in the cache Date: Mon, 4 Feb 2013 08:18:01 -0500 Message-Id: <1359983887-28535-3-git-send-email-jlayton@redhat.com> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1359983887-28535-1-git-send-email-jlayton@redhat.com> References: <1359983887-28535-1-git-send-email-jlayton@redhat.com> X-Gm-Message-State: ALoCoQlbT0sqvtkBnIsun4Um0ygIo6u+7ZfEg5ubOZoq2Wz6EcapGUHR8wCIIsD4vcpkfPhVlutV Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Signed-off-by: Jeff Layton --- fs/nfsd/nfscache.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/nfsd/nfscache.c b/fs/nfsd/nfscache.c index 9d80dfa..c0c5847 100644 --- a/fs/nfsd/nfscache.c +++ b/fs/nfsd/nfscache.c @@ -27,6 +27,7 @@ static struct hlist_head * cache_hash; static struct list_head lru_head; static int cache_disabled = 1; static struct kmem_cache *drc_slab; +static unsigned int num_drc_entries; /* * Calculate the hash index from an XID. @@ -68,6 +69,7 @@ nfsd_reply_cache_free_locked(struct svc_cacherep *rp) if (rp->c_type == RC_REPLBUFF) kfree(rp->c_replvec.iov_base); list_del(&rp->c_lru); + --num_drc_entries; kmem_cache_free(drc_slab, rp); } @@ -83,10 +85,12 @@ int nfsd_reply_cache_init(void) INIT_LIST_HEAD(&lru_head); i = CACHESIZE; + num_drc_entries = 0; while (i) { rp = nfsd_reply_cache_alloc(); if (!rp) goto out_nomem; + ++num_drc_entries; list_add(&rp->c_lru, &lru_head); i--; }