drivers/staging/lustre: Coding-guideline: Missing a blank line after declarations
PATCH 1/1 drivers/staging/lustre: Coding-guideline: Missing a blank line after declarations
Adding a blank line after declaration
--- drivers/staging/lustre/lustre/llite/dcache.c | 1 + drivers/staging/lustre/lustre/llite/namei.c | 1 + drivers/staging/lustre/lustre/llite/symlink.c | 1 + drivers/staging/lustre/lustre/llite/vvp_io.c | 1 + drivers/staging/lustre/lustre/obdclass/cl_page.c | 1 + drivers/staging/lustre/lustre/osc/osc_cache.c | 1 + 6 files changed, 6 insertions(+)
drivers/staging/lustre/lustre/llite/dcache.c +1 -0
@@ -126,6 +126,7 @@ static int ll_ddelete(const struct dentry *de)static int ll_d_init (struct dentry *de) {struct ll_dentry_data *lld =kzalloc (sizeof (*lld),GFP_KERNEL ); +if (unlikely (!lld))return -ENOMEM ; lld->lld_invalid =1 ;
drivers/staging/lustre/lustre/llite/namei.c +1 -0
@@ -434,6 +434,7 @@ struct dentry *ll_splice_alias(struct inode *inode, struct dentry *de) {if (inode) {struct dentry *new =ll_find_alias (inode, de); +if (new) {d_move (new, de);iput (inode);
drivers/staging/lustre/lustre/llite/symlink.c +1 -0
@@ -129,6 +129,7 @@ static const char *ll_get_link(struct dentry *dentry,struct ptlrpc_request *request =NULL ;int rc;char *symname =NULL ; +if (!dentry)return ERR_PTR (-ECHILD );
drivers/staging/lustre/lustre/llite/vvp_io.c +1 -0
@@ -450,6 +450,7 @@ static void vvp_io_advance(const struct lu_env *env, {struct cl_object *obj = ios->cis_io->ci_obj;struct vvp_io *vio =cl2vvp_io (env, ios); +CLOBINVRNT (env, obj,vvp_object_invariant (obj)); vio->vui_tot_count -= nob;
drivers/staging/lustre/lustre/obdclass/cl_page.c +1 -0
@@ -482,6 +482,7 @@ void cl_page_disown0(const struct lu_env *env,int cl_page_is_owned (const struct cl_page *pg,const struct cl_io *io) {struct cl_io *top =cl_io_top ((struct cl_io *)io); +LINVRNT (cl_object_same (pg->cp_obj, io->ci_obj));return pg->cp_state ==CPS_OWNED && pg->cp_owner == top; }
drivers/staging/lustre/lustre/osc/osc_cache.c +1 -0
@@ -898,6 +898,7 @@ int osc_extent_finish(const struct lu_env *env, struct osc_extent *ext,int offset = last_off & ~PAGE_MASK ;int count = last_count + (offset & (blocksize -1 ));int end = (offset + last_count) & (blocksize -1 ); +if (end) count += blocksize - end;
Signature · 1 line
2.7.4
drivers/staging/lustre/lustre/obdclass/cl_page.c void cl_page_disown0(const struct lu_env *env, · line 488
Quoted 12 lines · Pushkar Jambhlekar
drivers/staging/lustre/lustre/obdclass/cl_page.c +1
-0@@ -482,6 +482,7 @@ void cl_page_disown0(const struct lu_env *env,int cl_page_is_owned (const struct cl_page *pg,const struct cl_io *io) {struct cl_io *top =cl_io_top ((struct cl_io *)io); +LINVRNT (cl_object_same (pg->cp_obj, io->ci_obj));return pg->cp_state ==CPS_OWNED && pg->cp_owner == top; }
This is not related to the patch but I don't understand CLOBINVRNT() and LINVRNT().
# define LINVRNT(exp) LASSERT(exp) # define LINVRNT(exp) ((void)sizeof !!(exp))
Why do we do the sizeof() instead of just an empty define? The compiler calculates the size at compile time and doesn't execute the expression so it's the same as an empty define so far as I can tell.
regards,
dan carpenter
((void)sizeof !!(exp)) => I believe it is for compiler to unflag "unused variable" warning.
Quoted 26 lines · Dan Carpenter
drivers/staging/lustre/lustre/obdclass/cl_page.c void cl_page_disown0(const struct lu_env *env, · line 488
Quoted 12 lines · Pushkar Jambhlekar
drivers/staging/lustre/lustre/obdclass/cl_page.c +1
-0@@ -482,6 +482,7 @@ void cl_page_disown0(const struct lu_env *env,int cl_page_is_owned (const struct cl_page *pg,const struct cl_io *io) {struct cl_io *top =cl_io_top ((struct cl_io *)io); +LINVRNT (cl_object_same (pg->cp_obj, io->ci_obj));return pg->cp_state ==CPS_OWNED && pg->cp_owner == top; }This is not related to the patch but I don't understand
CLOBINVRNT()andLINVRNT().# define LINVRNT(exp) LASSERT(exp) # define LINVRNT(exp) ((void)sizeof !!(exp))Why do we do the
sizeof()instead of just an empty define? The compiler calculates the size at compile time and doesn't execute the expression so it's the same as an empty define so far as I can tell.regards,
dan carpenter
Signature · 1 line
Jambhlekar Pushkar Arun
Quoted 18 lines · Dan Carpenter
drivers/staging/lustre/lustre/obdclass/cl_page.c void cl_page_disown0(const struct lu_env *env, · line 488
Quoted 12 lines · Pushkar Jambhlekar
drivers/staging/lustre/lustre/obdclass/cl_page.c +1
-0@@ -482,6 +482,7 @@ void cl_page_disown0(const struct lu_env *env,int cl_page_is_owned (const struct cl_page *pg,const struct cl_io *io) {struct cl_io *top =cl_io_top ((struct cl_io *)io); +LINVRNT (cl_object_same (pg->cp_obj, io->ci_obj));return pg->cp_state ==CPS_OWNED && pg->cp_owner == top; }This is not related to the patch but I don't understand
CLOBINVRNT()andLINVRNT().
Quoted 6 lines
# define LINVRNT(exp) LASSERT(exp) # define LINVRNT(exp) ((void)sizeof !!(exp))Why do we do the
sizeof()instead of just an empty define? The compiler calculates the size at compile time and doesn't execute the expression so it's the same as an empty define so far as I can tell.
Even though sizeof() is evaluated at compile time and not runtime, it will at least evaluate the expression "exp" at compile time. This is useful to avoid "unused variable" warnings, syntax errors, etc. in that code when the more expensive LINVRNT() checking is enabled, but is disabled most of the time.
With an empty expression this wouldn't happen at all, and errors may creep in.
Cheers, Andreas
--
Andreas Dilger
Lustre Principal Architect
Intel Corporation
Quoted 17 lines · Pushkar Jambhlekar
drivers/staging/lustre/lustre/obdclass/cl_page.c void cl_page_disown0(const struct lu_env *env, · line 487
Quoted 12 lines
drivers/staging/lustre/lustre/obdclass/cl_page.c +1
-0@@ -482,6 +482,7 @@ void cl_page_disown0(const struct lu_env *env,int cl_page_is_owned (const struct cl_page *pg,const struct cl_io *io) {struct cl_io *top =cl_io_top ((struct cl_io *)io); +LINVRNT (cl_object_same (pg->cp_obj, io->ci_obj));return pg->cp_state ==CPS_OWNED && pg->cp_owner == top; }This is not related to the patch but I don't understand
CLOBINVRNT()andLINVRNT().
Quoted 6 lines
# define LINVRNT(exp) LASSERT(exp) # define LINVRNT(exp) ((void)sizeof !!(exp))Why do we do the
sizeof()instead of just an empty define? The compiler calculates the size at compile time and doesn't execute the expression so it's the same as an empty define so far as I can tell.
This is someone's attempt to avoid the unused variable warnings which would occur in some places when LINVRNT(exp) is defined as ((void)0).