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


Groups > linux.kernel > #1227185 > unrolled thread

[PATCH] staging: lustre: lustre: lclient: Removed the else statement

Started byAnjali Menon <cse.anjalimenon@gmail.com>
First post2015-09-17 18:20 +0200
Last post2015-09-19 07:10 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] staging: lustre: lustre: lclient: Removed the else statement Anjali Menon <cse.anjalimenon@gmail.com> - 2015-09-17 18:20 +0200
    Re: [PATCH] staging: lustre: lustre: lclient: Removed the else statement Jaime Arrocha <jarr@innercoder.com> - 2015-09-17 19:00 +0200
    Re: [PATCH] staging: lustre: lustre: lclient: Removed the else  statement Greg KH <gregkh@linuxfoundation.org> - 2015-09-19 07:10 +0200

#1227185 — [PATCH] staging: lustre: lustre: lclient: Removed the else statement

FromAnjali Menon <cse.anjalimenon@gmail.com>
Date2015-09-17 18:20 +0200
Subject[PATCH] staging: lustre: lustre: lclient: Removed the else statement
Message-ID<q9K4G-np-21@gated-at.bofh.it>
Removed the else statement along with some unwanted brackets
to fix the following coding style warning detected by
checkpatch.

WARNING: else is not generally useful after a break or return

Signed-off-by: Anjali Menon <cse.anjalimenon@gmail.com>
---
 drivers/staging/lustre/lustre/lclient/lcommon_cl.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c
index ab6cb41..23092fc 100644
--- a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c
+++ b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c
@@ -836,7 +836,7 @@ int ccc_prep_size(const struct lu_env *env, struct cl_object *obj,
 					*exceed = 1;
 			}
 			return result;
-		} else {
+		}
 			/*
 			 * region is within kms and, hence, within real file
 			 * size (A). We need to increase i_size to cover the
@@ -847,14 +847,12 @@ int ccc_prep_size(const struct lu_env *env, struct cl_object *obj,
 			 * which will always be >= the kms value here.
 			 * b=11081
 			 */
-			if (cl_isize_read(inode) < kms) {
-				cl_isize_write_nolock(inode, kms);
-				CDEBUG(D_VFSTRACE,
-				       DFID" updating i_size %llu\n",
-				       PFID(lu_object_fid(&obj->co_lu)),
-				       (__u64)cl_isize_read(inode));
-
-			}
+		if (cl_isize_read(inode) < kms) {
+			cl_isize_write_nolock(inode, kms);
+			CDEBUG(D_VFSTRACE,
+				DFID" updating i_size %llu\n",
+				PFID(lu_object_fid(&obj->co_lu)),
+				(__u64)cl_isize_read(inode));
 		}
 	}
 	ccc_object_size_unlock(obj);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1227217

FromJaime Arrocha <jarr@innercoder.com>
Date2015-09-17 19:00 +0200
Message-ID<q9KHo-17A-21@gated-at.bofh.it>
In reply to#1227185
On 09/17/2015 11:14 AM, Anjali Menon wrote:
> Removed the else statement along with some unwanted brackets
> to fix the following coding style warning detected by
> checkpatch.
>
> WARNING: else is not generally useful after a break or return
>
> Signed-off-by: Anjali Menon <cse.anjalimenon@gmail.com>
> ---
>   drivers/staging/lustre/lustre/lclient/lcommon_cl.c | 16 +++++++---------
>   1 file changed, 7 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c
> index ab6cb41..23092fc 100644
> --- a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c
> +++ b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c
> @@ -836,7 +836,7 @@ int ccc_prep_size(const struct lu_env *env, struct cl_object *obj,
>   					*exceed = 1;
>   			}
>   			return result;
> -		} else {
> +		}
>   			/*
>   			 * region is within kms and, hence, within real file
>   			 * size (A). We need to increase i_size to cover the
> @@ -847,14 +847,12 @@ int ccc_prep_size(const struct lu_env *env, struct cl_object *obj,
>   			 * which will always be >= the kms value here.
>   			 * b=11081
>   			 */
> -			if (cl_isize_read(inode) < kms) {
> -				cl_isize_write_nolock(inode, kms);
> -				CDEBUG(D_VFSTRACE,
> -				       DFID" updating i_size %llu\n",
> -				       PFID(lu_object_fid(&obj->co_lu)),
> -				       (__u64)cl_isize_read(inode));
> -
> -			}
> +		if (cl_isize_read(inode) < kms) {
> +			cl_isize_write_nolock(inode, kms);
> +			CDEBUG(D_VFSTRACE,
> +				DFID" updating i_size %llu\n",
> +				PFID(lu_object_fid(&obj->co_lu)),
> +				(__u64)cl_isize_read(inode));
>   		}
>   	}
>   	ccc_object_size_unlock(obj);
I think the "else"  bracket is needed for when the statement "pos > kms" 
is not true, but it might work since there's only two choices tested. 
The checkpatch.pl error can bring notices like that, what's important is 
the context of the code.
It might be there to increase readability since it is kind of an obvious 
situation.
That's just my analysis.

-JA

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1228393 — Re: [PATCH] staging: lustre: lustre: lclient: Removed the else statement

FromGreg KH <gregkh@linuxfoundation.org>
Date2015-09-19 07:10 +0200
SubjectRe: [PATCH] staging: lustre: lustre: lclient: Removed the else statement
Message-ID<qaizo-8mG-3@gated-at.bofh.it>
In reply to#1227185
On Thu, Sep 17, 2015 at 09:44:41PM +0530, Anjali Menon wrote:
> Removed the else statement along with some unwanted brackets
> to fix the following coding style warning detected by
> checkpatch.
> 
> WARNING: else is not generally useful after a break or return
> 
> Signed-off-by: Anjali Menon <cse.anjalimenon@gmail.com>
> ---
>  drivers/staging/lustre/lustre/lclient/lcommon_cl.c | 16 +++++++---------
>  1 file changed, 7 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c
> index ab6cb41..23092fc 100644
> --- a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c
> +++ b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c
> @@ -836,7 +836,7 @@ int ccc_prep_size(const struct lu_env *env, struct cl_object *obj,
>  					*exceed = 1;
>  			}
>  			return result;
> -		} else {
> +		}
>  			/*
>  			 * region is within kms and, hence, within real file
>  			 * size (A). We need to increase i_size to cover the

This change isn't correct, look at how the code now looks :(

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web