Return-Path: Received: from daytona.panasas.com ([67.152.220.89]:46830 "EHLO daytona.panasas.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752695Ab1EXPIh (ORCPT ); Tue, 24 May 2011 11:08:37 -0400 From: Boaz Harrosh To: Benny Halevy , Trond Myklebust , NFS list Subject: [PATCH 10/12] SQUASHME: pnfs-obj: objlayout wants to cache devices until unmount Date: Tue, 24 May 2011 18:08:05 +0300 Message-Id: <1306249685-23453-1-git-send-email-bharrosh@panasas.com> In-Reply-To: <4DDBC611.3050202@panasas.com> References: <4DDBC611.3050202@panasas.com> Sender: linux-nfs-owner@vger.kernel.org List-ID: Content-Type: text/plain MIME-Version: 1.0 Take an extra reference on a device insert. So devices keep around in the cache until nfs_client release. (This was the behavior 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 accesing did->ref directly TODO: nfs4_insert_deviceid_node should check if there are too many devices and start purging them. Say by 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 faacde2..8b05b16 100644 --- a/fs/nfs/objlayout/objio_osd.c +++ b/fs/nfs/objlayout/objio_osd.c @@ -104,6 +104,7 @@ _dev_list_add(const struct nfs_server *nfss, de = n; } + atomic_inc(&de->id_node.ref); return de; } -- 1.7.2.3