* [PATCH 12/77] nfs: idr_destroy() no longer needs idr_remove_all() [not found] <1360179649-22465-1-git-send-email-tj@kernel.org> @ 2013-02-06 19:39 ` Tejun Heo 2013-02-06 19:40 ` [PATCH 77/77] nfs4client: convert to idr_alloc() Tejun Heo 1 sibling, 0 replies; 2+ messages in thread From: Tejun Heo @ 2013-02-06 19:39 UTC (permalink / raw) To: akpm; +Cc: linux-kernel, Tejun Heo, J. Bruce Fields, linux-nfs idr_destroy() can destroy idr by itself and idr_remove_all() is being deprecated. Drop reference to idr_remove_all(). Note that the code wasn't completely correct before because idr_remove() on all entries doesn't necessarily release all idr_layers which could lead to memory leak. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: "J. Bruce Fields" <bfields@fieldses.org> Cc: linux-nfs@vger.kernel.org --- fs/nfs/client.c | 1 - 1 file changed, 1 deletion(-) diff --git a/fs/nfs/client.c b/fs/nfs/client.c index 9f3c664..84d8eae 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c @@ -197,7 +197,6 @@ error_0: EXPORT_SYMBOL_GPL(nfs_alloc_client); #if IS_ENABLED(CONFIG_NFS_V4) -/* idr_remove_all is not needed as all id's are removed by nfs_put_client */ void nfs_cleanup_cb_ident_idr(struct net *net) { struct nfs_net *nn = net_generic(net, nfs_net_id); -- 1.8.1 ^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH 77/77] nfs4client: convert to idr_alloc() [not found] <1360179649-22465-1-git-send-email-tj@kernel.org> 2013-02-06 19:39 ` [PATCH 12/77] nfs: idr_destroy() no longer needs idr_remove_all() Tejun Heo @ 2013-02-06 19:40 ` Tejun Heo 1 sibling, 0 replies; 2+ messages in thread From: Tejun Heo @ 2013-02-06 19:40 UTC (permalink / raw) To: akpm; +Cc: linux-kernel, Tejun Heo, Trond Myklebust, linux-nfs Convert to the much saner new idr interface. Only compile tested. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Trond Myklebust <Trond.Myklebust@netapp.com> Cc: linux-nfs@vger.kernel.org --- fs/nfs/nfs4client.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c index 2e9779b..47d1008 100644 --- a/fs/nfs/nfs4client.c +++ b/fs/nfs/nfs4client.c @@ -29,15 +29,14 @@ static int nfs_get_cb_ident_idr(struct nfs_client *clp, int minorversion) if (clp->rpc_ops->version != 4 || minorversion != 0) return ret; -retry: - if (!idr_pre_get(&nn->cb_ident_idr, GFP_KERNEL)) - return -ENOMEM; + idr_preload(GFP_KERNEL); spin_lock(&nn->nfs_client_lock); - ret = idr_get_new(&nn->cb_ident_idr, clp, &clp->cl_cb_ident); + ret = idr_alloc(&nn->cb_ident_idr, clp, 0, 0, GFP_NOWAIT); + if (ret >= 0) + clp->cl_cb_ident = ret; spin_unlock(&nn->nfs_client_lock); - if (ret == -EAGAIN) - goto retry; - return ret; + idr_preload_end(); + return ret < 0 ? ret : 0; } #ifdef CONFIG_NFS_V4_1 -- 1.8.1 ^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-02-06 20:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1360179649-22465-1-git-send-email-tj@kernel.org>
2013-02-06 19:39 ` [PATCH 12/77] nfs: idr_destroy() no longer needs idr_remove_all() Tejun Heo
2013-02-06 19:40 ` [PATCH 77/77] nfs4client: convert to idr_alloc() Tejun Heo
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox