Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1631667 > unrolled thread

[PATCH V2 linux-next] nfs: kmap can't fail

Started byFabian Frederick <fabf@skynet.be>
First post2017-04-26 20:50 +0200
Last post2017-04-26 21:10 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH V2 linux-next] nfs: kmap can't fail Fabian Frederick <fabf@skynet.be> - 2017-04-26 20:50 +0200
    Re: [PATCH V2 linux-next] nfs: kmap can't fail Trond Myklebust <trondmy@primarydata.com> - 2017-04-26 21:10 +0200

#1631667 — [PATCH V2 linux-next] nfs: kmap can't fail

FromFabian Frederick <fabf@skynet.be>
Date2017-04-26 20:50 +0200
Subject[PATCH V2 linux-next] nfs: kmap can't fail
Message-ID<tAAaJ-64N-9@gated-at.bofh.it>
Remove NULL test on kmap()

Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
V2: Remove ptr and return kmap(page) directly
(Suggested by Anna Schumaker)

 fs/nfs/dir.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index 3a188cb..12ed806b 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -175,13 +175,9 @@ typedef struct {
 static
 struct nfs_cache_array *nfs_readdir_get_array(struct page *page)
 {
-	void *ptr;
 	if (page == NULL)
 		return ERR_PTR(-EIO);
-	ptr = kmap(page);
-	if (ptr == NULL)
-		return ERR_PTR(-ENOMEM);
-	return ptr;
+	return kmap(page);
 }
 
 static
-- 
2.9.3

[toc] | [next] | [standalone]


#1631672

FromTrond Myklebust <trondmy@primarydata.com>
Date2017-04-26 21:10 +0200
Message-ID<tAAu5-6qw-11@gated-at.bofh.it>
In reply to#1631667
On Wed, 2017-04-26 at 20:45 +0200, Fabian Frederick wrote:
> Remove NULL test on kmap()
> 
> Signed-off-by: Fabian Frederick <fabf@skynet.be>
> ---
> V2: Remove ptr and return kmap(page) directly
> (Suggested by Anna Schumaker)
> 
>  fs/nfs/dir.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
> index 3a188cb..12ed806b 100644
> --- a/fs/nfs/dir.c
> +++ b/fs/nfs/dir.c
> @@ -175,13 +175,9 @@ typedef struct {
>  static
>  struct nfs_cache_array *nfs_readdir_get_array(struct page *page)
>  {
> -	void *ptr;
>  	if (page == NULL)
>  		return ERR_PTR(-EIO);
> -	ptr = kmap(page);
> -	if (ptr == NULL)
> -		return ERR_PTR(-ENOMEM);
> -	return ptr;
> +	return kmap(page);
>  }
>  
>  static

There seems little value in having a wrapper to kmap... Can we perhaps
instead just get rid of both nfs_readdir_get_array and
nfs_readdir_release_array?

-- 
Trond Myklebust
Linux NFS client maintainer, PrimaryData
trond.myklebust@primarydata.com

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web