diff mbox

[1/2] ocfs2: remove useless if statement

Message ID 20150217071350.GA9568@devel.8.8.4.4 (mailing list archive)
State New, archived
Headers show

Commit Message

Daeseok Youn Feb. 17, 2015, 7:13 a.m. UTC
The Local variable "i" in for loop is always less then
O2CB_MAP_STABILIZE_COUNT.

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
---
 fs/ocfs2/stack_o2cb.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

Comments

Andrew Morton Feb. 17, 2015, 11:30 p.m. UTC | #1
On Tue, 17 Feb 2015 16:13:50 +0900 Daeseok Youn <daeseok.youn@gmail.com> wrote:

> The Local variable "i" in for loop is always less then
> O2CB_MAP_STABILIZE_COUNT.
> 
> Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
> ---
>  fs/ocfs2/stack_o2cb.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/ocfs2/stack_o2cb.c b/fs/ocfs2/stack_o2cb.c
> index 1724d43..813d726 100644
> --- a/fs/ocfs2/stack_o2cb.c
> +++ b/fs/ocfs2/stack_o2cb.c
> @@ -295,8 +295,8 @@ static int o2cb_cluster_check(void)
>  		set_bit(node_num, netmap);
>  		if (!memcmp(hbmap, netmap, sizeof(hbmap)))
>  			return 0;
> -		if (i < O2CB_MAP_STABILIZE_COUNT)
> -			msleep(1000);
> +
> +		msleep(1000);
>  	}

I assume the code was intended to do

	if (i < O2CB_MAP_STABILIZE_COUNT - 1)
		msleep(1000);

to avoid a pointless 1-second delay when the operation times out.
Daeseok Youn Feb. 19, 2015, 3:02 a.m. UTC | #2
Hi,

2015. 2. 18. ?? 8:30? "Andrew Morton" <akpm@linux-foundation.org>?? ??:
>
> On Tue, 17 Feb 2015 16:13:50 +0900 Daeseok Youn <daeseok.youn@gmail.com>
wrote:
>
> > The Local variable "i" in for loop is always less then
> > O2CB_MAP_STABILIZE_COUNT.
> >
> > Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
> > ---
> >  fs/ocfs2/stack_o2cb.c |    4 ++--
> >  1 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/fs/ocfs2/stack_o2cb.c b/fs/ocfs2/stack_o2cb.c
> > index 1724d43..813d726 100644
> > --- a/fs/ocfs2/stack_o2cb.c
> > +++ b/fs/ocfs2/stack_o2cb.c
> > @@ -295,8 +295,8 @@ static int o2cb_cluster_check(void)
> >               set_bit(node_num, netmap);
> >               if (!memcmp(hbmap, netmap, sizeof(hbmap)))
> >                       return 0;
> > -             if (i < O2CB_MAP_STABILIZE_COUNT)
> > -                     msleep(1000);
> > +
> > +             msleep(1000);
> >       }
>
> I assume the code was intended to do
>
>         if (i < O2CB_MAP_STABILIZE_COUNT - 1)
>                 msleep(1000);
>
> to avoid a pointless 1-second delay when the operation times out.

Ok. I will send this patch after makes it as your comment.

Thanks.
Regards,
Daeseok Youn
diff mbox

Patch

diff --git a/fs/ocfs2/stack_o2cb.c b/fs/ocfs2/stack_o2cb.c
index 1724d43..813d726 100644
--- a/fs/ocfs2/stack_o2cb.c
+++ b/fs/ocfs2/stack_o2cb.c
@@ -295,8 +295,8 @@  static int o2cb_cluster_check(void)
 		set_bit(node_num, netmap);
 		if (!memcmp(hbmap, netmap, sizeof(hbmap)))
 			return 0;
-		if (i < O2CB_MAP_STABILIZE_COUNT)
-			msleep(1000);
+
+		msleep(1000);
 	}
 
 	printk(KERN_ERR "o2cb: This node could not connect to nodes:");