Skip to contentSkip to conversation

staging: lustre: remove space between function name and and open parenthesis

PATCH Superseded Srikrishan Malik 5 participants 27 messages Aug 6, 2014 – Aug 11, 2014 Staging

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/12 staging: lustre: remove space between function name and and open parenthesis

Fixes following checkpatch warning:

WARNING: space prohibited between function name and open parenthesis '('

---
 drivers/staging/lustre/lustre/mdc/mdc_internal.h |  2 +-
 drivers/staging/lustre/lustre/mdc/mdc_lib.c      |  4 ++--
 drivers/staging/lustre/lustre/mdc/mdc_locks.c    |  2 +-
 drivers/staging/lustre/lustre/mdc/mdc_request.c  | 14 +++++++-------
 4 files changed, 11 insertions(+), 11 deletions(-)
drivers/staging/lustre/lustre/mdc/mdc_internal.h +1 -1
index e8235559e27f..f4da8f3523d2 100644
@@ -40,7 +40,7 @@
 #include "../include/lustre_mdc.h"
 #include "../include/lustre_mds.h"
 
-#if defined (CONFIG_PROC_FS)
+#if defined CONFIG_PROC_FS
 void lprocfs_mdc_init_vars(struct lprocfs_static_vars *lvars);
 #else
 static inline void lprocfs_mdc_init_vars(struct lprocfs_static_vars *lvars)
drivers/staging/lustre/lustre/mdc/mdc_lib.c +2 -2
index f54dd90c7e50..60217ba440aa 100644
@@ -42,7 +42,7 @@
 
 static void __mdc_pack_body(struct mdt_body *b, __u32 suppgid)
 {
-	LASSERT (b != NULL);
+	LASSERT(b != NULL);
 
 	b->suppgid = suppgid;
 	b->uid = from_kuid(&init_user_ns, current_uid());
@@ -409,7 +409,7 @@ void mdc_link_pack(struct ptlrpc_request *req, struct md_op_data *op_data)
 
 	CLASSERT(sizeof(struct mdt_rec_reint) == sizeof(struct mdt_rec_link));
 	rec = req_capsule_client_get(&req->rq_pill, &RMF_REC_REINT);
-	LASSERT (rec != NULL);
+	LASSERT(rec != NULL);
 
 	rec->lk_opcode   = REINT_LINK;
 	rec->lk_fsuid    = op_data->op_fsuid;//current->fsuid;
drivers/staging/lustre/lustre/mdc/mdc_locks.c +1 -1
index 71219b90e22b..88b43823c632 100644
@@ -633,7 +633,7 @@ static int mdc_finish_enqueue(struct obd_export *exp,
 
 		body = req_capsule_server_get(pill, &RMF_MDT_BODY);
 		if (body == NULL) {
-			CERROR ("Can't swab mdt_body\n");
+			CERROR("Can't swab mdt_body\n");
 			return -EPROTO;
 		}
 
drivers/staging/lustre/lustre/mdc/mdc_request.c +7 -7
index 4a1cc4eb73d5..0b517e550477 100644
@@ -1702,7 +1702,7 @@ static int mdc_quotactl(struct obd_device *unused, struct obd_export *exp,
 		if (oqc) {
 			*oqctl = *oqc;
 		} else if (!rc) {
-			CERROR ("Can't unpack obd_quotactl\n");
+			CERROR("Can't unpack obd_quotactl\n");
 			rc = -EPROTO;
 		}
 	} else if (!rc) {
@@ -2426,14 +2426,14 @@ static int mdc_setup(struct obd_device *obd, struct lustre_cfg *cfg)
 	struct lprocfs_static_vars lvars = { NULL };
 	int rc;
 
-	OBD_ALLOC(cli->cl_rpc_lock, sizeof (*cli->cl_rpc_lock));
+	OBD_ALLOC(cli->cl_rpc_lock, sizeof(*cli->cl_rpc_lock));
 	if (!cli->cl_rpc_lock)
 		return -ENOMEM;
 	mdc_init_rpc_lock(cli->cl_rpc_lock);
 
 	ptlrpcd_addref();
 
-	OBD_ALLOC(cli->cl_close_lock, sizeof (*cli->cl_close_lock));
+	OBD_ALLOC(cli->cl_close_lock, sizeof(*cli->cl_close_lock));
 	if (!cli->cl_close_lock)
 		GOTO(err_rpc_lock, rc = -ENOMEM);
 	mdc_init_rpc_lock(cli->cl_close_lock);
@@ -2459,9 +2459,9 @@ static int mdc_setup(struct obd_device *obd, struct lustre_cfg *cfg)
 	return rc;
 
 err_close_lock:
-	OBD_FREE(cli->cl_close_lock, sizeof (*cli->cl_close_lock));
+	OBD_FREE(cli->cl_close_lock, sizeof(*cli->cl_close_lock));
 err_rpc_lock:
-	OBD_FREE(cli->cl_rpc_lock, sizeof (*cli->cl_rpc_lock));
+	OBD_FREE(cli->cl_rpc_lock, sizeof(*cli->cl_rpc_lock));
 	ptlrpcd_decref();
 	return rc;
 }
@@ -2523,8 +2523,8 @@ static int mdc_cleanup(struct obd_device *obd)
 {
 	struct client_obd *cli = &obd->u.cli;
 
-	OBD_FREE(cli->cl_rpc_lock, sizeof (*cli->cl_rpc_lock));
-	OBD_FREE(cli->cl_close_lock, sizeof (*cli->cl_close_lock));
+	OBD_FREE(cli->cl_rpc_lock, sizeof(*cli->cl_rpc_lock));
+	OBD_FREE(cli->cl_close_lock, sizeof(*cli->cl_close_lock));
 
 	ptlrpcd_decref();
 
Signature · 1 line
1.9.3
#1 lore raw

PATCH 2/12 staging: lustre: remove spaces from start of line

Fixes the following checkpatch warning:

WARNING: please, no spaces at the start of a line

---
 drivers/staging/lustre/lustre/mdc/lproc_mdc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/lustre/lustre/mdc/lproc_mdc.c +2 -2
index d1d891b91663..f883d9c28f20 100644
@@ -209,6 +209,6 @@ static struct lprocfs_vars lprocfs_mdc_module_vars[] = {
 
 void lprocfs_mdc_init_vars(struct lprocfs_static_vars *lvars)
 {
-    lvars->module_vars  = lprocfs_mdc_module_vars;
-    lvars->obd_vars     = lprocfs_mdc_obd_vars;
+	lvars->module_vars  = lprocfs_mdc_module_vars;
+	lvars->obd_vars     = lprocfs_mdc_obd_vars;
 }
Signature · 1 line
1.9.3
#2 lore raw

PATCH 3/12 staging: lustre: move open brace to next line after functions

In reply to Srikrishan Malik

Fixes the following checkpatch error:

ERROR: open brace '{' following function declarations go on the next line

---
 drivers/staging/lustre/lustre/mdc/mdc_lib.c     | 3 ++-
 drivers/staging/lustre/lustre/mdc/mdc_request.c | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/staging/lustre/lustre/mdc/mdc_lib.c +2 -1
index 60217ba440aa..daaa7422c03f 100644
@@ -256,7 +256,8 @@ void mdc_open_pack(struct ptlrpc_request *req, struct md_op_data *op_data,
 	set_mrc_cr_flags(rec, cr_flags);
 }
 
-static inline __u64 attr_pack(unsigned int ia_valid) {
+static inline __u64 attr_pack(unsigned int ia_valid)
+{
 	__u64 sa_valid = 0;
 
 	if (ia_valid & ATTR_MODE)
drivers/staging/lustre/lustre/mdc/mdc_request.c +2 -1
index 0b517e550477..0bcf624620ce 100644
@@ -2384,7 +2384,8 @@ int mdc_fid_alloc(struct obd_export *exp, struct lu_fid *fid,
 	return seq_client_alloc_fid(NULL, seq, fid);
 }
 
-struct obd_uuid *mdc_get_uuid(struct obd_export *exp) {
+struct obd_uuid *mdc_get_uuid(struct obd_export *exp)
+{
 	struct client_obd *cli = &exp->exp_obd->u.cli;
 	return &cli->cl_target_uuid;
 }
Signature · 1 line
1.9.3
#3 lore raw

PATCH 4/12 staging: lustre: fix lines over 80 chars

In reply to Srikrishan Malik

Fixes the following checkpatch warning:

WARNING: line over 80 characters

---
 drivers/staging/lustre/lustre/mdc/lproc_mdc.c   | 6 ++++--
 drivers/staging/lustre/lustre/mdc/mdc_lib.c     | 9 ++++++---
 drivers/staging/lustre/lustre/mdc/mdc_locks.c   | 7 ++++---
 drivers/staging/lustre/lustre/mdc/mdc_request.c | 6 ++++--
 4 files changed, 18 insertions(+), 10 deletions(-)
drivers/staging/lustre/lustre/mdc/lproc_mdc.c +4 -2
index f883d9c28f20..16341c818358 100644
@@ -56,7 +56,8 @@ static ssize_t mdc_max_rpcs_in_flight_seq_write(struct file *file,
 						size_t count,
 						loff_t *off)
 {
-	struct obd_device *dev = ((struct seq_file *)file->private_data)->private;
+	struct obd_device *dev =
+			((struct seq_file *)file->private_data)->private;
 	struct client_obd *cli = &dev->u.cli;
 	int val, rc;
 
@@ -84,7 +85,8 @@ static int mdc_kuc_open(struct inode *inode, struct file *file)
 static ssize_t mdc_kuc_write(struct file *file, const char *buffer,
 			     size_t count, loff_t *off)
 {
-	struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
+	struct obd_device *obd =
+			((struct seq_file *)file->private_data)->private;
 	struct kuc_hdr		*lh;
 	struct hsm_action_list	*hal;
 	struct hsm_action_item	*hai;
drivers/staging/lustre/lustre/mdc/mdc_lib.c +6 -3
index daaa7422c03f..16e2e0b611d1 100644
@@ -52,7 +52,8 @@ static void __mdc_pack_body(struct mdt_body *b, __u32 suppgid)
 	b->capability = cfs_curproc_cap_pack();
 }
 
-void mdc_pack_capa(struct ptlrpc_request *req, const struct req_msg_field *field,
+void mdc_pack_capa(struct ptlrpc_request *req,
+		   const struct req_msg_field *field,
 		   struct obd_capa *oc)
 {
 	struct req_capsule *pill = &req->rq_pill;
@@ -317,7 +318,8 @@ static void mdc_setattr_pack_rec(struct mdt_rec_setattr *rec,
 	rec->sa_atime  = LTIME_S(op_data->op_attr.ia_atime);
 	rec->sa_mtime  = LTIME_S(op_data->op_attr.ia_mtime);
 	rec->sa_ctime  = LTIME_S(op_data->op_attr.ia_ctime);
-	rec->sa_attr_flags = ((struct ll_iattr *)&op_data->op_attr)->ia_attr_flags;
+	rec->sa_attr_flags =
+			((struct ll_iattr *)&op_data->op_attr)->ia_attr_flags;
 	if ((op_data->op_attr.ia_valid & ATTR_GID) &&
 	    in_group_p(op_data->op_attr.ia_gid))
 		rec->sa_suppgid =
@@ -552,7 +554,8 @@ int mdc_enter_request(struct client_obd *cli)
 		list_add_tail(&mcw.mcw_entry, &cli->cl_cache_waiters);
 		init_waitqueue_head(&mcw.mcw_waitq);
 		client_obd_list_unlock(&cli->cl_loi_list_lock);
-		rc = l_wait_event(mcw.mcw_waitq, mdc_req_avail(cli, &mcw), &lwi);
+		rc = l_wait_event(mcw.mcw_waitq, mdc_req_avail(cli, &mcw),
+				  &lwi);
 		if (rc) {
 			client_obd_list_lock(&cli->cl_loi_list_lock);
 			if (list_empty(&mcw.mcw_entry))
drivers/staging/lustre/lustre/mdc/mdc_locks.c +4 -3
index 88b43823c632..5de9e8862393 100644
@@ -450,8 +450,8 @@ static struct ptlrpc_request *mdc_intent_unlink_pack(struct obd_export *exp,
 }
 
 static struct ptlrpc_request *mdc_intent_getattr_pack(struct obd_export *exp,
-						      struct lookup_intent *it,
-						      struct md_op_data *op_data)
+						    struct lookup_intent *it,
+						    struct md_op_data *op_data)
 {
 	struct ptlrpc_request *req;
 	struct obd_device     *obddev = class_exp2obd(exp);
@@ -1039,7 +1039,8 @@ static int mdc_finish_intent_lock(struct obd_export *exp,
 
 		memcpy(&old_lock, lockh, sizeof(*lockh));
 		if (ldlm_lock_match(NULL, LDLM_FL_BLOCK_GRANTED, NULL,
-				    LDLM_IBITS, &policy, LCK_NL, &old_lock, 0)) {
+				    LDLM_IBITS, &policy, LCK_NL,
+				    &old_lock, 0)) {
 			ldlm_lock_decref_and_cancel(lockh,
 						    it->d.lustre.it_lock_mode);
 			memcpy(lockh, &old_lock, sizeof(old_lock));
drivers/staging/lustre/lustre/mdc/mdc_request.c +4 -2
index 0bcf624620ce..5126262aa73d 100644
@@ -897,7 +897,8 @@ int mdc_close(struct obd_export *exp, struct md_op_data *op_data,
 		mod->mod_open_req->rq_replay = 0;
 		spin_unlock(&mod->mod_open_req->rq_lock);
 	} else {
-		 CDEBUG(D_HA, "couldn't find open req; expecting close error\n");
+		 CDEBUG(D_HA,
+			"couldn't find open req; expecting close error\n");
 	}
 
 	mdc_close_pack(req, op_data);
@@ -1084,7 +1085,8 @@ restart_bulk:
 			CERROR("too many resend retries, returning error\n");
 			return -EIO;
 		}
-		lwi = LWI_TIMEOUT_INTR(cfs_time_seconds(resends), NULL, NULL, NULL);
+		lwi = LWI_TIMEOUT_INTR(cfs_time_seconds(resends),
+				       NULL, NULL, NULL);
 		l_wait_event(waitq, 0, &lwi);
 
 		goto restart_bulk;
Signature · 1 line
1.9.3
#4 lore raw

PATCH 5/12 staging: lustre: Add missing spaces around operators and braces.

In reply to Srikrishan Malik

Fixes the following checkpatch errors:

ERROR: space required after that ',' (ctx:VxV)
ERROR: space required after that close brace '}'

---
 drivers/staging/lustre/lustre/mdc/mdc_lib.c     | 25 +++++++++++++------------
 drivers/staging/lustre/lustre/mdc/mdc_locks.c   |  5 +++--
 drivers/staging/lustre/lustre/mdc/mdc_reint.c   |  2 +-
 drivers/staging/lustre/lustre/mdc/mdc_request.c |  7 ++++---
 4 files changed, 21 insertions(+), 18 deletions(-)
drivers/staging/lustre/lustre/mdc/mdc_lib.c +13 -12
index 16e2e0b611d1..35ce2fdf696c 100644
@@ -345,7 +345,8 @@ void mdc_setattr_pack(struct ptlrpc_request *req, struct md_op_data *op_data,
 	struct mdt_ioepoch *epoch;
 	struct lov_user_md *lum = NULL;
 
-	CLASSERT(sizeof(struct mdt_rec_reint) ==sizeof(struct mdt_rec_setattr));
+	CLASSERT(sizeof(struct mdt_rec_reint) ==
+					sizeof(struct mdt_rec_setattr));
 	rec = req_capsule_client_get(&req->rq_pill, &RMF_REC_REINT);
 	mdc_setattr_pack_rec(rec, op_data);
 
@@ -385,18 +386,18 @@ void mdc_unlink_pack(struct ptlrpc_request *req, struct md_op_data *op_data)
 	rec = req_capsule_client_get(&req->rq_pill, &RMF_REC_REINT);
 	LASSERT(rec != NULL);
 
-	rec->ul_opcode  = op_data->op_cli_flags & CLI_RM_ENTRY ?
+	rec->ul_opcode   = op_data->op_cli_flags & CLI_RM_ENTRY ?
 					REINT_RMENTRY : REINT_UNLINK;
-	rec->ul_fsuid   = op_data->op_fsuid;
-	rec->ul_fsgid   = op_data->op_fsgid;
-	rec->ul_cap     = op_data->op_cap;
-	rec->ul_mode    = op_data->op_mode;
-	rec->ul_suppgid1= op_data->op_suppgids[0];
-	rec->ul_suppgid2= -1;
-	rec->ul_fid1    = op_data->op_fid1;
-	rec->ul_fid2    = op_data->op_fid2;
-	rec->ul_time    = op_data->op_mod_time;
-	rec->ul_bias    = op_data->op_bias;
+	rec->ul_fsuid    = op_data->op_fsuid;
+	rec->ul_fsgid    = op_data->op_fsgid;
+	rec->ul_cap      = op_data->op_cap;
+	rec->ul_mode     = op_data->op_mode;
+	rec->ul_suppgid1 = op_data->op_suppgids[0];
+	rec->ul_suppgid2 = -1;
+	rec->ul_fid1     = op_data->op_fid1;
+	rec->ul_fid2     = op_data->op_fid2;
+	rec->ul_time     = op_data->op_mod_time;
+	rec->ul_bias     = op_data->op_bias;
 
 	mdc_pack_capa(req, &RMF_CAPA1, op_data->op_capa1);
 
drivers/staging/lustre/lustre/mdc/mdc_locks.c +3 -2
index 5de9e8862393..a5a2597616e9 100644
@@ -621,7 +621,7 @@ static int mdc_finish_enqueue(struct obd_export *exp,
 	 * function without doing so, and try to replay a failed create
 	 * (bug 3440) */
 	if (it->it_op & IT_OPEN && req->rq_replay &&
-	    (!it_disposition(it, DISP_OPEN_OPEN) ||intent->it_status != 0))
+	    (!it_disposition(it, DISP_OPEN_OPEN) || intent->it_status != 0))
 		mdc_clear_replay_flag(req, intent->it_status);
 
 	DEBUG_REQ(D_RPCTRACE, req, "op: %d disposition: %x, status: %d",
@@ -1047,7 +1047,8 @@ static int mdc_finish_intent_lock(struct obd_export *exp,
 			it->d.lustre.it_lock_handle = lockh->cookie;
 		}
 	}
-	CDEBUG(D_DENTRY,"D_IT dentry %.*s intent: %s status %d disp %x rc %d\n",
+	CDEBUG(D_DENTRY,
+	       "D_IT dentry %.*s intent: %s status %d disp %x rc %d\n",
 	       op_data->op_namelen, op_data->op_name, ldlm_it2str(it->it_op),
 	       it->d.lustre.it_status, it->d.lustre.it_disposition, rc);
 	return rc;
drivers/staging/lustre/lustre/mdc/mdc_reint.c +1 -1
index c5420a42bc33..c40304bf0b62 100644
@@ -71,7 +71,7 @@ int mdc_resource_get_unused(struct obd_export *exp, const struct lu_fid *fid,
 			    __u64 bits)
 {
 	struct ldlm_namespace *ns = exp->exp_obd->obd_namespace;
-	ldlm_policy_data_t policy = {{0}};
+	ldlm_policy_data_t policy = {{0} };
 	struct ldlm_res_id res_id;
 	struct ldlm_resource *res;
 	int count;
drivers/staging/lustre/lustre/mdc/mdc_request.c +4 -3
index 5126262aa73d..6def92133227 100644
@@ -326,7 +326,8 @@ static int mdc_is_subdir(struct obd_export *exp,
 	return rc;
 }
 
-static int mdc_xattr_common(struct obd_export *exp,const struct req_format *fmt,
+static int mdc_xattr_common(struct obd_export *exp,
+			    const struct req_format *fmt,
 			    const struct lu_fid *fid,
 			    struct obd_capa *oc, int opcode, obd_valid valid,
 			    const char *xattr_name, const char *input,
@@ -544,7 +545,7 @@ int mdc_get_lustre_md(struct obd_export *exp, struct ptlrpc_request *req,
 		int lmvsize;
 		struct lov_mds_md *lmv;
 
-		if(!S_ISDIR(md->body->mode)) {
+		if (!S_ISDIR(md->body->mode)) {
 			CDEBUG(D_INFO, "OBD_MD_FLDIREA set, should be a "
 			       "directory, but is not\n");
 			GOTO(out, rc = -EPROTO);
@@ -1536,7 +1537,7 @@ static int changelog_kkuc_cb(const struct lu_env *env, struct llog_handle *llh,
 	memcpy(lh + 1, &rec->cr, len - sizeof(*lh));
 
 	rc = libcfs_kkuc_msg_put(cs->cs_fp, lh);
-	CDEBUG(D_CHANGELOG, "kucmsg fp %p len %d rc %d\n", cs->cs_fp, len,rc);
+	CDEBUG(D_CHANGELOG, "kucmsg fp %p len %d rc %d\n", cs->cs_fp, len, rc);
 
 	return rc;
 }
Signature · 1 line
1.9.3
#5 lore raw

Re: [PATCH 05/12] staging: lustre: Add missing spaces around operators and braces.

drivers/staging/lustre/lustre/mdc/mdc_reint.c int mdc_resource_get_unused(struct obd_export *exp, const struct lu_fid *fid, · line 74

Quoted 10 lines · Srikrishan Malik
drivers/staging/lustre/lustre/mdc/mdc_reint.c +1 -1
index c5420a42bc33..c40304bf0b62 100644
@@ -71,7 +71,7 @@ int mdc_resource_get_unused(struct obd_export *exp, const struct lu_fid *fid,
 			    __u64 bits)
 {
 	struct ldlm_namespace *ns = exp->exp_obd->obd_namespace;
-	ldlm_policy_data_t policy = {{0}};
+	ldlm_policy_data_t policy = {{0} };

That's odd. Since when is a space required here? Anyway, put one at the start too if you're goind to do that. Or you could do it like:

	ldlm_policy_data_t policy = {};

?

regards,
dan carpenter

#6 lore raw

Re: [PATCH 05/12] staging: lustre: Add missing spaces around operators and braces.

Quoted 2 lines · Dan Carpenter

drivers/staging/lustre/lustre/mdc/mdc_reint.c

Quoted 1 line · Srikrishan Malik
drivers/staging/lustre/lustre/mdc/mdc_reint.c +0 -0

[]

Quoted 10 lines

drivers/staging/lustre/lustre/mdc/mdc_reint.c int mdc_resource_get_unused(struct obd_export *exp, const struct lu_fid *fid, · line 74

Quoted 6 lines
drivers/staging/lustre/lustre/mdc/mdc_reint.c +1 -1
@@ -71,7 +71,7 @@ int mdc_resource_get_unused(struct obd_export *exp, const struct lu_fid *fid,
 			    __u64 bits)
 {
 	struct ldlm_namespace *ns = exp->exp_obd->obd_namespace;
-	ldlm_policy_data_t policy = {{0}};
+	ldlm_policy_data_t policy = {{0} };

That's odd. Since when is a space required here? Anyway, put one at the start too if you're goind to do that. Or you could do it like:

Quoted 3 lines
	ldlm_policy_data_t policy = {};

?

It comes from a pretty old bit of checkpatch:

de7d4f0e (Andy Whitcroft 2007-07-15 23:37:22 -0700 3706) # closing brace should have a space following it when it has anything de7d4f0e (Andy Whitcroft 2007-07-15 23:37:22 -0700 3707) # on the line
de7d4f0e (Andy Whitcroft 2007-07-15 23:37:22 -0700 3708) if ($line =~ /}(?!(?:,|;|\)))\S/) {

Maybe it should have an } added to the test like:

if ($line =~ /}(?!(?:,|;|\)|}))\S/) {

#7 lore raw

Re: [PATCH 05/12] staging: lustre: Add missing spaces around operators and braces.

Quoted 20 lines · Joe Perches
Quoted 2 lines · Dan Carpenter

drivers/staging/lustre/lustre/mdc/mdc_reint.c

Quoted 1 line · Srikrishan Malik
drivers/staging/lustre/lustre/mdc/mdc_reint.c +0 -0

[]

Quoted 10 lines

drivers/staging/lustre/lustre/mdc/mdc_reint.c int mdc_resource_get_unused(struct obd_export *exp, const struct lu_fid *fid, · line 74

Quoted 6 lines
drivers/staging/lustre/lustre/mdc/mdc_reint.c +1 -1
@@ -71,7 +71,7 @@ int mdc_resource_get_unused(struct obd_export *exp, const struct lu_fid *fid,
 			    __u64 bits)
 {
 	struct ldlm_namespace *ns = exp->exp_obd->obd_namespace;
-	ldlm_policy_data_t policy = {{0}};
+	ldlm_policy_data_t policy = {{0} };

That's odd. Since when is a space required here? Anyway, put one at the start too if you're goind to do that. Or you could do it like:

Quoted 3 lines
	ldlm_policy_data_t policy = {};

?

It comes from a pretty old bit of checkpatch:

Quoted 8 lines

de7d4f0e (Andy Whitcroft 2007-07-15 23:37:22 -0700 3706) # closing brace should have a space following it when it has anything de7d4f0e (Andy Whitcroft 2007-07-15 23:37:22 -0700 3707) # on the line
de7d4f0e (Andy Whitcroft 2007-07-15 23:37:22 -0700 3708) if ($line =~ /}(?!(?:,|;|\)))\S/) {

Maybe it should have an } added to the test like:

if ($line =~ /}(?!(?:,|;|\)|}))\S/) {

Yes. It feels like '}}' is common.

Also it should ignore \. because this used for:

ERROR: space required after that close brace '}'
#118: FILE: ./drivers/gpu/drm/nouveau/core/engine/disp/nva3.c:118:
+}.base.base;

Otherwise this test is legit and complains about bad typedefs and '}else{' statements.

regards,
dan carpenter

#8 lore raw

Re: [PATCH 05/12] staging: lustre: Add missing spaces around operators and braces.

Quoted 25 lines · Dan Carpenter
Quoted 24 lines · Joe Perches
Quoted 2 lines · Dan Carpenter

drivers/staging/lustre/lustre/mdc/mdc_reint.c

Quoted 1 line · Srikrishan Malik
drivers/staging/lustre/lustre/mdc/mdc_reint.c +0 -0

[]

Quoted 10 lines

drivers/staging/lustre/lustre/mdc/mdc_reint.c int mdc_resource_get_unused(struct obd_export *exp, const struct lu_fid *fid, · line 74

Quoted 6 lines
drivers/staging/lustre/lustre/mdc/mdc_reint.c +1 -1
@@ -71,7 +71,7 @@ int mdc_resource_get_unused(struct obd_export *exp, const struct lu_fid *fid,
 			    __u64 bits)
 {
 	struct ldlm_namespace *ns = exp->exp_obd->obd_namespace;
-	ldlm_policy_data_t policy = {{0}};
+	ldlm_policy_data_t policy = {{0} };

That's odd. Since when is a space required here? Anyway, put one at the start too if you're goind to do that. Or you could do it like:

Quoted 3 lines
	ldlm_policy_data_t policy = {};

?

It comes from a pretty old bit of checkpatch:

de7d4f0e (Andy Whitcroft 2007-07-15 23:37:22 -0700 3706) # closing brace should have a space following it when it has anything de7d4f0e (Andy Whitcroft 2007-07-15 23:37:22 -0700 3707) # on the line
de7d4f0e (Andy Whitcroft 2007-07-15 23:37:22 -0700 3708) if ($line =~ /}(?!(?:,|;|\)))\S/) {

Quoted 6 lines
Quoted 4 lines

Maybe it should have an } added to the test like:

if ($line =~ /}(?!(?:,|;|\)|}))\S/) {

Yes. It feels like '}}' is common.

I think so too. Also, there isn't an equivalent test for '{{' so warning on '}}' seems silly.

Quoted 8 lines

Also it should ignore \. because this used for:

ERROR: space required after that close brace '}'
#118: FILE: ./drivers/gpu/drm/nouveau/core/engine/disp/nva3.c:118:
+}.base.base;

Otherwise this test is legit and complains about bad typedefs and '}else{' statements.

I don't think \. should be added myself.

Only nouveau uses that style.

I think all of those nouveau uses are not very nice and they should be changed instead or the warnings should just be ignored there.

Andy?

#9 lore raw

PATCH 6/12 staging: lustre: replace c99 style comments with C89

In reply to Srikrishan Malik

Fixes the following checkpatch error:

ERROR: do not use C99 // comments

---
 drivers/staging/lustre/lustre/mdc/mdc_lib.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/lustre/lustre/mdc/mdc_lib.c +3 -3
index 35ce2fdf696c..7f9b6eb51860 100644
@@ -416,9 +416,9 @@ void mdc_link_pack(struct ptlrpc_request *req, struct md_op_data *op_data)
 	LASSERT(rec != NULL);
 
 	rec->lk_opcode   = REINT_LINK;
-	rec->lk_fsuid    = op_data->op_fsuid;//current->fsuid;
-	rec->lk_fsgid    = op_data->op_fsgid;//current->fsgid;
-	rec->lk_cap      = op_data->op_cap;//current->cap_effective;
+	rec->lk_fsuid    = op_data->op_fsuid; /* current->fsuid; */
+	rec->lk_fsgid    = op_data->op_fsgid; /*current->fsgid; */
+	rec->lk_cap      = op_data->op_cap;   /*current->cap_effective; */
 	rec->lk_suppgid1 = op_data->op_suppgids[0];
 	rec->lk_suppgid2 = op_data->op_suppgids[1];
 	rec->lk_fid1     = op_data->op_fid1;
Signature · 1 line
1.9.3
#10 lore raw

Re: [PATCH 06/12] staging: lustre: replace c99 style comments with C89

Quoted 5 lines · Srikrishan Malik
drivers/staging/lustre/lustre/mdc/mdc_lib.c +0 -0
index 35ce2fdf696c..7f9b6eb51860 100644

drivers/staging/lustre/lustre/mdc/mdc_lib.c void mdc_link_pack(struct ptlrpc_request *req, struct md_op_data *op_data) · line 421

Quoted 9 lines
drivers/staging/lustre/lustre/mdc/mdc_lib.c +3 -3
@@ -416,9 +416,9 @@ void mdc_link_pack(struct ptlrpc_request *req, struct md_op_data *op_data)
 	LASSERT(rec != NULL);
 
 	rec->lk_opcode   = REINT_LINK;
-	rec->lk_fsuid    = op_data->op_fsuid;//current->fsuid;
-	rec->lk_fsgid    = op_data->op_fsgid;//current->fsgid;
-	rec->lk_cap      = op_data->op_cap;//current->cap_effective;
+	rec->lk_fsuid    = op_data->op_fsuid; /* current->fsuid; */
+	rec->lk_fsgid    = op_data->op_fsgid; /*current->fsgid; */
+	rec->lk_cap      = op_data->op_cap;   /*current->cap_effective; */

Put a space after the '/*'.

regards,
dan carpenter

#11 lore raw

PATCH 7/12 staging: lustre: add blank lines after declarations

In reply to Srikrishan Malik

Fixes the following checkpatch warning:

WARNING: Missing a blank line after declarations

---
 drivers/staging/lustre/lustre/mdc/mdc_lib.c     | 1 +
 drivers/staging/lustre/lustre/mdc/mdc_locks.c   | 3 +++
 drivers/staging/lustre/lustre/mdc/mdc_request.c | 5 +++++
 3 files changed, 9 insertions(+)
drivers/staging/lustre/lustre/mdc/mdc_lib.c +1 -0
index 7f9b6eb51860..95fe62da26e2 100644
@@ -490,6 +490,7 @@ void mdc_getattr_pack(struct ptlrpc_request *req, __u64 valid, int flags,
 
 	if (op_data->op_name) {
 		char *tmp = req_capsule_client_get(&req->rq_pill, &RMF_NAME);
+
 		LOGL0(op_data->op_name, op_data->op_namelen, tmp);
 
 	}
drivers/staging/lustre/lustre/mdc/mdc_locks.c +3 -0
index a5a2597616e9..4d837d61be65 100644
@@ -134,6 +134,7 @@ int mdc_set_lock_data(struct obd_export *exp, __u64 *lockh, void *data,
 	if (lock->l_resource->lr_lvb_inode &&
 	    lock->l_resource->lr_lvb_inode != data) {
 		struct inode *old_inode = lock->l_resource->lr_lvb_inode;
+
 		LASSERTF(old_inode->i_state & I_FREEING,
 			 "Found existing inode %p/%lu/%u state %lu in lock: "
 			 "setting data to %p/%lu/%u\n", old_inode,
@@ -678,6 +679,7 @@ static int mdc_finish_enqueue(struct obd_export *exp,
 			 */
 			if ((it->it_op & IT_OPEN) && req->rq_replay) {
 				void *lmm;
+
 				if (req_capsule_get_size(pill, &RMF_EADATA,
 							 RCL_CLIENT) <
 				    body->eadatasize)
@@ -1029,6 +1031,7 @@ static int mdc_finish_intent_lock(struct obd_export *exp,
 	lock = ldlm_handle2lock(lockh);
 	if (lock) {
 		ldlm_policy_data_t policy = lock->l_policy_data;
+
 		LDLM_DEBUG(lock, "matching against this");
 
 		LASSERTF(fid_res_name_eq(&mdt_body->fid1,
drivers/staging/lustre/lustre/mdc/mdc_request.c +5 -0
index 6def92133227..57d903156917 100644
@@ -203,6 +203,7 @@ static int mdc_getattr_common(struct obd_export *exp,
 
 	if (body->valid & OBD_MD_FLMDSCAPA) {
 		struct lustre_capa *capa;
+
 		capa = req_capsule_server_get(pill, &RMF_CAPA1);
 		if (capa == NULL)
 			return -EPROTO;
@@ -283,6 +284,7 @@ int mdc_getattr_name(struct obd_export *exp, struct md_op_data *op_data,
 
 	if (op_data->op_name) {
 		char *name = req_capsule_client_get(&req->rq_pill, &RMF_NAME);
+
 		LASSERT(strnlen(op_data->op_name, op_data->op_namelen) ==
 				op_data->op_namelen);
 		memcpy(name, op_data->op_name, op_data->op_namelen);
@@ -696,6 +698,7 @@ void mdc_replay_open(struct ptlrpc_request *req)
 void mdc_commit_open(struct ptlrpc_request *req)
 {
 	struct md_open_data *mod = req->rq_cb_data;
+
 	if (mod == NULL)
 		return;
 
@@ -2390,6 +2393,7 @@ int mdc_fid_alloc(struct obd_export *exp, struct lu_fid *fid,
 struct obd_uuid *mdc_get_uuid(struct obd_export *exp)
 {
 	struct client_obd *cli = &exp->exp_obd->u.cli;
+
 	return &cli->cl_target_uuid;
 }
 
@@ -2742,6 +2746,7 @@ int __init mdc_init(void)
 {
 	int rc;
 	struct lprocfs_static_vars lvars = { NULL };
+
 	lprocfs_mdc_init_vars(&lvars);
 
 	rc = class_register_type(&mdc_obd_ops, &mdc_md_ops, lvars.module_vars,
Signature · 1 line
1.9.3
#12 lore raw

PATCH 8/12 staging: lustre: fix multi line strings

In reply to Srikrishan Malik

Fixes the following checkpatch warning:

WARNING: quoted string split across lines

---
 drivers/staging/lustre/lustre/mdc/mdc_locks.c   |  9 +++----
 drivers/staging/lustre/lustre/mdc/mdc_reint.c   |  3 +--
 drivers/staging/lustre/lustre/mdc/mdc_request.c | 36 ++++++++++++-------------
 3 files changed, 23 insertions(+), 25 deletions(-)
drivers/staging/lustre/lustre/mdc/mdc_locks.c +4 -5
index 4d837d61be65..7f724e3c3f06 100644
@@ -136,11 +136,10 @@ int mdc_set_lock_data(struct obd_export *exp, __u64 *lockh, void *data,
 		struct inode *old_inode = lock->l_resource->lr_lvb_inode;
 
 		LASSERTF(old_inode->i_state & I_FREEING,
-			 "Found existing inode %p/%lu/%u state %lu in lock: "
-			 "setting data to %p/%lu/%u\n", old_inode,
-			 old_inode->i_ino, old_inode->i_generation,
-			 old_inode->i_state,
-			 new_inode, new_inode->i_ino, new_inode->i_generation);
+			 "Found existing inode %p/%lu/%u state %lu in lock: setting data to %p/%lu/%u\n",
+			 old_inode, old_inode->i_ino, old_inode->i_generation,
+			 old_inode->i_state, new_inode, new_inode->i_ino,
+			 new_inode->i_generation);
 	}
 	lock->l_resource->lr_lvb_inode = new_inode;
 	if (bits)
drivers/staging/lustre/lustre/mdc/mdc_reint.c +1 -2
index c40304bf0b62..6f78bffa9294 100644
@@ -158,8 +158,7 @@ int mdc_setattr(struct obd_export *exp, struct md_op_data *op_data,
 
 		*mod = obd_mod_alloc();
 		if (*mod == NULL) {
-			DEBUG_REQ(D_ERROR, req, "Can't allocate "
-				  "md_open_data");
+			DEBUG_REQ(D_ERROR, req, "Can't allocate md_open_data");
 		} else {
 			req->rq_replay = 1;
 			req->rq_cb_data = *mod;
drivers/staging/lustre/lustre/mdc/mdc_request.c +18 -18
index 57d903156917..6c691a4763b5 100644
@@ -517,14 +517,14 @@ int mdc_get_lustre_md(struct obd_export *exp, struct ptlrpc_request *req,
 		struct lov_mds_md *lmm;
 
 		if (!S_ISREG(md->body->mode)) {
-			CDEBUG(D_INFO, "OBD_MD_FLEASIZE set, should be a "
-			       "regular file, but is not\n");
+			CDEBUG(D_INFO,
+			       "OBD_MD_FLEASIZE set, should be a regular file, but is not\n");
 			GOTO(out, rc = -EPROTO);
 		}
 
 		if (md->body->eadatasize == 0) {
-			CDEBUG(D_INFO, "OBD_MD_FLEASIZE set, "
-			       "but eadatasize 0\n");
+			CDEBUG(D_INFO,
+			       "OBD_MD_FLEASIZE set, but eadatasize 0\n");
 			GOTO(out, rc = -EPROTO);
 		}
 		lmmsize = md->body->eadatasize;
@@ -537,8 +537,8 @@ int mdc_get_lustre_md(struct obd_export *exp, struct ptlrpc_request *req,
 			GOTO(out, rc);
 
 		if (rc < sizeof(*md->lsm)) {
-			CDEBUG(D_INFO, "lsm size too small: "
-			       "rc < sizeof (*md->lsm) (%d < %d)\n",
+			CDEBUG(D_INFO,
+			       "lsm size too small: rc < sizeof (*md->lsm) (%d < %d)\n",
 			       rc, (int)sizeof(*md->lsm));
 			GOTO(out, rc = -EPROTO);
 		}
@@ -548,14 +548,14 @@ int mdc_get_lustre_md(struct obd_export *exp, struct ptlrpc_request *req,
 		struct lov_mds_md *lmv;
 
 		if (!S_ISDIR(md->body->mode)) {
-			CDEBUG(D_INFO, "OBD_MD_FLDIREA set, should be a "
-			       "directory, but is not\n");
+			CDEBUG(D_INFO,
+			       "OBD_MD_FLDIREA set, should be a directory, but is not\n");
 			GOTO(out, rc = -EPROTO);
 		}
 
 		if (md->body->eadatasize == 0) {
-			CDEBUG(D_INFO, "OBD_MD_FLDIREA is set, "
-			       "but eadatasize 0\n");
+			CDEBUG(D_INFO,
+			       "OBD_MD_FLDIREA is set, but eadatasize 0\n");
 			return -EPROTO;
 		}
 		if (md->body->valid & OBD_MD_MEA) {
@@ -571,8 +571,8 @@ int mdc_get_lustre_md(struct obd_export *exp, struct ptlrpc_request *req,
 				GOTO(out, rc);
 
 			if (rc < sizeof(*md->mea)) {
-				CDEBUG(D_INFO, "size too small:  "
-				       "rc < sizeof(*md->mea) (%d < %d)\n",
+				CDEBUG(D_INFO,
+				       "size too small: rc < sizeof(*md->mea) (%d < %d)\n",
 					rc, (int)sizeof(*md->mea));
 				GOTO(out, rc = -EPROTO);
 			}
@@ -778,8 +778,8 @@ int mdc_set_open_replay_data(struct obd_export *exp,
 	rec->cr_old_handle.cookie = body->handle.cookie;
 	open_req->rq_replay_cb = mdc_replay_open;
 	if (!fid_is_sane(&body->fid1)) {
-		DEBUG_REQ(D_ERROR, open_req, "Saving replay request with "
-			  "insane fid");
+		DEBUG_REQ(D_ERROR, open_req,
+			  "Saving replay request with insane fid");
 		LBUG();
 	}
 
@@ -928,8 +928,8 @@ int mdc_close(struct obd_export *exp, struct md_op_data *op_data,
 
 		rc = lustre_msg_get_status(req->rq_repmsg);
 		if (lustre_msg_get_type(req->rq_repmsg) == PTL_RPC_MSG_ERR) {
-			DEBUG_REQ(D_ERROR, req, "type == PTL_RPC_MSG_ERR, err "
-				  "= %d", rc);
+			DEBUG_REQ(D_ERROR, req,
+				  "type == PTL_RPC_MSG_ERR, err = %d", rc);
 			if (rc > 0)
 				rc = -rc;
 		}
@@ -2055,8 +2055,8 @@ static int mdc_hsm_copytool_send(int len, void *val)
 		return -EPROTO;
 	}
 
-	CDEBUG(D_HSM, " Received message mg=%x t=%d m=%d l=%d actions=%d "
-	       "on %s\n",
+	CDEBUG(D_HSM,
+	       " Received message mg=%x t=%d m=%d l=%d actions=%d on %s\n",
 	       lh->kuc_magic, lh->kuc_transport, lh->kuc_msgtype,
 	       lh->kuc_msglen, hal->hal_count, hal->hal_fsname);
 
Signature · 1 line
1.9.3
#13 lore raw

PATCH 9/12 staging: lustre: Added space between type name and *

In reply to Srikrishan Malik

Fixes the following checkpatch error:

ERROR: "(foo*)" should be "(foo *)"

---
 drivers/staging/lustre/lustre/mdc/mdc_locks.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/lustre/lustre/mdc/mdc_locks.c +1 -1
index 7f724e3c3f06..c03d77c9c5b8 100644
@@ -218,7 +218,7 @@ int mdc_find_cbdata(struct obd_export *exp,
 	struct ldlm_res_id res_id;
 	int rc = 0;
 
-	fid_build_reg_res_name((struct lu_fid*)fid, &res_id);
+	fid_build_reg_res_name((struct lu_fid *)fid, &res_id);
 	rc = ldlm_resource_iterate(class_exp2obd(exp)->obd_namespace, &res_id,
 				   it, data);
 	if (rc == LDLM_ITER_STOP)
Signature · 1 line
1.9.3
#14 lore raw

PATCH 10/12 staging: lustre: Fix misplaced opening brace warnings

In reply to Srikrishan Malik

Fixes the following checkpatch error:

ERROR: that open brace { should be on the previous line

---
 drivers/staging/lustre/lustre/mdc/mdc_locks.c   | 12 ++++++------
 drivers/staging/lustre/lustre/mdc/mdc_reint.c   |  3 +--
 drivers/staging/lustre/lustre/mdc/mdc_request.c |  4 ++--
 3 files changed, 9 insertions(+), 10 deletions(-)
drivers/staging/lustre/lustre/mdc/mdc_locks.c +6 -6
index c03d77c9c5b8..09209171b50c 100644
@@ -785,12 +785,12 @@ int mdc_enqueue(struct obd_export *exp, struct ldlm_enqueue_info *einfo,
 	__u64		  flags, saved_flags = extra_lock_flags;
 	int		    rc;
 	struct ldlm_res_id res_id;
-	static const ldlm_policy_data_t lookup_policy =
-			    { .l_inodebits = { MDS_INODELOCK_LOOKUP } };
-	static const ldlm_policy_data_t update_policy =
-			    { .l_inodebits = { MDS_INODELOCK_UPDATE } };
-	static const ldlm_policy_data_t layout_policy =
-			    { .l_inodebits = { MDS_INODELOCK_LAYOUT } };
+	static const ldlm_policy_data_t lookup_policy = {
+				.l_inodebits = { MDS_INODELOCK_LOOKUP } };
+	static const ldlm_policy_data_t update_policy = {
+				.l_inodebits = { MDS_INODELOCK_UPDATE } };
+	static const ldlm_policy_data_t layout_policy = {
+				.l_inodebits = { MDS_INODELOCK_LAYOUT } };
 	static const ldlm_policy_data_t getxattr_policy = {
 			      .l_inodebits = { MDS_INODELOCK_XATTR } };
 	ldlm_policy_data_t const *policy = &lookup_policy;
drivers/staging/lustre/lustre/mdc/mdc_reint.c +1 -2
index 6f78bffa9294..c551d3b843ab 100644
@@ -152,8 +152,7 @@ int mdc_setattr(struct obd_export *exp, struct md_op_data *op_data,
 
 	ptlrpc_request_set_replen(req);
 	if (mod && (op_data->op_flags & MF_EPOCH_OPEN) &&
-	    req->rq_import->imp_replayable)
-	{
+	    req->rq_import->imp_replayable) {
 		LASSERT(*mod == NULL);
 
 		*mod = obd_mod_alloc();
drivers/staging/lustre/lustre/mdc/mdc_request.c +2 -2
index 6c691a4763b5..205eeade9fdd 100644
@@ -1794,8 +1794,8 @@ static int mdc_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
 		GOTO(out, rc);
 	case OBD_IOC_CHANGELOG_CLEAR: {
 		struct ioc_changelog *icc = karg;
-		struct changelog_setinfo cs =
-			{.cs_recno = icc->icc_recno, .cs_id = icc->icc_id};
+		struct changelog_setinfo cs = {
+			.cs_recno = icc->icc_recno, .cs_id = icc->icc_id};
 		rc = obd_set_info_async(NULL, exp, strlen(KEY_CHANGELOG_CLEAR),
 					KEY_CHANGELOG_CLEAR, sizeof(cs), &cs,
 					NULL);
Signature · 1 line
1.9.3
#15 lore raw

Re: [PATCH 10/12] staging: lustre: Fix misplaced opening brace warnings

Quoted 13 lines · Srikrishan Malik
drivers/staging/lustre/lustre/mdc/mdc_locks.c +0 -5
index c03d77c9c5b8..09209171b50c 100644
@@ -785,12 +785,12 @@ int mdc_enqueue(struct obd_export *exp, struct ldlm_enqueue_info *einfo,
 	__u64		  flags, saved_flags = extra_lock_flags;
 	int		    rc;
 	struct ldlm_res_id res_id;
-	static const ldlm_policy_data_t lookup_policy =
-			    { .l_inodebits = { MDS_INODELOCK_LOOKUP } };
-	static const ldlm_policy_data_t update_policy =
-			    { .l_inodebits = { MDS_INODELOCK_UPDATE } };
-	static const ldlm_policy_data_t layout_policy =

drivers/staging/lustre/lustre/mdc/mdc_locks.c int mdc_enqueue(struct obd_export *exp, struct ldlm_enqueue_info *einfo, · line 796

Quoted 10 lines
drivers/staging/lustre/lustre/mdc/mdc_locks.c +6 -1
-			    { .l_inodebits = { MDS_INODELOCK_LAYOUT } };
+	static const ldlm_policy_data_t lookup_policy = {
+				.l_inodebits = { MDS_INODELOCK_LOOKUP } };
+	static const ldlm_policy_data_t update_policy = {
+				.l_inodebits = { MDS_INODELOCK_UPDATE } };
+	static const ldlm_policy_data_t layout_policy = {
+				.l_inodebits = { MDS_INODELOCK_LAYOUT } };
 	static const ldlm_policy_data_t getxattr_policy = {
 			      .l_inodebits = { MDS_INODELOCK_XATTR } };
 	ldlm_policy_data_t const *policy = &lookup_policy;

That looks silly before and after. Everything is indented in a funny way.

regards,
dan carpenter

#16 lore raw

Re: [PATCH 10/12] staging: lustre: Fix misplaced opening brace warnings

Quoted 19 lines · Dan Carpenter
Quoted 18 lines · Srikrishan Malik
drivers/staging/lustre/lustre/mdc/mdc_locks.c +4 -6
index c03d77c9c5b8..09209171b50c 100644
@@ -785,12 +785,12 @@ int mdc_enqueue(struct obd_export *exp, struct ldlm_enqueue_info *einfo,
 	__u64		  flags, saved_flags = extra_lock_flags;
 	int		    rc;
 	struct ldlm_res_id res_id;
-	static const ldlm_policy_data_t lookup_policy =
-			    { .l_inodebits = { MDS_INODELOCK_LOOKUP } };
-	static const ldlm_policy_data_t update_policy =
-			    { .l_inodebits = { MDS_INODELOCK_UPDATE } };
-	static const ldlm_policy_data_t layout_policy =
-			    { .l_inodebits = { MDS_INODELOCK_LAYOUT } };
+	static const ldlm_policy_data_t lookup_policy = {
+				.l_inodebits = { MDS_INODELOCK_LOOKUP } };
+	static const ldlm_policy_data_t update_policy = {
+				.l_inodebits = { MDS_INODELOCK_UPDATE } };
Quoted 8 lines

drivers/staging/lustre/lustre/mdc/mdc_locks.c int mdc_enqueue(struct obd_export *exp, struct ldlm_enqueue_info *einfo, · line 796

Quoted 5 lines
drivers/staging/lustre/lustre/mdc/mdc_locks.c +2 -0
+	static const ldlm_policy_data_t layout_policy = {
+				.l_inodebits = { MDS_INODELOCK_LAYOUT } };
 	static const ldlm_policy_data_t getxattr_policy = {
 			      .l_inodebits = { MDS_INODELOCK_XATTR } };
 	ldlm_policy_data_t const *policy = &lookup_policy;

That looks silly before and after. Everything is indented in a funny way.

Is this better:

	static const ldlm_policy_data_t lookup_policy = {                       
				.l_inodebits = { MDS_INODELOCK_LOOKUP }         
	};
Quoted 3 lines

regards,
dan carpenter

#17 lore raw

Re: [PATCH 10/12] staging: lustre: Fix misplaced opening brace warnings

Quoted 10 lines · Srikrishan Malik
Quoted 2 lines · Dan Carpenter

That looks silly before and after. Everything is indented in a funny way.

Is this better:

	static const ldlm_policy_data_t lookup_policy = {
				.l_inodebits = { MDS_INODELOCK_LOOKUP }
	};

That is indented too far.

Honestly, I think it looks best on one line but in terms of real life we can't ignore checkpatch warnings because eventually someone else will try to "fix" it to not be on one line.

This function has the silly thing where the types are in one column and the variables are in another. But then over time inevitably we add more variables and nothing is lined up any more.

I think it's best to move this const variable block to the very front of the list.

req doesn't need to be initialized.

rc is normally the last variable declared.

lvb_type should be initialized to LVB_T_NONE instead of zero.

__u64 should be u64.

All those changes could be done as one patch titled, "cleanup variable declarations in mdc_enqueue()". There may be other cleanups you could do as well. Look hard.

regards,
dan carpenter

#18 lore raw

Re: [PATCH 10/12] staging: lustre: Fix misplaced opening brace warnings

Quoted 29 lines · Dan Carpenter
Quoted 10 lines · Srikrishan Malik
Quoted 2 lines · Dan Carpenter

That looks silly before and after. Everything is indented in a funny way.

Is this better:

	static const ldlm_policy_data_t lookup_policy = {
				.l_inodebits = { MDS_INODELOCK_LOOKUP }
	};

That is indented too far.

Honestly, I think it looks best on one line but in terms of real life we can't ignore checkpatch warnings because eventually someone else will try to "fix" it to not be on one line.

This function has the silly thing where the types are in one column and the variables are in another. But then over time inevitably we add more variables and nothing is lined up any more.

I think it's best to move this const variable block to the very front of the list.

req doesn't need to be initialized.

rc is normally the last variable declared.

Quoted 7 lines

lvb_type should be initialized to LVB_T_NONE instead of zero.

__u64 should be u64.

All those changes could be done as one patch titled, "cleanup variable declarations in mdc_enqueue()". There may be other cleanups you could do as well. Look hard.

I think it looks odd to mix named and unnamed
initializers for the typedef and its members.

ldlm_policy_data_t is a union and it could be
explicit instead of a typedef.

Perhaps:

	static const union ldlm_policy_data lookup_policy = {
		.l_inodebits = {
			.bits = MDS_INODELOCK_LOOKUP,
		},
	};

or maybe use another DECLARE_<foo> macro indirection.

#19 lore raw

Re: [PATCH 10/12] staging: lustre: Fix misplaced opening brace warnings

Quoted 44 lines · Joe Perches
Quoted 29 lines · Dan Carpenter
Quoted 10 lines · Srikrishan Malik
Quoted 2 lines · Dan Carpenter

That looks silly before and after. Everything is indented in a funny way.

Is this better:

	static const ldlm_policy_data_t lookup_policy = {
				.l_inodebits = { MDS_INODELOCK_LOOKUP }
	};

That is indented too far.

Honestly, I think it looks best on one line but in terms of real life we can't ignore checkpatch warnings because eventually someone else will try to "fix" it to not be on one line.

This function has the silly thing where the types are in one column and the variables are in another. But then over time inevitably we add more variables and nothing is lined up any more.

I think it's best to move this const variable block to the very front of the list.

req doesn't need to be initialized.

rc is normally the last variable declared.

Quoted 7 lines

lvb_type should be initialized to LVB_T_NONE instead of zero.

__u64 should be u64.

All those changes could be done as one patch titled, "cleanup variable declarations in mdc_enqueue()". There may be other cleanups you could do as well. Look hard.

I think it looks odd to mix named and unnamed
initializers for the typedef and its members.

ldlm_policy_data_t is a union and it could be
explicit instead of a typedef.

Quoted 9 lines

Perhaps:

	static const union ldlm_policy_data lookup_policy = {
		.l_inodebits = {
			.bits = MDS_INODELOCK_LOOKUP,
		},
	};

or maybe use another DECLARE_<foo> macro indirection.

This patch set is aimed at removing checkpatch issues from files in lustre/lustre/mdc.

Is it ok if I just fix those in this set and post another patch set to take care of other issues identified in review?

- removing typedef for ldlm_policy_data_t will touch many other files/dirs which were not initially targeted for this patch set.
- There can be a separate patch to remove __u64.

#20 lore raw

Re: [PATCH 10/12] staging: lustre: Fix misplaced opening brace warnings

Quoted 14 lines · Srikrishan Malik
Quoted 13 lines · Joe Perches
Quoted 12 lines · Dan Carpenter
Quoted 10 lines · Srikrishan Malik
Quoted 2 lines · Dan Carpenter

That looks silly before and after. Everything is indented in a funny way.

Is this better:

	static const ldlm_policy_data_t lookup_policy = {
				.l_inodebits = { MDS_INODELOCK_LOOKUP }
	};
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

That is indented too far.

Honestly, I think it looks best on one line but in terms of real life we can't ignore checkpatch warnings because eventually someone else will try to "fix" it to not be on one line.

[]

Quoted 13 lines
Quoted 13 lines

I think it looks odd to mix named and unnamed
initializers for the typedef and its members.

ldlm_policy_data_t is a union and it could be
explicit instead of a typedef.

Perhaps:

	static const union ldlm_policy_data lookup_policy = {
		.l_inodebits = {
			.bits = MDS_INODELOCK_LOOKUP,
		},
	};
Quoted 5 lines
Quoted 2 lines

or maybe use another DECLARE_<foo> macro indirection.

This patch set is aimed at removing checkpatch issues from files in lustre/lustre/mdc.

I think eliminating checkpatch identified issues should not be the primary goal but a secondary one to the overall goal of code style uniformity.

Julia Lawall and Himangi Saraogi from coccinelle fame have created a "detypedef" script that is useful for structs, perhaps you could extend it for unions and run it over this lustre code.

For instance:
https://lkml.org/lkml/2014/8/9/104

Quoted 2 lines

Is it ok if I just fix those in this set and post another patch set to take care of other issues identified in review?

Up to you.

#21 lore raw

Re: [PATCH 10/12] staging: lustre: Fix misplaced opening brace warnings

Quoted 44 lines · Joe Perches
Quoted 14 lines · Srikrishan Malik
Quoted 13 lines · Joe Perches
Quoted 12 lines · Dan Carpenter
Quoted 10 lines · Srikrishan Malik
Quoted 2 lines · Dan Carpenter

That looks silly before and after. Everything is indented in a funny way.

Is this better:

	static const ldlm_policy_data_t lookup_policy = {
				.l_inodebits = { MDS_INODELOCK_LOOKUP }
	};
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

That is indented too far.

Honestly, I think it looks best on one line but in terms of real life we can't ignore checkpatch warnings because eventually someone else will try to "fix" it to not be on one line.

[]

Quoted 13 lines
Quoted 13 lines

I think it looks odd to mix named and unnamed
initializers for the typedef and its members.

ldlm_policy_data_t is a union and it could be
explicit instead of a typedef.

Perhaps:

	static const union ldlm_policy_data lookup_policy = {
		.l_inodebits = {
			.bits = MDS_INODELOCK_LOOKUP,
		},
	};
Quoted 5 lines
Quoted 2 lines

or maybe use another DECLARE_<foo> macro indirection.

This patch set is aimed at removing checkpatch issues from files in lustre/lustre/mdc.

I think eliminating checkpatch identified issues should not be the primary goal but a secondary one to the overall goal of code style uniformity.

Quoted 7 lines

Julia Lawall and Himangi Saraogi from coccinelle fame have created a "detypedef" script that is useful for structs, perhaps you could extend it for unions and run it over this lustre code.

For instance:
https://lkml.org/lkml/2014/8/9/104

The complete semantic patch is below. It is in two parts: first for the case where there is a name for the struct and the second for the case where there is not. The code could be extended to automatically drop the _t's that are commonly put on typedefs.

julia

@tn@
identifier i;
type td;
@@

-typedef
struct i { ... }
-td
;

@@
type tn.td;
identifier tn.i;
@@

-td
+ struct i

// ---------------------------------------------------------------------- // No name case

@tn1@
type td;
@@

typedef struct { ... } td;

@script:python tf@
td << tn1.td;
tdres;
@@

coccinelle.tdres = td

@@
type tn1.td;
identifier tf.tdres;
@@

-typedef
struct
+ tdres
{ ... }
-td
;

@@
type tn1.td;
identifier tf.tdres;
@@

-td
+ struct tdres

#22 lore raw

Re: [PATCH 10/12] staging: lustre: Fix misplaced opening brace warnings

In reply to Srikrishan Malik
Quoted 5 lines · Srikrishan Malik

This patch set is aimed at removing checkpatch issues from files in lustre/lustre/mdc.

Is it ok if I just fix those in this set and post another patch set to take care of other issues identified in review?

checkpatch fixes are worthless if they don't make the code better for human readers.

Quoted 3 lines

- removing typedef for ldlm_policy_data_t will touch many other files/dirs which were not initially targeted for this patch set.

Yeah. You're right. This should be done in a separate patch because it doesn't completely fall under the "cleanup variable declarations in mdc_enqueue()" header.

Quoted 1 line

- There can be a separate patch to remove __u64.

It's all part of the same thing "variable declarations in that function."

regards,
dan carpenter

#23 lore raw

PATCH 11/12 staging: lustre: move else on the same line as closing brace

In reply to Srikrishan Malik

Fix the following checkpatch error:

ERROR: else should follow close brace '}'

---
 drivers/staging/lustre/lustre/mdc/mdc_request.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/lustre/lustre/mdc/mdc_request.c +1 -2
index 205eeade9fdd..7ccee06fd447 100644
@@ -587,8 +587,7 @@ int mdc_get_lustre_md(struct obd_export *exp, struct ptlrpc_request *req,
 						lustre_swab_mdt_remote_perm);
 		if (!md->remote_perm)
 			GOTO(out, rc = -EPROTO);
-	}
-	else if (md->body->valid & OBD_MD_FLACL) {
+	} else if (md->body->valid & OBD_MD_FLACL) {
 		/* for ACL, it's possible that FLACL is set but aclsize is zero.
 		 * only when aclsize != 0 there's an actual segment for ACL
 		 * in reply buffer.
Signature · 1 line
1.9.3
#24 lore raw

PATCH 12/12 staging: lustre: remove parentheses usage with return

In reply to Srikrishan Malik

Fix the following checkpatch error:

ERROR: return is not a function, parentheses are not required

---
 drivers/staging/lustre/lustre/mdc/mdc_request.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/lustre/lustre/mdc/mdc_request.c +1 -1
index 7ccee06fd447..b67574218b69 100644
@@ -2585,7 +2585,7 @@ static int mdc_process_config(struct obd_device *obd, obd_count len, void *buf)
 			rc = 0;
 		break;
 	}
-	return(rc);
+	return rc;
 }
 
 
Signature · 1 line
1.9.3
#26 lore raw
Quoted 8 lines · Greg KH
Quoted 5 lines · Srikrishan Malik

Fixes following checkpatch warning:

WARNING: space prohibited between function name and open parenthesis '('

Can you redo this whole series, based on the comments you have recieved?

Have been busy due to festivals.
I am planning to re-submit soon.

Quoted 4 lines

thanks,

greg k-h