From patchwork Tue May 24 10:56:16 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boaz Harrosh X-Patchwork-Id: 811552 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.3) with ESMTP id p4OAuhk4022852 for ; Tue, 24 May 2011 10:56:43 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754015Ab1EXK4m (ORCPT ); Tue, 24 May 2011 06:56:42 -0400 Received: from daytona.panasas.com ([67.152.220.89]:36963 "EHLO daytona.panasas.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753840Ab1EXK4m (ORCPT ); Tue, 24 May 2011 06:56:42 -0400 Received: from fs2.bhalevy.com ([172.17.33.64]) by daytona.panasas.com with Microsoft SMTPSVC(6.0.3790.4675); Tue, 24 May 2011 06:56:41 -0400 Message-ID: <4DDB8ED0.9000506@panasas.com> Date: Tue, 24 May 2011 13:56:16 +0300 From: Boaz Harrosh User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110430 Remi/fc12 Thunderbird/3.1.10 MIME-Version: 1.0 To: Benny Halevy , Trond Myklebust , NFS list Subject: [PATCH 3/3] SQUASHME: pnfs-obj: objlayout wants to cache devices until unmount References: <4DDB8DD1.20101@panasas.com> In-Reply-To: <4DDB8DD1.20101@panasas.com> X-OriginalArrivalTime: 24 May 2011 10:56:41.0733 (UTC) FILETIME=[438A5350:01CC1A01] Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Tue, 24 May 2011 10:56:43 +0000 (UTC) Take an extra reference on a device insert. So devices keep around in the cache until nfs_client release. (This was the behaviour of the old cache) The extra reference will be removed in nfs4_deviceid_purge_client(). I tested this and it works perfectly. TODO: Define an nfs4_get_deviceid() Currently accessing did->ref directly TODO: nfs4_insert_deviceid_node should check if there are too many devices and start purging them. Say by longest time from last use. Signed-off-by: Boaz Harrosh --- fs/nfs/objlayout/objio_osd.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/fs/nfs/objlayout/objio_osd.c b/fs/nfs/objlayout/objio_osd.c index c09066f..47e8cb5 100644 --- a/fs/nfs/objlayout/objio_osd.c +++ b/fs/nfs/objlayout/objio_osd.c @@ -110,6 +110,7 @@ _dev_list_add(const struct nfs_server *nfss, de = n; } + atomic_inc(&de->id_node.ref); return de; }