linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/7] nfsd: remove unused get_new_stid()
       [not found] <1362513772-15174-1-git-send-email-tj@kernel.org>
@ 2013-03-05 20:02 ` Tejun Heo
  2013-03-05 20:05   ` J. Bruce Fields
  2013-03-05 20:02 ` [PATCH 2/7] nfsd: convert to idr_alloc() Tejun Heo
  1 sibling, 1 reply; 4+ messages in thread
From: Tejun Heo @ 2013-03-05 20:02 UTC (permalink / raw)
  To: akpm
  Cc: linux-kernel, bfields, jackm, ogerlitz, roland, dan.magenheimer,
	gregkh, vjaquez, rene.sapiens, x0095078, omar.ramirez, Tejun Heo,
	linux-nfs

get_new_stid() is no longer used since 3abdb607125 ("nfsd4: simplify
idr allocation").  Remove it.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: "J. Bruce Fields" <bfields@fieldses.org>
Cc: linux-nfs@vger.kernel.org
---
 fs/nfsd/nfs4state.c | 31 -------------------------------
 1 file changed, 31 deletions(-)

diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 16d39c6..d91d6db 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -230,37 +230,6 @@ static void nfs4_file_put_access(struct nfs4_file *fp, int oflag)
 		__nfs4_file_put_access(fp, oflag);
 }
 
-static inline int get_new_stid(struct nfs4_stid *stid)
-{
-	static int min_stateid = 0;
-	struct idr *stateids = &stid->sc_client->cl_stateids;
-	int new_stid;
-	int error;
-
-	error = idr_get_new_above(stateids, stid, min_stateid, &new_stid);
-	/*
-	 * Note: the necessary preallocation was done in
-	 * nfs4_alloc_stateid().  The idr code caps the number of
-	 * preallocations that can exist at a time, but the state lock
-	 * prevents anyone from using ours before we get here:
-	 */
-	WARN_ON_ONCE(error);
-	/*
-	 * It shouldn't be a problem to reuse an opaque stateid value.
-	 * I don't think it is for 4.1.  But with 4.0 I worry that, for
-	 * example, a stray write retransmission could be accepted by
-	 * the server when it should have been rejected.  Therefore,
-	 * adopt a trick from the sctp code to attempt to maximize the
-	 * amount of time until an id is reused, by ensuring they always
-	 * "increase" (mod INT_MAX):
-	 */
-
-	min_stateid = new_stid+1;
-	if (min_stateid == INT_MAX)
-		min_stateid = 0;
-	return new_stid;
-}
-
 static struct nfs4_stid *nfs4_alloc_stid(struct nfs4_client *cl, struct
 kmem_cache *slab)
 {
-- 
1.8.1.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/7] nfsd: convert to idr_alloc()
       [not found] <1362513772-15174-1-git-send-email-tj@kernel.org>
  2013-03-05 20:02 ` [PATCH 1/7] nfsd: remove unused get_new_stid() Tejun Heo
@ 2013-03-05 20:02 ` Tejun Heo
  2013-03-05 22:31   ` J. Bruce Fields
  1 sibling, 1 reply; 4+ messages in thread
From: Tejun Heo @ 2013-03-05 20:02 UTC (permalink / raw)
  To: akpm
  Cc: linux-kernel, bfields, jackm, ogerlitz, roland, dan.magenheimer,
	gregkh, vjaquez, rene.sapiens, x0095078, omar.ramirez, Tejun Heo,
	linux-nfs

idr_get_new*() and friends are about to be deprecated.  Convert to the
new idr_alloc() interface.

Only compile-tested.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: "J. Bruce Fields" <bfields@fieldses.org>
Cc: linux-nfs@vger.kernel.org
---
 fs/nfsd/nfs4state.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index d91d6db..2e27430 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -242,9 +242,8 @@ kmem_cache *slab)
 	if (!stid)
 		return NULL;
 
-	if (!idr_pre_get(stateids, GFP_KERNEL))
-		goto out_free;
-	if (idr_get_new_above(stateids, stid, min_stateid, &new_id))
+	new_id = idr_alloc(stateids, stid, min_stateid, 0, GFP_KERNEL);
+	if (new_id < 0)
 		goto out_free;
 	stid->sc_client = cl;
 	stid->sc_type = 0;
-- 
1.8.1.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/7] nfsd: remove unused get_new_stid()
  2013-03-05 20:02 ` [PATCH 1/7] nfsd: remove unused get_new_stid() Tejun Heo
@ 2013-03-05 20:05   ` J. Bruce Fields
  0 siblings, 0 replies; 4+ messages in thread
From: J. Bruce Fields @ 2013-03-05 20:05 UTC (permalink / raw)
  To: Tejun Heo
  Cc: akpm, linux-kernel, jackm, ogerlitz, roland, dan.magenheimer,
	gregkh, vjaquez, rene.sapiens, x0095078, omar.ramirez, linux-nfs

On Tue, Mar 05, 2013 at 12:02:46PM -0800, Tejun Heo wrote:
> get_new_stid() is no longer used since 3abdb607125 ("nfsd4: simplify
> idr allocation").  Remove it.

Whoops, thanks for catching that.

Acked-by: J. Bruce Fields <bfields@redhat.com>

> 
> Signed-off-by: Tejun Heo <tj@kernel.org>
> Cc: "J. Bruce Fields" <bfields@fieldses.org>
> Cc: linux-nfs@vger.kernel.org
> ---
>  fs/nfsd/nfs4state.c | 31 -------------------------------
>  1 file changed, 31 deletions(-)
> 
> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> index 16d39c6..d91d6db 100644
> --- a/fs/nfsd/nfs4state.c
> +++ b/fs/nfsd/nfs4state.c
> @@ -230,37 +230,6 @@ static void nfs4_file_put_access(struct nfs4_file *fp, int oflag)
>  		__nfs4_file_put_access(fp, oflag);
>  }
>  
> -static inline int get_new_stid(struct nfs4_stid *stid)
> -{
> -	static int min_stateid = 0;
> -	struct idr *stateids = &stid->sc_client->cl_stateids;
> -	int new_stid;
> -	int error;
> -
> -	error = idr_get_new_above(stateids, stid, min_stateid, &new_stid);
> -	/*
> -	 * Note: the necessary preallocation was done in
> -	 * nfs4_alloc_stateid().  The idr code caps the number of
> -	 * preallocations that can exist at a time, but the state lock
> -	 * prevents anyone from using ours before we get here:
> -	 */
> -	WARN_ON_ONCE(error);
> -	/*
> -	 * It shouldn't be a problem to reuse an opaque stateid value.
> -	 * I don't think it is for 4.1.  But with 4.0 I worry that, for
> -	 * example, a stray write retransmission could be accepted by
> -	 * the server when it should have been rejected.  Therefore,
> -	 * adopt a trick from the sctp code to attempt to maximize the
> -	 * amount of time until an id is reused, by ensuring they always
> -	 * "increase" (mod INT_MAX):
> -	 */
> -
> -	min_stateid = new_stid+1;
> -	if (min_stateid == INT_MAX)
> -		min_stateid = 0;
> -	return new_stid;
> -}
> -
>  static struct nfs4_stid *nfs4_alloc_stid(struct nfs4_client *cl, struct
>  kmem_cache *slab)
>  {
> -- 
> 1.8.1.4
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/7] nfsd: convert to idr_alloc()
  2013-03-05 20:02 ` [PATCH 2/7] nfsd: convert to idr_alloc() Tejun Heo
@ 2013-03-05 22:31   ` J. Bruce Fields
  0 siblings, 0 replies; 4+ messages in thread
From: J. Bruce Fields @ 2013-03-05 22:31 UTC (permalink / raw)
  To: Tejun Heo
  Cc: akpm, linux-kernel, jackm, ogerlitz, roland, dan.magenheimer,
	gregkh, vjaquez, rene.sapiens, x0095078, omar.ramirez, linux-nfs

On Tue, Mar 05, 2013 at 12:02:47PM -0800, Tejun Heo wrote:
> idr_get_new*() and friends are about to be deprecated.  Convert to the
> new idr_alloc() interface.
> 
> Only compile-tested.

Runs fine too--thanks.

Acked-by: J. Bruce Fields <bfields@redhat.com>

--b.

> 
> Signed-off-by: Tejun Heo <tj@kernel.org>
> Cc: "J. Bruce Fields" <bfields@fieldses.org>
> Cc: linux-nfs@vger.kernel.org
> ---
>  fs/nfsd/nfs4state.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> index d91d6db..2e27430 100644
> --- a/fs/nfsd/nfs4state.c
> +++ b/fs/nfsd/nfs4state.c
> @@ -242,9 +242,8 @@ kmem_cache *slab)
>  	if (!stid)
>  		return NULL;
>  
> -	if (!idr_pre_get(stateids, GFP_KERNEL))
> -		goto out_free;
> -	if (idr_get_new_above(stateids, stid, min_stateid, &new_id))
> +	new_id = idr_alloc(stateids, stid, min_stateid, 0, GFP_KERNEL);
> +	if (new_id < 0)
>  		goto out_free;
>  	stid->sc_client = cl;
>  	stid->sc_type = 0;
> -- 
> 1.8.1.4
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-03-05 22:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1362513772-15174-1-git-send-email-tj@kernel.org>
2013-03-05 20:02 ` [PATCH 1/7] nfsd: remove unused get_new_stid() Tejun Heo
2013-03-05 20:05   ` J. Bruce Fields
2013-03-05 20:02 ` [PATCH 2/7] nfsd: convert to idr_alloc() Tejun Heo
2013-03-05 22:31   ` J. Bruce Fields

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).