Skip to contentSkip to conversation

staging: lustre: lclient: fixing coding style issues

PATCH Superseded Anil Belur 2 participants 10 messages Jun 16, 2014 Staging

v4 of 7 Superseded Latest is v7 →

lore
Share & tools
lore

Anil Belur

author
#0 lore raw

PATCH v4 1/1 staging: lustre: lclient: fixing coding style issues

Resending patches as per changes recommend by "[email protected]" for 1/8 and 7/8. PATCH 1/8: Now have removed the '+' to make the code more straight forward.
The patch v3 7/7 is now split into two separate patches as both are related diff warning or error.

author
#1 lore raw

PATCH v4 1/8 staging: lustre: lclient: glimpse.c fixing coding style issues

From: Anil Belur <[email protected]>

Fixed "ERROR: need consistent spacing around '+' (ctx:WxV)"

---
 drivers/staging/lustre/lustre/lclient/glimpse.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/lustre/lustre/lclient/glimpse.c +1 -1
index 7bbca4b..f669645 100644
@@ -177,7 +177,7 @@ static int cl_io_get(struct inode *inode, struct lu_env **envout,
 			io->ci_obj = clob;
 			*envout = env;
 			*ioout  = io;
-			result = +1;
+			result = 1;
 		} else
 			result = PTR_ERR(env);
 	} else
Signature · 1 line
1.9.0
author
#2 lore raw

PATCH v4 2/8 staging: lustre: lclient: glimpse.c fixing coding style issues

In reply to Anil Belur

From: Anil Belur <[email protected]>

fixed "WARNING: labels should not be indented"

---
 drivers/staging/lustre/lustre/lclient/glimpse.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/lustre/lustre/lclient/glimpse.c +1 -1
index f669645..a658116 100644
@@ -204,7 +204,7 @@ int cl_glimpse_size0(struct inode *inode, int agl)
 
 	result = cl_io_get(inode, &env, &io, &refcheck);
 	if (result > 0) {
-	again:
+again:
 		io->ci_verify_layout = 1;
 		result = cl_io_init(env, io, CIT_MISC, io->ci_obj);
 		if (result > 0)
Signature · 1 line
1.9.0
author
#3 lore raw

PATCH v4 3/8 staging: lustre: lclient: lcommon_misc.c fixing coding style issues

In reply to Anil Belur

From: Anil Belur <[email protected]>

fixed warning:
* WARNING: min() should probably be min_t(__u32, desc.ld_tgt_count, LOV_MAX_STRIPE_COUNT)

---
 drivers/staging/lustre/lustre/lclient/lcommon_misc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/lustre/lustre/lclient/lcommon_misc.c +1 -1
index e04c2d3..01ce5c1 100644
@@ -63,7 +63,7 @@ int cl_init_ea_size(struct obd_export *md_exp, struct obd_export *dt_exp)
 	if (rc)
 		return rc;
 
-	stripes = min(desc.ld_tgt_count, (__u32)LOV_MAX_STRIPE_COUNT);
+	stripes = min_t(__u32, desc.ld_tgt_count, (__u32)LOV_MAX_STRIPE_COUNT);
 	lsm.lsm_stripe_count = stripes;
 	easize = obd_size_diskmd(dt_exp, &lsm);
 
Signature · 1 line
1.9.0
author
#4 lore raw

PATCH v4 4/8 staging: lustre: lclient: lcommon_cl.c fixing coding style issues

In reply to Anil Belur

From: Anil Belur <[email protected]>

fixed: WARNING: Missing a blank line after declarations

---
 drivers/staging/lustre/lustre/lclient/lcommon_cl.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/staging/lustre/lustre/lclient/lcommon_cl.c +4 -0
index 6907a16..f83e6f2 100644
@@ -127,6 +127,7 @@ void ccc_key_fini(const struct lu_context *ctx,
 			 struct lu_context_key *key, void *data)
 {
 	struct ccc_thread_info *info = data;
+
 	OBD_SLAB_FREE_PTR(info, ccc_thread_kmem);
 }
 
@@ -145,6 +146,7 @@ void ccc_session_key_fini(const struct lu_context *ctx,
 				 struct lu_context_key *key, void *data)
 {
 	struct ccc_session *session = data;
+
 	OBD_SLAB_FREE_PTR(session, ccc_session_kmem);
 }
 
@@ -573,6 +575,7 @@ void ccc_lock_delete(const struct lu_env *env,
 void ccc_lock_fini(const struct lu_env *env, struct cl_lock_slice *slice)
 {
 	struct ccc_lock *clk = cl2ccc_lock(slice);
+
 	OBD_SLAB_FREE_PTR(clk, ccc_lock_kmem);
 }
 
@@ -753,6 +756,7 @@ int ccc_io_one_lock(const struct lu_env *env, struct cl_io *io,
 		    loff_t start, loff_t end)
 {
 	struct cl_object *obj = io->ci_obj;
+
 	return ccc_io_one_lock_index(env, io, enqflags, mode,
 				     cl_index(obj, start), cl_index(obj, end));
 }
Signature · 1 line
1.9.0
author
#5 lore raw

PATCH v4 5/8 staging: lustre: lclient: lcommon_cl.c fixing coding style issues

In reply to Anil Belur

From: Anil Belur <[email protected]>

fixed: ERROR: do not initialise statics to 0 or NULL

---
 drivers/staging/lustre/lustre/lclient/lcommon_cl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/lustre/lustre/lclient/lcommon_cl.c +1 -1
index f83e6f2..7be0a93 100644
@@ -267,7 +267,7 @@ int ccc_req_init(const struct lu_env *env, struct cl_device *dev,
  * fails. Access to this environment is serialized by ccc_inode_fini_guard
  * mutex.
  */
-static struct lu_env *ccc_inode_fini_env = NULL;
+static struct lu_env *ccc_inode_fini_env;
 
 /**
  * A mutex serializing calls to slp_inode_fini() under extreme memory
Signature · 1 line
1.9.0
author
#6 lore raw

PATCH v4 6/8 staging: lustre: lclient: lcommon_cl.c fixing coding style issues

In reply to Anil Belur

From: Anil Belur <[email protected]>

fixed: ERROR: inline keyword should sit between storage class and type

---
 drivers/staging/lustre/lustre/lclient/lcommon_cl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/lustre/lustre/lclient/lcommon_cl.c +1 -1
index 7be0a93..c180a20 100644
@@ -1316,7 +1316,7 @@ struct lov_stripe_md *ccc_inode_lsm_get(struct inode *inode)
 	return lov_lsm_get(cl_i2info(inode)->lli_clob);
 }
 
-void inline ccc_inode_lsm_put(struct inode *inode, struct lov_stripe_md *lsm)
+inline void ccc_inode_lsm_put(struct inode *inode, struct lov_stripe_md *lsm)
 {
 	lov_lsm_put(cl_i2info(inode)->lli_clob, lsm);
 }
Signature · 1 line
1.9.0
author
#7 lore raw

PATCH v4 7/8 staging: lustre: lclient: lcommon_cl.c fixing coding style issues

In reply to Anil Belur

From: Anil Belur <[email protected]>

fixed: WARNING: line over 80 characters, used a new variable 'check' to store the offset. Replace "unsigned long" with "u64" type fir 'cur_index'

---
 drivers/staging/lustre/lustre/lclient/lcommon_cl.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/staging/lustre/lustre/lclient/lcommon_cl.c +3 -2
index c180a20..440d7c2 100644
@@ -864,10 +864,11 @@ int ccc_prep_size(const struct lu_env *env, struct cl_object *obj,
 				 * linux-2.6.18-128.1.1 miss to do that.
 				 * --bug 17336 */
 				loff_t size = cl_isize_read(inode);
-				unsigned long cur_index = start >> PAGE_CACHE_SHIFT;
+				u64 cur_index = start >> PAGE_CACHE_SHIFT;
+				loff_t check = ((size - 1) >> PAGE_CACHE_SHIFT);
 
 				if ((size == 0 && cur_index != 0) ||
-				    (((size - 1) >> PAGE_CACHE_SHIFT) < cur_index))
+				    (check < cur_index))
 				*exceed = 1;
 			}
 			return result;
Signature · 1 line
1.9.0
#8 lore raw

Re: [PATCH v4 7/8] staging: lustre: lclient: lcommon_cl.c fixing coding style issues

Quoted 16 lines · Anil Belur

From: Anil Belur <[email protected]>

fixed: WARNING: line over 80 characters, used a new variable 'check' to store the offset. Replace "unsigned long" with "u64" type fir 'cur_index'

---
drivers/staging/lustre/lustre/lclient/lcommon_cl.c | 5 +++--

1 file changed, 3 insertions(+), 2 deletions(-)
drivers/staging/lustre/lustre/lclient/lcommon_cl.c +0 -0
index c180a20..440d7c2 100644

drivers/staging/lustre/lustre/lclient/lcommon_cl.c int ccc_prep_size(const struct lu_env *env, struct cl_object *obj, · line 867

Quoted 5 lines
drivers/staging/lustre/lustre/lclient/lcommon_cl.c +1 -1
@@ -864,10 +864,11 @@ int ccc_prep_size(const struct lu_env *env, struct cl_object *obj,
 				 * linux-2.6.18-128.1.1 miss to do that.
 				 * --bug 17336 */
 				loff_t size = cl_isize_read(inode);
-				unsigned long cur_index = start >> PAGE_CACHE_SHIFT;
+				u64 cur_index = start >> PAGE_CACHE_SHIFT;

Well, size is of type loff_t, so I imagine it's most natural to make cur_index to be loff_t too, just like what you do with the newly added check (not very great name, btw, size_index?) variable

Bye,
Oleg

author
#9 lore raw

PATCH v4 8/8 staging: lustre: lclient: lcommon_cl.c fixing coding style issues

In reply to Anil Belur

From: Anil Belur <[email protected]>

fixed: WARNING: suspect code indent for conditional statements (32, 32)

---
 drivers/staging/lustre/lustre/lclient/lcommon_cl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/lustre/lustre/lclient/lcommon_cl.c +1 -1
index 440d7c2..a602746 100644
@@ -869,7 +869,7 @@ int ccc_prep_size(const struct lu_env *env, struct cl_object *obj,
 
 				if ((size == 0 && cur_index != 0) ||
 				    (check < cur_index))
-				*exceed = 1;
+					*exceed = 1;
 			}
 			return result;
 		} else {
Signature · 1 line
1.9.0