2017-09-26 07:16:18

by Corentin Labbe

[permalink] [raw]
Subject: [PATCH 0/3] nfs_common: misc patchs

Hello

The origin of this series is a build warning fix.
But reading the code show me two other possible patch.

Regards

Corentin Labbe (3):
nfs_common: fix build warning in grace.c
nfs_common: move locks_in_grace comment at the right place
nfs_common: convert int to bool

fs/nfs_common/grace.c | 24 ++++++++++++------------
include/linux/fs.h | 4 ++--
2 files changed, 14 insertions(+), 14 deletions(-)

--
2.13.5



2017-09-26 07:16:19

by Corentin Labbe

[permalink] [raw]
Subject: [PATCH 1/3] nfs_common: fix build warning in grace.c

This fix the following warning
fs/nfs_common/grace.c:66:1: warning: no previous prototype for function '__state_in_grace' [-Wmissing-prototypes]
by adding the missing static.

Signed-off-by: Corentin Labbe <[email protected]>
---
fs/nfs_common/grace.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/nfs_common/grace.c b/fs/nfs_common/grace.c
index 420d3a0ab258..519396967e79 100644
--- a/fs/nfs_common/grace.c
+++ b/fs/nfs_common/grace.c
@@ -62,7 +62,7 @@ EXPORT_SYMBOL_GPL(locks_end_grace);
* to answer ordinary lock requests, and when they should accept only
* lock reclaims.
*/
-int
+static int
__state_in_grace(struct net *net, bool open)
{
struct list_head *grace_list = net_generic(net, grace_net_id);
--
2.13.5


2017-09-26 07:16:21

by Corentin Labbe

[permalink] [raw]
Subject: [PATCH 3/3] nfs_common: convert int to bool

Since __state_in_grace return only true/false, make it return bool
instead of int.
Same change for the two user of it, locks_in_grace/opens_in_grace

Signed-off-by: Corentin Labbe <[email protected]>
---
fs/nfs_common/grace.c | 10 +++++-----
include/linux/fs.h | 4 ++--
2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/fs/nfs_common/grace.c b/fs/nfs_common/grace.c
index c030cd618b99..897b299db55e 100644
--- a/fs/nfs_common/grace.c
+++ b/fs/nfs_common/grace.c
@@ -55,7 +55,7 @@ locks_end_grace(struct lock_manager *lm)
}
EXPORT_SYMBOL_GPL(locks_end_grace);

-static int
+static bool
__state_in_grace(struct net *net, bool open)
{
struct list_head *grace_list = net_generic(net, grace_net_id);
@@ -78,15 +78,15 @@ __state_in_grace(struct net *net, bool open)
* to answer ordinary lock requests, and when they should accept only
* lock reclaims.
*/
-int locks_in_grace(struct net *net)
+bool locks_in_grace(struct net *net)
{
- return __state_in_grace(net, 0);
+ return __state_in_grace(net, false);
}
EXPORT_SYMBOL_GPL(locks_in_grace);

-int opens_in_grace(struct net *net)
+bool opens_in_grace(struct net *net)
{
- return __state_in_grace(net, 1);
+ return __state_in_grace(net, true);
}
EXPORT_SYMBOL_GPL(opens_in_grace);

diff --git a/include/linux/fs.h b/include/linux/fs.h
index 8a84a45ecbf9..df843e8c9b50 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -970,8 +970,8 @@ struct lock_manager {
struct net;
void locks_start_grace(struct net *, struct lock_manager *);
void locks_end_grace(struct lock_manager *);
-int locks_in_grace(struct net *);
-int opens_in_grace(struct net *);
+bool locks_in_grace(struct net *);
+bool opens_in_grace(struct net *);

/* that will die - we need it for nfs_lock_info */
#include <linux/nfs_fs_i.h>
--
2.13.5


2017-09-26 07:16:20

by Corentin Labbe

[permalink] [raw]
Subject: [PATCH 2/3] nfs_common: move locks_in_grace comment at the right place

Commit c87fb4a378f9 ("lockd: NLM grace period shouldn't block NFSv4 opens")
made the locks_in_grace() comment be in the wrong place.

This patch move this comment just at the right place.

Signed-off-by: Corentin Labbe <[email protected]>
---
fs/nfs_common/grace.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/fs/nfs_common/grace.c b/fs/nfs_common/grace.c
index 519396967e79..c030cd618b99 100644
--- a/fs/nfs_common/grace.c
+++ b/fs/nfs_common/grace.c
@@ -55,13 +55,6 @@ locks_end_grace(struct lock_manager *lm)
}
EXPORT_SYMBOL_GPL(locks_end_grace);

-/**
- * locks_in_grace
- *
- * Lock managers call this function to determine when it is OK for them
- * to answer ordinary lock requests, and when they should accept only
- * lock reclaims.
- */
static int
__state_in_grace(struct net *net, bool open)
{
@@ -78,6 +71,13 @@ __state_in_grace(struct net *net, bool open)
return false;
}

+/**
+ * locks_in_grace
+ *
+ * Lock managers call this function to determine when it is OK for them
+ * to answer ordinary lock requests, and when they should accept only
+ * lock reclaims.
+ */
int locks_in_grace(struct net *net)
{
return __state_in_grace(net, 0);
--
2.13.5


2017-09-26 11:15:11

by Jeff Layton

[permalink] [raw]
Subject: Re: [PATCH 0/3] nfs_common: misc patchs

On Tue, 2017-09-26 at 09:14 +0200, Corentin Labbe wrote:
> Hello
>
> The origin of this series is a build warning fix.
> But reading the code show me two other possible patch.
>
> Regards
>
> Corentin Labbe (3):
> nfs_common: fix build warning in grace.c
> nfs_common: move locks_in_grace comment at the right place
> nfs_common: convert int to bool
>
> fs/nfs_common/grace.c | 24 ++++++++++++------------
> include/linux/fs.h | 4 ++--
> 2 files changed, 14 insertions(+), 14 deletions(-)
>

Looks like a reasonable set of cleanups. Probably fine for v4.15?

Reviewed-by: Jeff Layton <[email protected]>

2017-09-26 13:25:53

by J. Bruce Fields

[permalink] [raw]
Subject: Re: [PATCH 0/3] nfs_common: misc patchs

On Tue, Sep 26, 2017 at 07:15:09AM -0400, Jeff Layton wrote:
> On Tue, 2017-09-26 at 09:14 +0200, Corentin Labbe wrote:
> > Hello
> >
> > The origin of this series is a build warning fix.
> > But reading the code show me two other possible patch.
> >
> > Regards
> >
> > Corentin Labbe (3):
> > nfs_common: fix build warning in grace.c
> > nfs_common: move locks_in_grace comment at the right place
> > nfs_common: convert int to bool
> >
> > fs/nfs_common/grace.c | 24 ++++++++++++------------
> > include/linux/fs.h | 4 ++--
> > 2 files changed, 14 insertions(+), 14 deletions(-)
> >
>
> Looks like a reasonable set of cleanups. Probably fine for v4.15?
>
> Reviewed-by: Jeff Layton <[email protected]>

Yep, applying, thanks.

--b.