2014-06-16 04:29:12

by Anil Belur

[permalink] [raw]
Subject: [PATCH v3 1/7] staging: lustre: lclient: glimpse.c fixing coding style issues

From: Anil Belur <[email protected]>

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

Signed-off-by: Anil Belur <[email protected]>
---
drivers/staging/lustre/lustre/lclient/glimpse.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/lclient/glimpse.c b/drivers/staging/lustre/lustre/lclient/glimpse.c
index 7bbca4b..60a6e6e 100644
--- a/drivers/staging/lustre/lustre/lclient/glimpse.c
+++ b/drivers/staging/lustre/lustre/lclient/glimpse.c
@@ -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
--
1.9.0


2014-06-16 04:29:25

by Anil Belur

[permalink] [raw]
Subject: [PATCH v3 2/7] staging: lustre: lclient: glimpse.c fixing coding style issues

From: Anil Belur <[email protected]>

fixed "WARNING: labels should not be indented"

Signed-off-by: Anil Belur <[email protected]>
---
drivers/staging/lustre/lustre/lclient/glimpse.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/lclient/glimpse.c b/drivers/staging/lustre/lustre/lclient/glimpse.c
index 60a6e6e..a0fdfe0 100644
--- a/drivers/staging/lustre/lustre/lclient/glimpse.c
+++ b/drivers/staging/lustre/lustre/lclient/glimpse.c
@@ -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)
--
1.9.0

2014-06-16 04:29:42

by Anil Belur

[permalink] [raw]
Subject: [PATCH v3 7/7] staging: lustre: lclient: lcommon_cl.c fixing coding style issues

From: Anil Belur <[email protected]>

fixed: WARNING: line over 80 characters and indent after the conditional
statement

Signed-off-by: Anil Belur <[email protected]>
---
drivers/staging/lustre/lustre/lclient/lcommon_cl.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c
index c180a20..8fed70c 100644
--- a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c
+++ b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c
@@ -825,6 +825,7 @@ int ccc_prep_size(const struct lu_env *env, struct cl_object *obj,
loff_t pos = start + count - 1;
loff_t kms;
int result;
+ unsigned long cur_index;

/*
* Consistency guarantees: following possibilities exist for the
@@ -864,11 +865,13 @@ 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;
+
+ 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))
- *exceed = 1;
+ (check < cur_index))
+ *exceed = 1;
}
return result;
} else {
--
1.9.0

2014-06-16 04:29:39

by Anil Belur

[permalink] [raw]
Subject: [PATCH v3 5/7] staging: lustre: lclient: lcommon_cl.c fixing coding style issues

From: Anil Belur <[email protected]>

fixed: ERROR: do not initialise statics to 0 or NULL
Signed-off-by: Anil Belur <[email protected]>
---
drivers/staging/lustre/lustre/lclient/lcommon_cl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c
index f83e6f2..7be0a93 100644
--- a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c
+++ b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c
@@ -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
--
1.9.0

2014-06-16 04:29:34

by Anil Belur

[permalink] [raw]
Subject: [PATCH v3 4/7] staging: lustre: lclient: lcommon_cl.c fixing coding style issues

From: Anil Belur <[email protected]>

fixed: WARNING: Missing a blank line after declarations
Signed-off-by: Anil Belur <[email protected]>
---
drivers/staging/lustre/lustre/lclient/lcommon_cl.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c
index 6907a16..f83e6f2 100644
--- a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c
+++ b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c
@@ -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));
}
--
1.9.0

2014-06-16 04:29:31

by Anil Belur

[permalink] [raw]
Subject: [PATCH v3 3/7] staging: lustre: lclient: lcommon_misc.c fixing coding style issues

From: Anil Belur <[email protected]>

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

Signed-off-by: Anil Belur <[email protected]>
---
drivers/staging/lustre/lustre/lclient/lcommon_misc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/lclient/lcommon_misc.c b/drivers/staging/lustre/lustre/lclient/lcommon_misc.c
index e04c2d3..01ce5c1 100644
--- a/drivers/staging/lustre/lustre/lclient/lcommon_misc.c
+++ b/drivers/staging/lustre/lustre/lclient/lcommon_misc.c
@@ -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);

--
1.9.0

2014-06-16 04:30:31

by Anil Belur

[permalink] [raw]
Subject: [PATCH v3 6/7] staging: lustre: lclient: lcommon_cl.c fixing coding style issues

From: Anil Belur <[email protected]>

fixed: ERROR: inline keyword should sit between storage class and type
Signed-off-by: Anil Belur <[email protected]>
---
drivers/staging/lustre/lustre/lclient/lcommon_cl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c
index 7be0a93..c180a20 100644
--- a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c
+++ b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c
@@ -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);
}
--
1.9.0

2014-06-16 04:55:24

by Oleg Drokin

[permalink] [raw]
Subject: Re: [PATCH v3 1/7] staging: lustre: lclient: glimpse.c fixing coding style issues

Hello!

On Jun 16, 2014, at 12:28 AM, Anil Belur wrote:

> From: Anil Belur <[email protected]>
>
> Fixed "ERROR: need consistent spacing around '+' (ctx:WxV)"
>
> Signed-off-by: Anil Belur <[email protected]>
> ---
> drivers/staging/lustre/lustre/lclient/glimpse.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/lustre/lustre/lclient/glimpse.c b/drivers/staging/lustre/lustre/lclient/glimpse.c
> index 7bbca4b..60a6e6e 100644
> --- a/drivers/staging/lustre/lustre/lclient/glimpse.c
> +++ b/drivers/staging/lustre/lustre/lclient/glimpse.c
> @@ -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;

This looks wrong.
Here +1 is apparently meant as +1 (compare to -1) to underscore it's positive nature.
If you wanted to drop the +, that'd be fine, I guess, but in your version it looks outright wrong to me (I tested and it compiles, though).

Bye,
Oleg-

2014-06-16 05:05:36

by Oleg Drokin

[permalink] [raw]
Subject: Re: [PATCH v3 7/7] staging: lustre: lclient: lcommon_cl.c fixing coding style issues


On Jun 16, 2014, at 12:28 AM, Anil Belur wrote:

> From: Anil Belur <[email protected]>
>
> fixed: WARNING: line over 80 characters and indent after the conditional
> statement
>
> Signed-off-by: Anil Belur <[email protected]>
> ---
> drivers/staging/lustre/lustre/lclient/lcommon_cl.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c
> index c180a20..8fed70c 100644
> --- a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c
> +++ b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c
> @@ -825,6 +825,7 @@ int ccc_prep_size(const struct lu_env *env, struct cl_object *obj,
> loff_t pos = start + count - 1;
> loff_t kms;
> int result;
> + unsigned long cur_index;

I wonder why move this particular declaration here?
The only user is still in that one conditional branch anyway.

>
> /*
> * Consistency guarantees: following possibilities exist for the
> @@ -864,11 +865,13 @@ 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;
> +
> + cur_index = start >> PAGE_CACHE_SHIFT;
> + loff_t check = ((size - 1) >> PAGE_CACHE_SHIFT);

This used to produce a warning about mixing code and declarations in the past.
Probably a bad idea to mix them anyway.

Thanks.

Bye,
Oleg

2014-06-16 06:01:11

by Anil Belur

[permalink] [raw]
Subject: Re: [PATCH v3 1/7] staging: lustre: lclient: glimpse.c fixing coding style issues


> - result = +1; + result = + 1;
> This looks wrong.
> Here +1 is apparently meant as +1 (compare to -1) to underscore it's positive nature.
> If you wanted to drop the +, that'd be fine, I guess, but in your version it looks outright wrong to me (I tested and it compiles, though).
>
> Bye,
> Oleg
Hi Oleg,

While testing the value of `result` still remains "+1", from the above
change.

I agree as suggested, its better to remove `+` and use `result = 1;`
makes it more readable.

Will redo this patch and send.

Cheers.

2014-06-16 06:01:53

by Anil Belur

[permalink] [raw]
Subject: Re: [PATCH v3 7/7] staging: lustre: lclient: lcommon_cl.c fixing coding style issues


> + unsigned long cur_index;

> I wonder why move this particular declaration here?
> The only user is still in that one conditional branch anyway.
These changes are for fixing warning of line over 80 chars and indent.
maybe I should change 'unsigned long' to 'u64' keeping the line of code
in the same place.
>> /*
>> * Consistency guarantees: following possibilities exist for the
>> @@ -864,11 +865,13 @@ 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;
>> +
>> + cur_index = start >> PAGE_CACHE_SHIFT;
>> + loff_t check = ((size - 1) >> PAGE_CACHE_SHIFT);
> This used to produce a warning about mixing code and declarations in the past.
> Probably a bad idea to mix them anyway.
Will create a separate patch for mixed declaration error which is still
present.