All of lore.kernel.org
 help / color / mirror / Atom feed
* [lustre-devel] [PATCH 00/11] lustre: cleanup most check patch issues
@ 2019-07-22  1:52 James Simmons
  2019-07-22  1:52 ` [lustre-devel] [PATCH 01/11] lustre: ptlrpc: checkpatch cleanup James Simmons
                   ` (10 more replies)
  0 siblings, 11 replies; 19+ messages in thread
From: James Simmons @ 2019-07-22  1:52 UTC (permalink / raw)
  To: lustre-devel

Another run at fs/lustre to reduce the check patch issue to a small
number that are mostly over 80 characters per line issues. This
makes Lustre appear to be real Linux kernel code :-) No code changes
in this patch series. This is again the main lustre branch of Neil
Brown's kernel tree.

James Simmons (11):
  lustre: ptlrpc: checkpatch cleanup
  lustre: llite: checkpatch cleanup
  lustre: fid: checkpatch cleanup
  lustre: mgc: checkpatch cleanup
  lustre: lmv: checkpatch cleanup
  lustre: mdc: checkpatch cleanup
  lustre: osc: checkpatch cleanup
  lustre: lov: checkpatch cleanup
  lustre: obdclass: checkpatch cleanup
  lustre: ldlm: checkpatch cleanup
  lustre: internal headers checkpatch cleanup

 fs/lustre/fid/fid_request.c         |  1 -
 fs/lustre/fid/lproc_fid.c           |  3 +-
 fs/lustre/fld/fld_internal.h        |  5 +--
 fs/lustre/include/cl_object.h       | 13 +++----
 fs/lustre/include/lprocfs_status.h  | 11 +++---
 fs/lustre/include/lu_object.h       | 26 +++++++-------
 fs/lustre/include/lustre_acl.h      |  4 +--
 fs/lustre/include/lustre_dlm.h      | 53 +++++++++++++++++-----------
 fs/lustre/include/seq_range.h       |  8 ++---
 fs/lustre/ldlm/ldlm_extent.c        |  1 -
 fs/lustre/ldlm/ldlm_flock.c         | 15 ++++----
 fs/lustre/ldlm/ldlm_internal.h      |  5 +--
 fs/lustre/ldlm/ldlm_lib.c           |  4 +--
 fs/lustre/ldlm/ldlm_lock.c          |  8 ++---
 fs/lustre/ldlm/ldlm_lockd.c         | 22 +++++++-----
 fs/lustre/ldlm/ldlm_pool.c          |  3 +-
 fs/lustre/ldlm/ldlm_request.c       | 18 +++++-----
 fs/lustre/llite/dir.c               | 18 +++++-----
 fs/lustre/llite/file.c              | 24 ++++++-------
 fs/lustre/llite/llite_internal.h    |  8 +++--
 fs/lustre/llite/llite_lib.c         | 26 +++++++-------
 fs/lustre/llite/llite_nfs.c         |  3 +-
 fs/lustre/llite/lproc_llite.c       |  8 +++--
 fs/lustre/llite/namei.c             | 15 +++++---
 fs/lustre/llite/rw26.c              |  3 +-
 fs/lustre/llite/statahead.c         | 23 ++++++++-----
 fs/lustre/llite/super25.c           |  3 +-
 fs/lustre/llite/vvp_dev.c           |  3 +-
 fs/lustre/llite/vvp_io.c            |  2 +-
 fs/lustre/lmv/lmv_intent.c          |  9 +++--
 fs/lustre/lmv/lmv_obd.c             | 22 +++++++-----
 fs/lustre/lov/lov_io.c              |  2 +-
 fs/lustre/lov/lov_lock.c            |  4 +--
 fs/lustre/lov/lov_merge.c           |  6 ++--
 fs/lustre/lov/lov_obd.c             |  6 ++--
 fs/lustre/lov/lov_object.c          |  6 ++--
 fs/lustre/lov/lov_pool.c            | 24 +++++++++----
 fs/lustre/lov/lov_request.c         |  3 +-
 fs/lustre/mdc/mdc_changelog.c       | 15 +++++---
 fs/lustre/mdc/mdc_lib.c             | 15 +++++---
 fs/lustre/mdc/mdc_locks.c           |  2 +-
 fs/lustre/mdc/mdc_request.c         | 16 +++++----
 fs/lustre/mgc/mgc_request.c         | 17 +++++----
 fs/lustre/obdclass/cl_io.c          | 16 ++++++---
 fs/lustre/obdclass/cl_lock.c        |  8 +++--
 fs/lustre/obdclass/cl_object.c      | 12 +++----
 fs/lustre/obdclass/cl_page.c        |  9 ++---
 fs/lustre/obdclass/class_obd.c      |  3 +-
 fs/lustre/obdclass/genops.c         |  9 +++--
 fs/lustre/obdclass/llog.c           |  3 +-
 fs/lustre/obdclass/llog_obd.c       |  8 ++---
 fs/lustre/obdclass/llog_swab.c      |  6 ++--
 fs/lustre/obdclass/lprocfs_status.c |  4 +--
 fs/lustre/obdclass/lu_object.c      |  3 +-
 fs/lustre/obdclass/obd_config.c     | 12 ++++---
 fs/lustre/obdclass/obd_mount.c      |  3 +-
 fs/lustre/obdecho/debug.c           | 12 ++++---
 fs/lustre/osc/lproc_osc.c           |  7 ++--
 fs/lustre/osc/osc_cache.c           | 15 +++-----
 fs/lustre/osc/osc_internal.h        |  6 ++--
 fs/lustre/osc/osc_lock.c            |  6 ++--
 fs/lustre/osc/osc_object.c          |  6 ++--
 fs/lustre/osc/osc_page.c            |  3 +-
 fs/lustre/osc/osc_quota.c           | 20 ++++++-----
 fs/lustre/osc/osc_request.c         | 38 +++++++++-----------
 fs/lustre/ptlrpc/client.c           | 67 ++++++++++++++++++++++-------------
 fs/lustre/ptlrpc/connection.c       |  2 +-
 fs/lustre/ptlrpc/events.c           |  5 +--
 fs/lustre/ptlrpc/import.c           | 69 +++++++++++++++++++++----------------
 fs/lustre/ptlrpc/layout.c           | 19 +++++-----
 fs/lustre/ptlrpc/llog_client.c      |  3 +-
 fs/lustre/ptlrpc/lproc_ptlrpc.c     | 21 +++++++----
 fs/lustre/ptlrpc/niobuf.c           | 12 ++++---
 fs/lustre/ptlrpc/nrs.c              |  2 +-
 fs/lustre/ptlrpc/pack_generic.c     |  6 ++--
 fs/lustre/ptlrpc/pinger.c           |  6 ++--
 fs/lustre/ptlrpc/ptlrpc_internal.h  |  5 ++-
 fs/lustre/ptlrpc/ptlrpc_module.c    |  6 ++--
 fs/lustre/ptlrpc/ptlrpcd.c          |  3 +-
 fs/lustre/ptlrpc/recover.c          |  3 +-
 fs/lustre/ptlrpc/sec.c              | 21 ++++++-----
 fs/lustre/ptlrpc/sec_config.c       | 15 +++++---
 fs/lustre/ptlrpc/sec_lproc.c        |  3 +-
 fs/lustre/ptlrpc/service.c          | 40 ++++++++++++---------
 84 files changed, 588 insertions(+), 412 deletions(-)

-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [lustre-devel] [PATCH 01/11] lustre: ptlrpc: checkpatch cleanup
  2019-07-22  1:52 [lustre-devel] [PATCH 00/11] lustre: cleanup most check patch issues James Simmons
@ 2019-07-22  1:52 ` James Simmons
  2019-07-22  1:52 ` [lustre-devel] [PATCH 02/11] lustre: llite: " James Simmons
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 19+ messages in thread
From: James Simmons @ 2019-07-22  1:52 UTC (permalink / raw)
  To: lustre-devel

Many checkpatch errors exist in the ptlrpc layer. This address
a good chuck of them. Other are left since future patches will
cleanup those areas. Others will need more code rework so this
patch handles the simple cases. This is a good step forward
toward proper kernel code style compliance.

Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/ptlrpc/client.c          | 67 +++++++++++++++++++++++-------------
 fs/lustre/ptlrpc/connection.c      |  2 +-
 fs/lustre/ptlrpc/events.c          |  5 +--
 fs/lustre/ptlrpc/import.c          | 69 +++++++++++++++++++++-----------------
 fs/lustre/ptlrpc/layout.c          | 19 ++++++-----
 fs/lustre/ptlrpc/llog_client.c     |  3 +-
 fs/lustre/ptlrpc/lproc_ptlrpc.c    | 21 ++++++++----
 fs/lustre/ptlrpc/niobuf.c          | 12 ++++---
 fs/lustre/ptlrpc/nrs.c             |  2 +-
 fs/lustre/ptlrpc/pack_generic.c    |  6 ++--
 fs/lustre/ptlrpc/pinger.c          |  6 ++--
 fs/lustre/ptlrpc/ptlrpc_internal.h |  5 ++-
 fs/lustre/ptlrpc/ptlrpc_module.c   |  6 ++--
 fs/lustre/ptlrpc/ptlrpcd.c         |  3 +-
 fs/lustre/ptlrpc/recover.c         |  3 +-
 fs/lustre/ptlrpc/sec.c             | 21 +++++++-----
 fs/lustre/ptlrpc/sec_config.c      | 15 ++++++---
 fs/lustre/ptlrpc/sec_lproc.c       |  3 +-
 fs/lustre/ptlrpc/service.c         | 40 +++++++++++++---------
 19 files changed, 188 insertions(+), 120 deletions(-)

diff --git a/fs/lustre/ptlrpc/client.c b/fs/lustre/ptlrpc/client.c
index da1ccd8..364c61f 100644
--- a/fs/lustre/ptlrpc/client.c
+++ b/fs/lustre/ptlrpc/client.c
@@ -204,7 +204,8 @@ struct ptlrpc_bulk_desc *ptlrpc_prep_bulk_imp(struct ptlrpc_request *req,
 EXPORT_SYMBOL(ptlrpc_prep_bulk_imp);
 
 void __ptlrpc_prep_bulk_page(struct ptlrpc_bulk_desc *desc,
-			     struct page *page, int pageoffset, int len, int pin)
+			     struct page *page, int pageoffset, int len,
+			     int pin)
 {
 	struct bio_vec *kiov;
 
@@ -342,9 +343,11 @@ static void ptlrpc_at_adj_service(struct ptlrpc_request *req,
 	 */
 	oldse = at_measured(&at->iat_service_estimate[idx], serv_est);
 	if (oldse != 0)
-		CDEBUG(D_ADAPTTO, "The RPC service estimate for %s ptl %d has changed from %d to %d\n",
-		       req->rq_import->imp_obd->obd_name, req->rq_request_portal,
-		       oldse, at_get(&at->iat_service_estimate[idx]));
+		CDEBUG(D_ADAPTTO,
+		       "The RPC service estimate for %s ptl %d has changed from %d to %d\n",
+		       req->rq_import->imp_obd->obd_name,
+		       req->rq_request_portal, oldse,
+		       at_get(&at->iat_service_estimate[idx]));
 }
 
 /* Expected network latency per remote node (secs) */
@@ -386,10 +389,10 @@ void ptlrpc_at_adj_net_latency(struct ptlrpc_request *req,
 
 	oldnl = at_measured(&at->iat_net_latency, nl);
 	if (oldnl != 0)
-		CDEBUG(D_ADAPTTO, "The network latency for %s (nid %s) has changed from %d to %d\n",
+		CDEBUG(D_ADAPTTO,
+		       "The network latency for %s (nid %s) has changed from %d to %d\n",
 		       req->rq_import->imp_obd->obd_name,
-		       obd_uuid2str(
-			       &req->rq_import->imp_connection->c_remote_uuid),
+		       obd_uuid2str(&req->rq_import->imp_connection->c_remote_uuid),
 		       oldnl, at_get(&at->iat_net_latency));
 }
 
@@ -513,7 +516,8 @@ void ptlrpc_free_rq_pool(struct ptlrpc_request_pool *pool)
 	struct ptlrpc_request *req;
 
 	while ((req = list_first_entry_or_null(&pool->prp_req_list,
-					       struct ptlrpc_request, rq_list))) {
+					       struct ptlrpc_request,
+					       rq_list))) {
 		list_del(&req->rq_list);
 		LASSERT(req->rq_reqbuf);
 		LASSERT(req->rq_reqbuf_len == pool->prp_rq_size);
@@ -665,7 +669,8 @@ void ptlrpc_add_unreplied(struct ptlrpc_request *req)
 	LASSERT(list_empty(&req->rq_unreplied_list));
 
 	/* unreplied list is sorted by xid in ascending order */
-	list_for_each_entry_reverse(iter, &imp->imp_unreplied_list, rq_unreplied_list) {
+	list_for_each_entry_reverse(iter, &imp->imp_unreplied_list,
+				    rq_unreplied_list) {
 		LASSERT(req->rq_xid != iter->rq_xid);
 		if (req->rq_xid < iter->rq_xid)
 			continue;
@@ -1136,7 +1141,9 @@ static int ptlrpc_import_delay_req(struct obd_import *imp,
 			  D_HA : D_ERROR, req, "IMP_CLOSED ");
 		*status = -EIO;
 	} else if (ptlrpc_send_limit_expired(req)) {
-		/* probably doesn't need to be a D_ERROR after initial testing */
+		/* probably doesn't need to be a D_ERROR after initial
+		 * testing
+		 */
 		DEBUG_REQ(D_HA, req, "send limit expired ");
 		*status = -ETIMEDOUT;
 	} else if (req->rq_send_state == LUSTRE_IMP_CONNECTING &&
@@ -1230,7 +1237,8 @@ static int ptlrpc_check_status(struct ptlrpc_request *req)
 		/* -EAGAIN is normal when using POSIX flocks */
 		if (ptlrpc_console_allow(req) &&
 		    !(opc == LDLM_ENQUEUE && err == -EAGAIN))
-			LCONSOLE_ERROR_MSG(0x011, "%s: operation %s to node %s failed: rc = %d\n",
+			LCONSOLE_ERROR_MSG(0x011,
+					   "%s: operation %s to node %s failed: rc = %d\n",
 					   imp->imp_obd->obd_name,
 					   ll_opcode2str(opc),
 					   libcfs_nid2str(nid), err);
@@ -1306,7 +1314,8 @@ static int after_reply(struct ptlrpc_request *req)
 
 	if (req->rq_reply_truncated) {
 		if (ptlrpc_no_resend(req)) {
-			DEBUG_REQ(D_ERROR, req, "reply buffer overflow, expected: %d, actual size: %d",
+			DEBUG_REQ(D_ERROR, req,
+				  "reply buffer overflow, expected: %d, actual size: %d",
 				  req->rq_nob_received, req->rq_repbuf_len);
 			return -EOVERFLOW;
 		}
@@ -1520,7 +1529,8 @@ static int ptlrpc_send_new_req(struct ptlrpc_request *req)
 		req->rq_waiting = 1;
 		spin_unlock(&req->rq_lock);
 
-		DEBUG_REQ(D_HA, req, "req from PID %d waiting for recovery: (%s != %s)",
+		DEBUG_REQ(D_HA, req,
+			  "req from PID %d waiting for recovery: (%s != %s)",
 			  lustre_msg_get_status(req->rq_reqmsg),
 			  ptlrpc_import_state_name(req->rq_send_state),
 			  ptlrpc_import_state_name(imp->imp_state));
@@ -1574,7 +1584,8 @@ static int ptlrpc_send_new_req(struct ptlrpc_request *req)
 		return 0;
 	}
 
-	CDEBUG(D_RPCTRACE, "Sending RPC pname:cluuid:pid:xid:nid:opc %s:%s:%d:%llu:%s:%d\n",
+	CDEBUG(D_RPCTRACE,
+	       "Sending RPC pname:cluuid:pid:xid:nid:opc %s:%s:%d:%llu:%s:%d\n",
 	       current->comm,
 	       imp->imp_obd->obd_uuid.uuid,
 	       lustre_msg_get_status(req->rq_reqmsg), req->rq_xid,
@@ -1837,7 +1848,9 @@ int ptlrpc_check_set(const struct lu_env *env, struct ptlrpc_request_set *set)
 				spin_unlock(&req->rq_lock);
 
 				if (req->rq_timedout || req->rq_resend) {
-					/* This is re-sending anyway, let's mark req as resend. */
+					/* This is re-sending anyway,
+					 * let's mark req as resend.
+					 */
 					spin_lock(&req->rq_lock);
 					req->rq_resend = 1;
 					spin_unlock(&req->rq_lock);
@@ -2158,10 +2171,9 @@ void ptlrpc_expired_set(struct ptlrpc_request_set *set)
 static void ptlrpc_interrupted_set(struct ptlrpc_request_set *set)
 {
 	struct ptlrpc_request *req;
-	CDEBUG(D_RPCTRACE, "INTERRUPTED SET %p\n", set);
 
+	CDEBUG(D_RPCTRACE, "INTERRUPTED SET %p\n", set);
 	list_for_each_entry(req, &set->set_requests, rq_set_chain) {
-
 		if (req->rq_phase != RQ_PHASE_RPC &&
 		    req->rq_phase != RQ_PHASE_UNREG_RPC)
 			continue;
@@ -2260,8 +2272,9 @@ int ptlrpc_set_wait(struct ptlrpc_request_set *set)
 			} else if (rc < 0) {
 				rc = -EINTR;
 				ptlrpc_interrupted_set(set);
-			} else
+			} else {
 				rc = 0;
+			}
 		} else {
 			/*
 			 * At least one request is in flight, so no
@@ -2283,8 +2296,9 @@ int ptlrpc_set_wait(struct ptlrpc_request_set *set)
 				 */
 				if (l_fatal_signal_pending(current))
 					ptlrpc_interrupted_set(set);
-			} else
+			} else {
 				rc = 0;
+			}
 		}
 
 		LASSERT(rc == 0 || rc == -EINTR || rc == -ETIMEDOUT);
@@ -2299,7 +2313,8 @@ int ptlrpc_set_wait(struct ptlrpc_request_set *set)
 		 * the error cases -eeb.
 		 */
 		if (rc == 0 && atomic_read(&set->set_remaining) == 0) {
-			list_for_each_entry(req, &set->set_requests, rq_set_chain) {
+			list_for_each_entry(req, &set->set_requests,
+					    rq_set_chain) {
 				spin_lock(&req->rq_lock);
 				req->rq_invalid_rqset = 1;
 				spin_unlock(&req->rq_lock);
@@ -2513,7 +2528,7 @@ static int ptlrpc_unregister_reply(struct ptlrpc_request *request, int async)
 		return 0;
 
 	/*
-	 * We have to wait_event_idle_timeout() whatever the result, to give liblustre
+	 * We have to wait_event_idle_timeout() whatever the result, to get
 	 * a chance to run reply_in_callback(), and to make sure we've
 	 * unlinked before returning a req to the pool.
 	 */
@@ -2528,6 +2543,7 @@ static int ptlrpc_unregister_reply(struct ptlrpc_request *request, int async)
 		 * timeout lets us CWARN for visibility of sluggish NALs
 		 */
 		int cnt = 0;
+
 		while (cnt < LONG_UNLINK &&
 		       (rc = wait_event_idle_timeout(*wq,
 						     !ptlrpc_client_recv_or_unlink(request),
@@ -2716,6 +2732,7 @@ void ptlrpc_retain_replayable_request(struct ptlrpc_request *req,
 				      struct obd_import *imp)
 {
 	struct ptlrpc_request *iter;
+
 	assert_spin_locked(&imp->imp_lock);
 
 	if (req->rq_transno == 0) {
@@ -2742,7 +2759,8 @@ void ptlrpc_retain_replayable_request(struct ptlrpc_request *req,
 	LASSERT(imp->imp_replayable);
 	/* Balanced in ptlrpc_free_committed, usually. */
 	ptlrpc_request_addref(req);
-	list_for_each_entry_reverse(iter, &imp->imp_replay_list, rq_replay_list) {
+	list_for_each_entry_reverse(iter, &imp->imp_replay_list,
+				    rq_replay_list) {
 		/*
 		 * We may have duplicate transnos if we create and then
 		 * open a file, or for closes retained if to match creating
@@ -3110,7 +3128,8 @@ void ptlrpc_set_bulk_mbits(struct ptlrpc_request *req)
 		 * 'resend for the -EINPROGRESS resend'. To make it simple,
 		 * we opt to generate mbits for all resend cases.
 		 */
-		if (OCD_HAS_FLAG(&bd->bd_import->imp_connect_data, BULK_MBITS)) {
+		if (OCD_HAS_FLAG(&bd->bd_import->imp_connect_data,
+				 BULK_MBITS)) {
 			req->rq_mbits = ptlrpc_next_xid();
 		} else {
 			/* old version transfers rq_xid to peer as matchbits */
@@ -3188,7 +3207,7 @@ u64 ptlrpc_sample_next_xid(void)
  *    have delay before it really runs by ptlrpcd thread.
  */
 struct ptlrpc_work_async_args {
-	int (*cb)(const struct lu_env *, void *);
+	int (*cb)(const struct lu_env *env, void *cbdata);
 	void *cbdata;
 };
 
diff --git a/fs/lustre/ptlrpc/connection.c b/fs/lustre/ptlrpc/connection.c
index ca9b4ca..5466755 100644
--- a/fs/lustre/ptlrpc/connection.c
+++ b/fs/lustre/ptlrpc/connection.c
@@ -105,7 +105,7 @@ struct ptlrpc_connection *
 	 */
 	conn2 = rhashtable_lookup_get_insert_fast(&conn_hash, &conn->c_hash,
 						  conn_hash_params);
-	if (conn2 != NULL) {
+	if (conn2) {
 		/* insertion failed */
 		kfree(conn);
 		if (IS_ERR(conn2))
diff --git a/fs/lustre/ptlrpc/events.c b/fs/lustre/ptlrpc/events.c
index 0c16a2c..fc3c7f0 100644
--- a/fs/lustre/ptlrpc/events.c
+++ b/fs/lustre/ptlrpc/events.c
@@ -254,13 +254,14 @@ static void ptlrpc_req_add_history(struct ptlrpc_service_part *svcpt,
 				   struct ptlrpc_request *req)
 {
 	u64 sec = req->rq_arrival_time.tv_sec;
-	u32 usec = req->rq_arrival_time.tv_nsec / NSEC_PER_USEC / 16; /* usec / 16 */
 	u64 new_seq;
+	u32 usec;
 
+	/* usec /16 */
+	usec = req->rq_arrival_time.tv_nsec / NSEC_PER_USEC / 16;
 	/* set sequence ID for request and add it to history list,
 	 * it must be called with hold svcpt::scp_lock
 	 */
-
 	new_seq = (sec << REQS_SEC_SHIFT) |
 		  (usec << REQS_USEC_SHIFT) |
 		  (svcpt->scp_cpt < 0 ? 0 : svcpt->scp_cpt);
diff --git a/fs/lustre/ptlrpc/import.c b/fs/lustre/ptlrpc/import.c
index 18823d5..d49707a 100644
--- a/fs/lustre/ptlrpc/import.c
+++ b/fs/lustre/ptlrpc/import.c
@@ -105,7 +105,6 @@ static void __import_set_state(struct obd_import *imp,
 static int ptlrpc_connect_interpret(const struct lu_env *env,
 				    struct ptlrpc_request *request,
 				    void *data, int rc);
-int ptlrpc_import_recovery_state_machine(struct obd_import *imp);
 
 /* Only this function is allowed to change the import state when it is
  * CLOSED. I would rather refcount the import and free it after
@@ -170,10 +169,12 @@ int ptlrpc_set_import_discon(struct obd_import *imp, u32 conn_cnt)
 
 		if (imp->imp_replayable) {
 			LCONSOLE_WARN("%s: Connection to %.*s (at %s) was lost; in progress operations using this service will wait for recovery to complete\n",
-				      imp->imp_obd->obd_name, target_len, target_start,
+				      imp->imp_obd->obd_name,
+				      target_len, target_start,
 				      libcfs_nid2str(imp->imp_connection->c_peer.nid));
 		} else {
-			LCONSOLE_ERROR_MSG(0x166, "%s: Connection to %.*s (at %s) was lost; in progress operations using this service will fail\n",
+			LCONSOLE_ERROR_MSG(0x166,
+					   "%s: Connection to %.*s (at %s) was lost; in progress operations using this service will fail\n",
 					   imp->imp_obd->obd_name,
 					   target_len, target_start,
 					   libcfs_nid2str(imp->imp_connection->c_peer.nid));
@@ -317,8 +318,9 @@ void ptlrpc_invalidate_import(struct obd_import *imp)
 
 			spin_lock(&imp->imp_lock);
 			if (atomic_read(&imp->imp_inflight) == 0) {
-				int count = atomic_read(&imp->imp_unregistering);
+				int count;
 
+				count = atomic_read(&imp->imp_unregistering);
 				/* We know that "unregistering" rpcs only can
 				 * survive in sending or delaying lists (they
 				 * maybe waiting for long reply unlink in
@@ -326,7 +328,8 @@ void ptlrpc_invalidate_import(struct obd_import *imp)
 				 * is no inflight and unregistering != 0, this
 				 * is bug.
 				 */
-				LASSERTF(count == 0, "Some RPCs are still unregistering: %d\n",
+				LASSERTF(count == 0,
+					 "Some RPCs are still unregistering: %d\n",
 					 count);
 
 				/* Let's save one loop as soon as inflight have
@@ -348,8 +351,7 @@ void ptlrpc_invalidate_import(struct obd_import *imp)
 
 				CERROR("%s: Unregistering RPCs found (%d). Network is sluggish? Waiting them to error out.\n",
 				       cli_tgt,
-				       atomic_read(&imp->
-						   imp_unregistering));
+				       atomic_read(&imp->imp_unregistering));
 			}
 			spin_unlock(&imp->imp_lock);
 		}
@@ -405,7 +407,8 @@ void ptlrpc_fail_import(struct obd_import *imp, u32 conn_cnt)
 
 	if (ptlrpc_set_import_discon(imp, conn_cnt)) {
 		if (!imp->imp_replayable) {
-			CDEBUG(D_HA, "import %s@%s for %s not replayable, auto-deactivating\n",
+			CDEBUG(D_HA,
+			       "import %s@%s for %s not replayable, auto-deactivating\n",
 			       obd2cli_tgt(imp->imp_obd),
 			       imp->imp_connection->c_remote_uuid.uuid,
 			       imp->imp_obd->obd_name);
@@ -466,7 +469,7 @@ static int import_select_connection(struct obd_import *imp)
 		 */
 		if ((conn->oic_last_attempt == 0) ||
 		    time_before_eq64(conn->oic_last_attempt,
-					imp->imp_last_success_conn)) {
+				     imp->imp_last_success_conn)) {
 			imp_conn = conn;
 			tried_all = 0;
 			break;
@@ -506,7 +509,8 @@ static int import_select_connection(struct obd_import *imp)
 				at_reset(at, CONNECTION_SWITCH_MAX);
 		}
 		LASSERT(imp_conn->oic_last_attempt);
-		CDEBUG(D_HA, "%s: tried all connections, increasing latency to %ds\n",
+		CDEBUG(D_HA,
+		       "%s: tried all connections, increasing latency to %ds\n",
 		       imp->imp_obd->obd_name, at_get(at));
 	}
 
@@ -526,7 +530,8 @@ static int import_select_connection(struct obd_import *imp)
 			deuuidify(obd2cli_tgt(imp->imp_obd), NULL,
 				  &target_start, &target_len);
 
-			CDEBUG(D_HA, "%s: Connection changing to %.*s (at %s)\n",
+			CDEBUG(D_HA,
+			       "%s: Connection changing to %.*s (at %s)\n",
 			       imp->imp_obd->obd_name,
 			       target_len, target_start,
 			       libcfs_nid2str(imp_conn->oic_conn->c_peer.nid));
@@ -819,9 +824,8 @@ static int ptlrpc_connect_set_flags(struct obd_import *imp,
 				      ocd->ocd_cksum_types,
 				      cksum_types_supported_client());
 			return -EPROTO;
-		} else {
-			cli->cl_supp_cksum_types = ocd->ocd_cksum_types;
 		}
+		cli->cl_supp_cksum_types = ocd->ocd_cksum_types;
 	} else {
 		/*
 		 * The server does not support OBD_CONNECT_CKSUM.
@@ -862,7 +866,8 @@ static int ptlrpc_connect_set_flags(struct obd_import *imp,
 	 * disable lru_resize, etc.
 	 */
 	if (old_connect_flags != exp_connect_flags(exp) || init_connect) {
-		CDEBUG(D_HA, "%s: Resetting ns_connect_flags to server flags: %#llx\n",
+		CDEBUG(D_HA,
+		       "%s: Resetting ns_connect_flags to server flags: %#llx\n",
 		       imp->imp_obd->obd_name, ocd->ocd_connect_flags);
 		imp->imp_obd->obd_namespace->ns_connect_flags =
 			ocd->ocd_connect_flags;
@@ -1113,20 +1118,18 @@ static int ptlrpc_connect_interpret(const struct lu_env *env,
 			 * with server again
 			 */
 			if ((msg_flags & MSG_CONNECT_RECOVERING)) {
-				CDEBUG(level, "%s@%s changed server handle from %#llx to %#llx but is still in recovery\n",
+				CDEBUG(level,
+				       "%s@%s changed server handle from %#llx to %#llx but is still in recovery\n",
 				       obd2cli_tgt(imp->imp_obd),
 				       imp->imp_connection->c_remote_uuid.uuid,
 				       imp->imp_remote_handle.cookie,
-				       lustre_msg_get_handle(
-				       request->rq_repmsg)->cookie);
+				       lustre_msg_get_handle(request->rq_repmsg)->cookie);
 			} else {
 				LCONSOLE_WARN("Evicted from %s (at %s) after server handle changed from %#llx to %#llx\n",
 					      obd2cli_tgt(imp->imp_obd),
-					      imp->imp_connection-> \
-					      c_remote_uuid.uuid,
+					      imp->imp_connection->c_remote_uuid.uuid,
 					      imp->imp_remote_handle.cookie,
-					      lustre_msg_get_handle(
-						      request->rq_repmsg)->cookie);
+					      lustre_msg_get_handle(request->rq_repmsg)->cookie);
 			}
 
 			imp->imp_remote_handle =
@@ -1145,7 +1148,8 @@ static int ptlrpc_connect_interpret(const struct lu_env *env,
 		}
 
 		if (imp->imp_invalid) {
-			CDEBUG(D_HA, "%s: reconnected but import is invalid; marking evicted\n",
+			CDEBUG(D_HA,
+			       "%s: reconnected but import is invalid; marking evicted\n",
 			       imp->imp_obd->obd_name);
 			IMPORT_SET_STATE(imp, LUSTRE_IMP_EVICTED);
 		} else if (msg_flags & MSG_CONNECT_RECOVERING) {
@@ -1169,7 +1173,8 @@ static int ptlrpc_connect_interpret(const struct lu_env *env,
 		imp->imp_replay_cursor = &imp->imp_committed_list;
 		IMPORT_SET_STATE(imp, LUSTRE_IMP_REPLAY);
 	} else {
-		DEBUG_REQ(D_HA, request, "%s: evicting (reconnect/recover flags not set: %x)",
+		DEBUG_REQ(D_HA, request,
+			  "%s: evicting (reconnect/recover flags not set: %x)",
 			  imp->imp_obd->obd_name, msg_flags);
 		imp->imp_remote_handle =
 				*lustre_msg_get_handle(request->rq_repmsg);
@@ -1191,7 +1196,8 @@ static int ptlrpc_connect_interpret(const struct lu_env *env,
 	ptlrpc_prepare_replay(imp);
 	rc = ptlrpc_import_recovery_state_machine(imp);
 	if (rc == -ENOTCONN) {
-		CDEBUG(D_HA, "evicted/aborted by %s@%s during recovery; invalidating and reconnecting\n",
+		CDEBUG(D_HA,
+		       "evicted/aborted by %s@%s during recovery; invalidating and reconnecting\n",
 		       obd2cli_tgt(imp->imp_obd),
 		       imp->imp_connection->c_remote_uuid.uuid);
 		ptlrpc_connect_import(imp);
@@ -1236,7 +1242,8 @@ static int ptlrpc_connect_interpret(const struct lu_env *env,
 				 * connection from liblustre clients, so we
 				 * should never see this from VFS context
 				 */
-				LCONSOLE_ERROR_MSG(0x16a, "Server %s version (%d.%d.%d.%d) refused connection from this client with an incompatible version (%s).  Client must be recompiled\n",
+				LCONSOLE_ERROR_MSG(0x16a,
+						   "Server %s version (%d.%d.%d.%d) refused connection from this client with an incompatible version (%s).  Client must be recompiled\n",
 						   obd2cli_tgt(imp->imp_obd),
 						   OBD_OCD_VERSION_MAJOR(ocd->ocd_version),
 						   OBD_OCD_VERSION_MINOR(ocd->ocd_version),
@@ -1278,7 +1285,8 @@ static int completed_replay_interpret(const struct lu_env *env,
 			       "%s: version recovery fails, reconnecting\n",
 			       req->rq_import->imp_obd->obd_name);
 		} else {
-			CDEBUG(D_HA, "%s: LAST_REPLAY message error: %d, reconnecting\n",
+			CDEBUG(D_HA,
+			       "%s: LAST_REPLAY message error: %d, reconnecting\n",
 			       req->rq_import->imp_obd->obd_name,
 			       req->rq_status);
 		}
@@ -1383,7 +1391,8 @@ int ptlrpc_import_recovery_state_machine(struct obd_import *imp)
 		/* Don't care about MGC eviction */
 		if (strcmp(imp->imp_obd->obd_type->typ_name,
 			   LUSTRE_MGC_NAME) != 0) {
-			LCONSOLE_ERROR_MSG(0x167, "%s: This client was evicted by %.*s; in progress operations using this service will fail.\n",
+			LCONSOLE_ERROR_MSG(0x167,
+					   "%s: This client was evicted by %.*s; in progress operations using this service will fail.\n",
 					   imp->imp_obd->obd_name, target_len,
 					   target_start);
 		}
@@ -1638,9 +1647,9 @@ int at_measured(struct adaptive_timeout *at, unsigned int val)
 	at->at_current =  max(at->at_current, at_min);
 
 	if (at->at_current != old)
-		CDEBUG(D_OTHER, "AT %p change: old=%u new=%u delta=%d (val=%u) hist %u %u %u %u\n",
-		       at,
-		       old, at->at_current, at->at_current - old, val,
+		CDEBUG(D_OTHER,
+		       "AT %p change: old=%u new=%u delta=%d (val=%u) hist %u %u %u %u\n",
+		       at, old, at->at_current, at->at_current - old, val,
 		       at->at_hist[0], at->at_hist[1], at->at_hist[2],
 		       at->at_hist[3]);
 
diff --git a/fs/lustre/ptlrpc/layout.c b/fs/lustre/ptlrpc/layout.c
index 3bebfd7..da315f7 100644
--- a/fs/lustre/ptlrpc/layout.c
+++ b/fs/lustre/ptlrpc/layout.c
@@ -775,8 +775,8 @@ struct req_msg_field {
 	 * but the actual size must be a whole multiple of @rmf_size.
 	 */
 	const int   rmf_size;
-	void	(*rmf_swabber)(void *);
-	void	(*rmf_dumper)(void *);
+	void	(*rmf_swabber)(void *value);
+	void	(*rmf_dumper)(void *value);
 	int	 rmf_offset[ARRAY_SIZE(req_formats)][RCL_NR];
 };
 
@@ -1053,7 +1053,8 @@ struct req_msg_field RMF_LAYOUT_INTENT =
  */
 struct req_msg_field RMF_OST_BODY =
 	DEFINE_MSGF("ost_body", 0,
-		    sizeof(struct ost_body), lustre_swab_ost_body, dump_ost_body);
+		    sizeof(struct ost_body), lustre_swab_ost_body,
+		    dump_ost_body);
 EXPORT_SYMBOL(RMF_OST_BODY);
 
 struct req_msg_field RMF_OBD_IOOBJ =
@@ -1868,7 +1869,8 @@ u32 __req_capsule_offset(const struct req_capsule *pill,
 	     i < n;
 	     i++, p += field->rmf_size) {
 		if (dump) {
-			CDEBUG(D_RPCTRACE, "Dump of %sarray field %s, element %d follows\n",
+			CDEBUG(D_RPCTRACE,
+			       "Dump of %sarray field %s, element %d follows\n",
 			       do_swab ? "unswabbed " : "", field->rmf_name, i);
 			field->rmf_dumper(p);
 		}
@@ -1876,7 +1878,8 @@ u32 __req_capsule_offset(const struct req_capsule *pill,
 			continue;
 		swabber(p);
 		if (dump) {
-			CDEBUG(D_RPCTRACE, "Dump of swabbed array field %s, element %d follows\n",
+			CDEBUG(D_RPCTRACE,
+			       "Dump of swabbed array field %s, element %d follows\n",
 			       field->rmf_name, i);
 			field->rmf_dumper(value);
 		}
@@ -2145,8 +2148,7 @@ u32 req_capsule_fmt_size(u32 magic, const struct req_format *fmt,
 
 	for (; i < fmt->rf_fields[loc].nr; ++i)
 		if (fmt->rf_fields[loc].d[i]->rmf_size != -1)
-			size += cfs_size_round(fmt->rf_fields[loc].d[i]->
-					       rmf_size);
+			size += cfs_size_round(fmt->rf_fields[loc].d[i]->rmf_size);
 	return size;
 }
 
@@ -2185,8 +2187,9 @@ void req_capsule_extend(struct req_capsule *pill, const struct req_format *fmt)
 	for (i = 0; i < RCL_NR; ++i) {
 		LASSERT(fmt->rf_fields[i].nr >= old->rf_fields[i].nr);
 		for (j = 0; j < old->rf_fields[i].nr - 1; ++j) {
-			const struct req_msg_field *ofield = FMT_FIELD(old, i, j);
+			const struct req_msg_field *ofield;
 
+			ofield = FMT_FIELD(old, i, j);
 			/* "opaque" fields can be transmogrified */
 			if (!ofield->rmf_swabber &&
 			    (ofield->rmf_flags & ~RMF_F_NO_SIZE_CHECK) == 0 &&
diff --git a/fs/lustre/ptlrpc/llog_client.c b/fs/lustre/ptlrpc/llog_client.c
index 8ca6959..e5ff080 100644
--- a/fs/lustre/ptlrpc/llog_client.c
+++ b/fs/lustre/ptlrpc/llog_client.c
@@ -278,7 +278,8 @@ static int llog_client_read_header(const struct lu_env *env,
 	int rc;
 
 	LLOG_CLIENT_ENTRY(handle->lgh_ctxt, imp);
-	req = ptlrpc_request_alloc_pack(imp, &RQF_LLOG_ORIGIN_HANDLE_READ_HEADER,
+	req = ptlrpc_request_alloc_pack(imp,
+					&RQF_LLOG_ORIGIN_HANDLE_READ_HEADER,
 					LUSTRE_LOG_VERSION,
 					LLOG_ORIGIN_HANDLE_READ_HEADER);
 	if (!req) {
diff --git a/fs/lustre/ptlrpc/lproc_ptlrpc.c b/fs/lustre/ptlrpc/lproc_ptlrpc.c
index 0d56704..bc5dc3f 100644
--- a/fs/lustre/ptlrpc/lproc_ptlrpc.c
+++ b/fs/lustre/ptlrpc/lproc_ptlrpc.c
@@ -282,7 +282,8 @@ static const char *ll_eopcode2str(u32 opcode)
 					 const char __user *buffer,
 					 size_t count, loff_t *off)
 {
-	struct ptlrpc_service *svc = ((struct seq_file *)file->private_data)->private;
+	struct seq_file *m = file->private_data;
+	struct ptlrpc_service *svc = m->private;
 	int bufpages;
 	int val;
 	int rc;
@@ -628,7 +629,8 @@ static ssize_t ptlrpc_lprocfs_nrs_seq_write(struct file *file,
 					    const char __user *buffer,
 					    size_t count, loff_t *off)
 {
-	struct ptlrpc_service *svc = ((struct seq_file *)file->private_data)->private;
+	struct seq_file *m = file->private_data;
+	struct ptlrpc_service *svc = m->private;
 	enum ptlrpc_nrs_queue_type queue = PTLRPC_NRS_QUEUE_BOTH;
 	char *cmd;
 	char *cmd_copy = NULL;
@@ -1180,7 +1182,8 @@ void ptlrpc_lprocfs_unregister_obd(struct obd_device *obd)
 int lprocfs_wr_ping(struct file *file, const char __user *buffer,
 		    size_t count, loff_t *off)
 {
-	struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
+	struct seq_file *m = file->private_data;
+	struct obd_device *obd = m->private;
 	struct ptlrpc_request *req;
 	int rc;
 
@@ -1211,7 +1214,8 @@ int lprocfs_wr_ping(struct file *file, const char __user *buffer,
 int lprocfs_wr_import(struct file *file, const char __user *buffer,
 		      size_t count, loff_t *off)
 {
-	struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
+	struct seq_file *m = file->private_data;
+	struct obd_device *obd = m->private;
 	struct obd_import *imp = obd->u.cli.cl_import;
 	char *kbuf = NULL;
 	char *uuid;
@@ -1253,12 +1257,14 @@ int lprocfs_wr_import(struct file *file, const char __user *buffer,
 		if (*endptr) {
 			CERROR("config: wrong instance # %s\n", ptr);
 		} else if (inst != imp->imp_connect_data.ocd_instance) {
-			CDEBUG(D_INFO, "IR: %s is connecting to an obsoleted target(%u/%u), reconnecting...\n",
+			CDEBUG(D_INFO,
+			       "IR: %s is connecting to an obsoleted target(%u/%u), reconnecting...\n",
 			       imp->imp_obd->obd_name,
 			       imp->imp_connect_data.ocd_instance, inst);
 			do_reconn = 1;
 		} else {
-			CDEBUG(D_INFO, "IR: %s has already been connecting to new target(%u)\n",
+			CDEBUG(D_INFO,
+			       "IR: %s has already been connecting to new target(%u)\n",
 			       imp->imp_obd->obd_name, inst);
 		}
 	}
@@ -1292,7 +1298,8 @@ int lprocfs_rd_pinger_recov(struct seq_file *m, void *n)
 int lprocfs_wr_pinger_recov(struct file *file, const char __user *buffer,
 			    size_t count, loff_t *off)
 {
-	struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
+	struct seq_file *m = file->private_data;
+	struct obd_device *obd = m->private;
 	struct client_obd *cli = &obd->u.cli;
 	struct obd_import *imp = cli->cl_import;
 	int rc, val;
diff --git a/fs/lustre/ptlrpc/niobuf.c b/fs/lustre/ptlrpc/niobuf.c
index c279fb1..033d628 100644
--- a/fs/lustre/ptlrpc/niobuf.c
+++ b/fs/lustre/ptlrpc/niobuf.c
@@ -220,7 +220,8 @@ static int ptlrpc_register_bulk(struct ptlrpc_request *req)
 		      total_md - desc->bd_md_count);
 	spin_unlock(&desc->bd_lock);
 
-	CDEBUG(D_NET, "Setup %u bulk %s buffers: %u pages %u bytes, mbits x%#llx-%#llx, portal %u\n",
+	CDEBUG(D_NET,
+	       "Setup %u bulk %s buffers: %u pages %u bytes, mbits x%#llx-%#llx, portal %u\n",
 	       desc->bd_md_count,
 	       ptlrpc_is_bulk_op_get(desc->bd_type) ? "get-source" : "put-sink",
 	       desc->bd_iov_count, desc->bd_nob,
@@ -335,7 +336,8 @@ static void ptlrpc_at_set_reply(struct ptlrpc_request *req, int flags)
 
 	if (req->rq_reqmsg &&
 	    !(lustre_msghdr_get_flags(req->rq_reqmsg) & MSGHDR_AT_SUPPORT)) {
-		CDEBUG(D_ADAPTTO, "No early reply support: flags=%#x req_flags=%#x magic=%x/%x len=%d\n",
+		CDEBUG(D_ADAPTTO,
+		       "No early reply support: flags=%#x req_flags=%#x magic=%x/%x len=%d\n",
 		       flags, lustre_msg_get_flags(req->rq_reqmsg),
 		       lustre_msg_get_magic(req->rq_reqmsg),
 		       lustre_msg_get_magic(req->rq_repmsg), req->rq_replen);
@@ -542,7 +544,8 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply)
 		spin_unlock(&imp->imp_lock);
 
 		lustre_msg_set_last_xid(request->rq_reqmsg, min_xid);
-		DEBUG_REQ(D_RPCTRACE, request, "Allocating new xid for resend on EINPROGRESS");
+		DEBUG_REQ(D_RPCTRACE, request,
+			  "Allocating new xid for resend on EINPROGRESS");
 	}
 
 	if (request->rq_bulk) {
@@ -667,7 +670,8 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply)
 			goto cleanup_me;
 		}
 
-		CDEBUG(D_NET, "Setup reply buffer: %u bytes, xid %llu, portal %u\n",
+		CDEBUG(D_NET,
+		       "Setup reply buffer: %u bytes, xid %llu, portal %u\n",
 		       request->rq_repbuf_len, request->rq_xid,
 		       request->rq_reply_portal);
 	}
diff --git a/fs/lustre/ptlrpc/nrs.c b/fs/lustre/ptlrpc/nrs.c
index a56b7b3..953a0b8 100644
--- a/fs/lustre/ptlrpc/nrs.c
+++ b/fs/lustre/ptlrpc/nrs.c
@@ -79,7 +79,7 @@ static int nrs_policy_ctl_locked(struct ptlrpc_nrs_policy *policy,
 
 	return policy->pol_desc->pd_ops->op_policy_ctl ?
 	       policy->pol_desc->pd_ops->op_policy_ctl(policy, opc, arg) :
-	       -ENOSYS;
+	       -ENXIO;
 }
 
 static void __nrs_policy_stop(struct ptlrpc_nrs_policy *policy)
diff --git a/fs/lustre/ptlrpc/pack_generic.c b/fs/lustre/ptlrpc/pack_generic.c
index 2cbb855..6d61cc7 100644
--- a/fs/lustre/ptlrpc/pack_generic.c
+++ b/fs/lustre/ptlrpc/pack_generic.c
@@ -1799,7 +1799,8 @@ void lustre_swab_mgs_nidtbl_entry(struct mgs_nidtbl_entry *entry)
 	__swab32s(&entry->mne_length);
 
 	/* mne_nid_(count|type) must be one byte size because we're gonna
-	 * access it w/o swapping. */
+	 * access it w/o swapping:
+	 */
 	BUILD_BUG_ON(sizeof(entry->mne_nid_count) != sizeof(u8));
 	BUILD_BUG_ON(sizeof(entry->mne_nid_type) != sizeof(u8));
 
@@ -2175,7 +2176,8 @@ static void dump_obdo(struct obdo *oa)
 
 	CDEBUG(D_RPCTRACE, "obdo: o_valid = %08x\n", valid);
 	if (valid & OBD_MD_FLID)
-		CDEBUG(D_RPCTRACE, "obdo: id = " DOSTID "\n", POSTID(&oa->o_oi));
+		CDEBUG(D_RPCTRACE, "obdo: id = " DOSTID "\n",
+		       POSTID(&oa->o_oi));
 	if (valid & OBD_MD_FLFID)
 		CDEBUG(D_RPCTRACE, "obdo: o_parent_seq = %#llx\n",
 		       oa->o_parent_seq);
diff --git a/fs/lustre/ptlrpc/pinger.c b/fs/lustre/ptlrpc/pinger.c
index b3297b5..6a437f4 100644
--- a/fs/lustre/ptlrpc/pinger.c
+++ b/fs/lustre/ptlrpc/pinger.c
@@ -190,7 +190,8 @@ static void ptlrpc_pinger_process_import(struct obd_import *imp,
 
 	spin_unlock(&imp->imp_lock);
 
-	CDEBUG(level == LUSTRE_IMP_FULL ? D_INFO : D_HA, "%s->%s: level %s/%u force %u force_next %u deactive %u pingable %u suppress %u\n",
+	CDEBUG(level == LUSTRE_IMP_FULL ? D_INFO : D_HA,
+	       "%s->%s: level %s/%u force %u force_next %u deactive %u pingable %u suppress %u\n",
 	       imp->imp_obd->obd_uuid.uuid, obd2cli_tgt(imp->imp_obd),
 	       ptlrpc_import_state_name(level), level, force, force_next,
 	       imp->imp_deactive, imp->imp_pingable, suppress);
@@ -203,7 +204,8 @@ static void ptlrpc_pinger_process_import(struct obd_import *imp,
 	} else if (level != LUSTRE_IMP_FULL ||
 		   imp->imp_obd->obd_no_recov ||
 		   imp_is_deactive(imp)) {
-		CDEBUG(D_HA, "%s->%s: not pinging (in recovery or recovery disabled: %s)\n",
+		CDEBUG(D_HA,
+		       "%s->%s: not pinging (in recovery or recovery disabled: %s)\n",
 		       imp->imp_obd->obd_uuid.uuid, obd2cli_tgt(imp->imp_obd),
 		       ptlrpc_import_state_name(level));
 		if (force) {
diff --git a/fs/lustre/ptlrpc/ptlrpc_internal.h b/fs/lustre/ptlrpc/ptlrpc_internal.h
index 5383b68..201ccdd 100644
--- a/fs/lustre/ptlrpc/ptlrpc_internal.h
+++ b/fs/lustre/ptlrpc/ptlrpc_internal.h
@@ -224,8 +224,8 @@ struct ptlrpc_nrs_policy *nrs_request_policy(struct ptlrpc_nrs_request *nrq)
  * a separating space character.
  */
 #define LPROCFS_NRS_WR_QUANTUM_MAX_CMD					       \
- sizeof(NRS_LPROCFS_QUANTUM_NAME_REG __stringify(LPROCFS_NRS_QUANTUM_MAX) " "  \
-	NRS_LPROCFS_QUANTUM_NAME_HP __stringify(LPROCFS_NRS_QUANTUM_MAX))
+	sizeof(NRS_LPROCFS_QUANTUM_NAME_REG __stringify(LPROCFS_NRS_QUANTUM_MAX) " "  \
+	       NRS_LPROCFS_QUANTUM_NAME_HP __stringify(LPROCFS_NRS_QUANTUM_MAX))
 
 /* ptlrpc/nrs_fifo.c */
 extern struct ptlrpc_nrs_pol_conf nrs_conf_fifo;
@@ -301,7 +301,6 @@ static inline int tgt_mod_init(void)
 
 static inline void tgt_mod_exit(void)
 {
-	return;
 }
 
 static inline void ptlrpc_reqset_put(struct ptlrpc_request_set *set)
diff --git a/fs/lustre/ptlrpc/ptlrpc_module.c b/fs/lustre/ptlrpc/ptlrpc_module.c
index 5c32b657..f73ba41 100644
--- a/fs/lustre/ptlrpc/ptlrpc_module.c
+++ b/fs/lustre/ptlrpc/ptlrpc_module.c
@@ -46,7 +46,7 @@
 #endif
 
 DEFINE_MUTEX(ptlrpc_startup);
-static int ptlrpc_active = 0;
+static int ptlrpc_active;
 
 int ptlrpc_inc_ref(void)
 {
@@ -58,7 +58,7 @@ int ptlrpc_inc_ref(void)
 
 		rc = ptlrpc_init_portals();
 		if (!rc) {
-			rc= ptlrpc_start_pinger();
+			rc = ptlrpc_start_pinger();
 			if (rc)
 				ptlrpc_exit_portals();
 		}
@@ -160,7 +160,7 @@ static int __init ptlrpc_init(void)
 		req_layout_fini();
 		/* Fall through */
 	default:
-		;
+		break;
 	}
 
 	return rc;
diff --git a/fs/lustre/ptlrpc/ptlrpcd.c b/fs/lustre/ptlrpc/ptlrpcd.c
index f0ac296..92b477d 100644
--- a/fs/lustre/ptlrpc/ptlrpcd.c
+++ b/fs/lustre/ptlrpc/ptlrpcd.c
@@ -362,7 +362,8 @@ static int ptlrpcd_check(struct lu_env *env, struct ptlrpcd_ctl *pc)
 				if (atomic_read(&ps->set_new_count)) {
 					rc = ptlrpcd_steal_rqset(set, ps);
 					if (rc > 0)
-						CDEBUG(D_RPCTRACE, "transfer %d async RPCs [%d->%d]\n",
+						CDEBUG(D_RPCTRACE,
+						       "transfer %d async RPCs [%d->%d]\n",
 						       rc, partner->pc_index,
 						       pc->pc_index);
 				}
diff --git a/fs/lustre/ptlrpc/recover.c b/fs/lustre/ptlrpc/recover.c
index af672ab..5548049 100644
--- a/fs/lustre/ptlrpc/recover.c
+++ b/fs/lustre/ptlrpc/recover.c
@@ -232,7 +232,8 @@ void ptlrpc_request_handle_notconn(struct ptlrpc_request *failed_req)
 	if (ptlrpc_set_import_discon(imp,
 			      lustre_msg_get_conn_cnt(failed_req->rq_reqmsg))) {
 		if (!imp->imp_replayable) {
-			CDEBUG(D_HA, "import %s@%s for %s not replayable, auto-deactivating\n",
+			CDEBUG(D_HA,
+			       "import %s@%s for %s not replayable, auto-deactivating\n",
 			       obd2cli_tgt(imp->imp_obd),
 			       imp->imp_connection->c_remote_uuid.uuid,
 			       imp->imp_obd->obd_name);
diff --git a/fs/lustre/ptlrpc/sec.c b/fs/lustre/ptlrpc/sec.c
index 1cf0e9b..a0d6732 100644
--- a/fs/lustre/ptlrpc/sec.c
+++ b/fs/lustre/ptlrpc/sec.c
@@ -427,7 +427,8 @@ int sptlrpc_req_ctx_switch(struct ptlrpc_request *req,
 	LASSERT(req->rq_reqlen);
 	LASSERT(req->rq_replen);
 
-	CDEBUG(D_SEC, "req %p: switch ctx %p(%u->%s) -> %p(%u->%s), switch sec %p(%s) -> %p(%s)\n",
+	CDEBUG(D_SEC,
+	       "req %p: switch ctx %p(%u->%s) -> %p(%u->%s), switch sec %p(%s) -> %p(%s)\n",
 	       req,
 	       oldctx, oldctx->cc_vcred.vc_uid, sec2target_str(oldctx->cc_sec),
 	       newctx, newctx->cc_vcred.vc_uid, sec2target_str(newctx->cc_sec),
@@ -515,7 +516,8 @@ static int sptlrpc_req_replace_dead_ctx(struct ptlrpc_request *req)
 		       newctx, newctx->cc_flags);
 
 		schedule_timeout_interruptible(HZ);
-	} else if (unlikely(!test_bit(PTLRPC_CTX_UPTODATE_BIT, &newctx->cc_flags))) {
+	} else if (unlikely(!test_bit(PTLRPC_CTX_UPTODATE_BIT,
+				      &newctx->cc_flags))) {
 		/*
 		 * new ctx not up to date yet
 		 */
@@ -1819,7 +1821,8 @@ int sptlrpc_target_export_check(struct obd_export *exp,
 							req->rq_svc_ctx,
 							&flavor);
 		} else {
-			CDEBUG(D_SEC, "exp %p (%x|%x|%x): is current flavor, install rvs ctx\n",
+			CDEBUG(D_SEC,
+			       "exp %p (%x|%x|%x): is current flavor, install rvs ctx\n",
 			       exp, exp->exp_flvr.sf_rpc,
 			       exp->exp_flvr_old[0].sf_rpc,
 			       exp->exp_flvr_old[1].sf_rpc);
@@ -1833,8 +1836,9 @@ int sptlrpc_target_export_check(struct obd_export *exp,
 	if (exp->exp_flvr_expire[0]) {
 		if (exp->exp_flvr_expire[0] >= ktime_get_real_seconds()) {
 			if (flavor_allowed(&exp->exp_flvr_old[0], req)) {
-				CDEBUG(D_SEC, "exp %p (%x|%x|%x): match the middle one (%lld)\n", exp,
-				       exp->exp_flvr.sf_rpc,
+				CDEBUG(D_SEC,
+				       "exp %p (%x|%x|%x): match the middle one (%lld)\n",
+				       exp, exp->exp_flvr.sf_rpc,
 				       exp->exp_flvr_old[0].sf_rpc,
 				       exp->exp_flvr_old[1].sf_rpc,
 				       (s64)(exp->exp_flvr_expire[0] -
@@ -1846,8 +1850,8 @@ int sptlrpc_target_export_check(struct obd_export *exp,
 			CDEBUG(D_SEC, "mark middle expired\n");
 			exp->exp_flvr_expire[0] = 0;
 		}
-		CDEBUG(D_SEC, "exp %p (%x|%x|%x): %x not match middle\n", exp,
-		       exp->exp_flvr.sf_rpc,
+		CDEBUG(D_SEC, "exp %p (%x|%x|%x): %x not match middle\n",
+		       exp, exp->exp_flvr.sf_rpc,
 		       exp->exp_flvr_old[0].sf_rpc, exp->exp_flvr_old[1].sf_rpc,
 		       req->rq_flvr.sf_rpc);
 	}
@@ -1858,7 +1862,8 @@ int sptlrpc_target_export_check(struct obd_export *exp,
 	if (exp->exp_flvr_changed == 0 && exp->exp_flvr_expire[1]) {
 		if (exp->exp_flvr_expire[1] >= ktime_get_real_seconds()) {
 			if (flavor_allowed(&exp->exp_flvr_old[1], req)) {
-				CDEBUG(D_SEC, "exp %p (%x|%x|%x): match the oldest one (%lld)\n",
+				CDEBUG(D_SEC,
+				       "exp %p (%x|%x|%x): match the oldest one (%lld)\n",
 				       exp,
 				       exp->exp_flvr.sf_rpc,
 				       exp->exp_flvr_old[0].sf_rpc,
diff --git a/fs/lustre/ptlrpc/sec_config.c b/fs/lustre/ptlrpc/sec_config.c
index 35ebd56..d3c949d 100644
--- a/fs/lustre/ptlrpc/sec_config.c
+++ b/fs/lustre/ptlrpc/sec_config.c
@@ -416,11 +416,16 @@ struct sptlrpc_conf_tgt {
 struct sptlrpc_conf {
 	struct list_head		sc_list;
 	char				sc_fsname[MTI_NAME_MAXLEN];
-	unsigned int			sc_modified;	/* modified during updating */
-	unsigned int			sc_updated:1,	/* updated copy from MGS */
-					sc_local:1;	/* local copy from target */
-	struct sptlrpc_rule_set		sc_rset;	/* fs general rules */
-	struct list_head		sc_tgts;	/* target-specific rules */
+	/* modified during updating */
+	unsigned int			sc_modified;
+	unsigned int			sc_updated:1, /* updated copy from
+						       * MGS
+						       */
+					sc_local:1; /* local copy from target */
+	/* fs general rules */
+	struct sptlrpc_rule_set		sc_rset;
+	/* target-specific rules */
+	struct list_head		sc_tgts;
 };
 
 static struct mutex sptlrpc_conf_lock;
diff --git a/fs/lustre/ptlrpc/sec_lproc.c b/fs/lustre/ptlrpc/sec_lproc.c
index 2bb75eb..df7c667 100644
--- a/fs/lustre/ptlrpc/sec_lproc.c
+++ b/fs/lustre/ptlrpc/sec_lproc.c
@@ -160,7 +160,8 @@ int sptlrpc_lprocfs_cliobd_attach(struct obd_device *dev)
 
 void sptlrpc_lproc_init(void)
 {
-	sptlrpc_debugfs_dir = debugfs_create_dir("sptlrpc", debugfs_lustre_root);
+	sptlrpc_debugfs_dir = debugfs_create_dir("sptlrpc",
+						 debugfs_lustre_root);
 	ldebugfs_add_vars(sptlrpc_debugfs_dir, sptlrpc_lprocfs_vars, NULL);
 }
 
diff --git a/fs/lustre/ptlrpc/service.c b/fs/lustre/ptlrpc/service.c
index 5a7e9fa..a40e964 100644
--- a/fs/lustre/ptlrpc/service.c
+++ b/fs/lustre/ptlrpc/service.c
@@ -445,7 +445,8 @@ static void ptlrpc_at_timer(struct timer_list *t)
 	svc->srv_nthrs_cpt_init = init;
 
 	if (nthrs * svc->srv_ncpts > tc->tc_nthrs_max) {
-		CDEBUG(D_OTHER, "%s: This service may have more threads (%d) than the given soft limit (%d)\n",
+		CDEBUG(D_OTHER,
+		       "%s: This service may have more threads (%d) than the given soft limit (%d)\n",
 		       svc->srv_name, nthrs * svc->srv_ncpts,
 		       tc->tc_nthrs_max);
 	}
@@ -1042,7 +1043,8 @@ static int ptlrpc_at_send_early_reply(struct ptlrpc_request *req)
 		return 0;
 
 	if (olddl < 0) {
-		DEBUG_REQ(D_WARNING, req, "Already past deadline (%+lds), not sending early reply. Consider increasing at_early_margin (%d)?",
+		DEBUG_REQ(D_WARNING, req,
+			  "Already past deadline (%+lds), not sending early reply. Consider increasing at_early_margin (%d)?",
 			  olddl, at_early_margin);
 
 		/* Return an error so we're not re-added to the timed list. */
@@ -1050,7 +1052,8 @@ static int ptlrpc_at_send_early_reply(struct ptlrpc_request *req)
 	}
 
 	if (!(lustre_msghdr_get_flags(req->rq_reqmsg) & MSGHDR_AT_SUPPORT)) {
-		DEBUG_REQ(D_INFO, req, "Wanted to ask client for more time, but no AT support");
+		DEBUG_REQ(D_INFO, req,
+			  "Wanted to ask client for more time, but no AT support");
 		return -ENOSYS;
 	}
 
@@ -1098,7 +1101,8 @@ static int ptlrpc_at_send_early_reply(struct ptlrpc_request *req)
 	LASSERT(atomic_read(&req->rq_refcount));
 	/** if it is last refcount then early reply isn't needed */
 	if (atomic_read(&req->rq_refcount) == 1) {
-		DEBUG_REQ(D_ADAPTTO, reqcopy, "Normal reply already sent out, abort sending early reply\n");
+		DEBUG_REQ(D_ADAPTTO, reqcopy,
+			  "Normal reply already sent out, abort sending early reply\n");
 		rc = -EINVAL;
 		goto out;
 	}
@@ -1223,7 +1227,8 @@ static void ptlrpc_at_check_timed(struct ptlrpc_service_part *svcpt)
 
 	spin_unlock(&svcpt->scp_at_lock);
 
-	CDEBUG(D_ADAPTTO, "timeout in %+ds, asking for %d secs on %d early replies\n",
+	CDEBUG(D_ADAPTTO,
+	       "timeout in %+ds, asking for %d secs on %d early replies\n",
 	       first, at_extra, counter);
 	if (first < 0) {
 		/* We're already past request deadlines before we even get a
@@ -1566,7 +1571,8 @@ static bool ptlrpc_server_normal_pending(struct ptlrpc_service_part *svcpt,
 		if (rc == 0) {
 			rc = sptlrpc_target_export_check(req->rq_export, req);
 			if (rc)
-				DEBUG_REQ(D_ERROR, req, "DROPPING req with illegal security flavor,");
+				DEBUG_REQ(D_ERROR, req,
+					  "DROPPING req with illegal security flavor,");
 		}
 
 		if (rc)
@@ -1684,7 +1690,8 @@ static bool ptlrpc_server_normal_pending(struct ptlrpc_service_part *svcpt,
 	 * The deadline is increased if we send an early reply.
 	 */
 	if (ktime_get_real_seconds() > request->rq_deadline) {
-		DEBUG_REQ(D_ERROR, request, "Dropping timed-out request from %s: deadline %lld:%llds ago\n",
+		DEBUG_REQ(D_ERROR, request,
+			  "Dropping timed-out request from %s: deadline %lld:%llds ago\n",
 			  libcfs_id2str(request->rq_peer),
 			  request->rq_deadline -
 			  request->rq_arrival_time.tv_sec,
@@ -1692,7 +1699,8 @@ static bool ptlrpc_server_normal_pending(struct ptlrpc_service_part *svcpt,
 		goto put_conn;
 	}
 
-	CDEBUG(D_RPCTRACE, "Handling RPC pname:cluuid+ref:pid:xid:nid:opc %s:%s+%d:%d:x%llu:%s:%d\n",
+	CDEBUG(D_RPCTRACE,
+	       "Handling RPC pname:cluuid+ref:pid:xid:nid:opc %s:%s+%d:%d:x%llu:%s:%d\n",
 	       current->comm,
 	       (request->rq_export ?
 		(char *)request->rq_export->exp_client_uuid.uuid : "0"),
@@ -1722,8 +1730,7 @@ static bool ptlrpc_server_normal_pending(struct ptlrpc_service_part *svcpt,
 put_conn:
 	if (unlikely(ktime_get_real_seconds() > request->rq_deadline)) {
 		DEBUG_REQ(D_WARNING, request,
-			  "Request took longer than estimated (%lld:%llds); "
-			  "client may timeout.",
+			  "Request took longer than estimated (%lld:%llds); client may timeout.",
 			  (s64)request->rq_deadline -
 			       request->rq_arrival_time.tv_sec,
 			  (s64)ktime_get_real_seconds() - request->rq_deadline);
@@ -1736,7 +1743,8 @@ static bool ptlrpc_server_normal_pending(struct ptlrpc_service_part *svcpt,
 	arrived = timespec64_sub(work_end, request->rq_arrival_time);
 	arrived_usecs = arrived.tv_sec * USEC_PER_SEC +
 			 arrived.tv_nsec / NSEC_PER_USEC;
-	CDEBUG(D_RPCTRACE, "Handled RPC pname:cluuid+ref:pid:xid:nid:opc %s:%s+%d:%d:x%llu:%s:%d Request processed in %ldus (%ldus total) trans %llu rc %d/%d\n",
+	CDEBUG(D_RPCTRACE,
+	       "Handled RPC pname:cluuid+ref:pid:xid:nid:opc %s:%s+%d:%d:x%llu:%s:%d Request processed in %ldus (%ldus total) trans %llu rc %d/%d\n",
 	       current->comm,
 	       (request->rq_export ?
 		(char *)request->rq_export->exp_client_uuid.uuid : "0"),
@@ -1841,9 +1849,9 @@ static bool ptlrpc_server_normal_pending(struct ptlrpc_service_part *svcpt,
 		/* If we see this, we should already have seen the warning
 		 * in mds_steal_ack_locks()
 		 */
-		CDEBUG(D_HA, "All locks stolen from rs %p x%lld.t%lld o%d NID %s\n",
-		       rs,
-		       rs->rs_xid, rs->rs_transno, rs->rs_opc,
+		CDEBUG(D_HA,
+		       "All locks stolen from rs %p x%lld.t%lld o%d NID %s\n",
+		       rs, rs->rs_xid, rs->rs_transno, rs->rs_opc,
 		       libcfs_nid2str(exp->exp_connection->c_peer.nid));
 	}
 
@@ -1995,7 +2003,7 @@ static __attribute__((__noinline__)) int
 						      false) ||
 			ptlrpc_rqbd_pending(svcpt) ||
 			ptlrpc_at_check(svcpt));
-	else if (0 == wait_event_idle_exclusive_lifo_timeout(
+	else if (wait_event_idle_exclusive_lifo_timeout(
 			 svcpt->scp_waitq,
 			 ptlrpc_thread_stopping(thread) ||
 			 ptlrpc_server_request_incoming(svcpt) ||
@@ -2003,7 +2011,7 @@ static __attribute__((__noinline__)) int
 						       false) ||
 			 ptlrpc_rqbd_pending(svcpt) ||
 			 ptlrpc_at_check(svcpt),
-			 svcpt->scp_rqbd_timeout))
+			 svcpt->scp_rqbd_timeout) == 0)
 		svcpt->scp_rqbd_timeout = 0;
 
 	if (ptlrpc_thread_stopping(thread))
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [lustre-devel] [PATCH 02/11] lustre: llite: checkpatch cleanup
  2019-07-22  1:52 [lustre-devel] [PATCH 00/11] lustre: cleanup most check patch issues James Simmons
  2019-07-22  1:52 ` [lustre-devel] [PATCH 01/11] lustre: ptlrpc: checkpatch cleanup James Simmons
@ 2019-07-22  1:52 ` James Simmons
  2019-07-22  1:52 ` [lustre-devel] [PATCH 03/11] lustre: fid: " James Simmons
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 19+ messages in thread
From: James Simmons @ 2019-07-22  1:52 UTC (permalink / raw)
  To: lustre-devel

Many checkpatch errors exist in the llite layer. This address
a good chuck of them. Other are left since future patches will
cleanup those areas. Others will need more code rework so this
patch handles the simple cases. This is a good step forward
toward proper kernel code style compliance.

Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/llite/dir.c            | 18 ++++++++----------
 fs/lustre/llite/file.c           | 24 ++++++++++++------------
 fs/lustre/llite/llite_internal.h |  8 +++++---
 fs/lustre/llite/llite_lib.c      | 26 ++++++++++++++------------
 fs/lustre/llite/llite_nfs.c      |  3 ++-
 fs/lustre/llite/lproc_llite.c    |  8 +++++---
 fs/lustre/llite/namei.c          | 15 ++++++++++-----
 fs/lustre/llite/rw26.c           |  3 ++-
 fs/lustre/llite/statahead.c      | 23 +++++++++++++++--------
 fs/lustre/llite/super25.c        |  3 ++-
 fs/lustre/llite/vvp_dev.c        |  3 ++-
 fs/lustre/llite/vvp_io.c         |  2 +-
 12 files changed, 78 insertions(+), 58 deletions(-)

diff --git a/fs/lustre/llite/dir.c b/fs/lustre/llite/dir.c
index 1fbfc3a..ba53c1e 100644
--- a/fs/lustre/llite/dir.c
+++ b/fs/lustre/llite/dir.c
@@ -423,7 +423,8 @@ static int ll_dir_setdirstripe(struct dentry *dparent, struct lmv_user_md *lump,
 	if (unlikely(lump->lum_magic != LMV_USER_MAGIC))
 		return -EINVAL;
 
-	CDEBUG(D_VFSTRACE, "VFS Op:inode=" DFID "(%p) name %s stripe_offset %d, stripe_count: %u\n",
+	CDEBUG(D_VFSTRACE,
+	       "VFS Op:inode=" DFID "(%p) name %s stripe_offset %d, stripe_count: %u\n",
 	       PFID(ll_inode2fid(parent)), parent, dirname,
 	       (int)lump->lum_stripe_offset, lump->lum_stripe_count);
 
@@ -517,24 +518,20 @@ int ll_dir_setstripe(struct inode *inode, struct lov_user_md *lump,
 		}
 		case LOV_USER_MAGIC_V3: {
 			if (lump->lmm_magic != cpu_to_le32(LOV_USER_MAGIC_V3))
-				lustre_swab_lov_user_md_v3(
-					(struct lov_user_md_v3 *)lump);
+				lustre_swab_lov_user_md_v3((struct lov_user_md_v3 *)lump);
 			lum_size = sizeof(struct lov_user_md_v3);
 			break;
 		}
 		case LOV_USER_MAGIC_COMP_V1: {
 			if (lump->lmm_magic !=
 			    cpu_to_le32(LOV_USER_MAGIC_COMP_V1))
-				lustre_swab_lov_comp_md_v1(
-					(struct lov_comp_md_v1 *)lump);
-			lum_size = le32_to_cpu(
-				((struct lov_comp_md_v1 *)lump)->lcm_size);
+				lustre_swab_lov_comp_md_v1((struct lov_comp_md_v1 *)lump);
+			lum_size = le32_to_cpu(((struct lov_comp_md_v1 *)lump)->lcm_size);
 			break;
 		}
 		case LMV_USER_MAGIC: {
 			if (lump->lmm_magic != cpu_to_le32(LMV_USER_MAGIC))
-				lustre_swab_lmv_user_md(
-					(struct lmv_user_md *)lump);
+				lustre_swab_lmv_user_md((struct lmv_user_md *)lump);
 			lum_size = sizeof(struct lmv_user_md);
 			break;
 		}
@@ -877,7 +874,8 @@ static int ll_ioc_copy_end(struct super_block *sb, struct hsm_copy *copy)
 		 */
 		if ((copy->hc_hai.hai_action == HSMA_ARCHIVE) &&
 		    (copy->hc_data_version != data_version)) {
-			CDEBUG(D_HSM, "File data version mismatched. File content was changed during archiving. " DFID ", start:%#llx current:%#llx\n",
+			CDEBUG(D_HSM,
+			       "File data version mismatched. File content was changed during archiving. " DFID ", start:%#llx current:%#llx\n",
 			       PFID(&copy->hc_hai.hai_fid),
 			       copy->hc_data_version, data_version);
 			/* File was changed, send error to cdt. Do not ask for
diff --git a/fs/lustre/llite/file.c b/fs/lustre/llite/file.c
index fd53a3a..faf4fb8 100644
--- a/fs/lustre/llite/file.c
+++ b/fs/lustre/llite/file.c
@@ -587,7 +587,7 @@ int ll_file_open(struct inode *inode, struct file *file)
 	} else {
 		LASSERT(*och_usecount == 0);
 		if (!it->it_disposition) {
-			struct ll_dentry_data *ldd = ll_d2d(file->f_path.dentry);
+			struct ll_dentry_data *ldd;
 
 			/* We cannot just request lock handle now, new ELC code
 			 * means that one of other OPEN locks for this file
@@ -611,6 +611,7 @@ int ll_file_open(struct inode *inode, struct file *file)
 			 * lookup path only, since ll_iget_for_nfs always calls
 			 * ll_d_init().
 			 */
+			ldd = ll_d2d(file->f_path.dentry);
 			if (ldd && ldd->lld_nfs_dentry) {
 				ldd->lld_nfs_dentry = 0;
 				it->it_flags |= MDS_OPEN_LOCK;
@@ -1460,15 +1461,13 @@ int ll_lov_getstripe_ea_info(struct inode *inode, const char *filename,
 		if (lmm->lmm_magic == cpu_to_le32(LOV_MAGIC_V1)) {
 			lustre_swab_lov_user_md_v1((struct lov_user_md_v1 *)lmm);
 			if (S_ISREG(body->mbo_mode))
-				lustre_swab_lov_user_md_objects(
-				 ((struct lov_user_md_v1 *)lmm)->lmm_objects,
-				 stripe_count);
+				lustre_swab_lov_user_md_objects(((struct lov_user_md_v1 *)lmm)->lmm_objects,
+								stripe_count);
 		} else if (lmm->lmm_magic == cpu_to_le32(LOV_MAGIC_V3)) {
 			lustre_swab_lov_user_md_v3((struct lov_user_md_v3 *)lmm);
 			if (S_ISREG(body->mbo_mode))
-				lustre_swab_lov_user_md_objects(
-				 ((struct lov_user_md_v3 *)lmm)->lmm_objects,
-				 stripe_count);
+				lustre_swab_lov_user_md_objects(((struct lov_user_md_v3 *)lmm)->lmm_objects,
+								stripe_count);
 		} else if (lmm->lmm_magic == cpu_to_le32(LOV_MAGIC_COMP_V1)) {
 			lustre_swab_lov_comp_md_v1((struct lov_comp_md_v1 *)lmm);
 		}
@@ -2237,7 +2236,7 @@ int ll_ioctl_fsgetxattr(struct inode *inode, unsigned int cmd,
 		fsxattr.fsx_xflags |= FS_XFLAG_PROJINHERIT;
 	fsxattr.fsx_projid = ll_i2info(inode)->lli_projid;
 	if (copy_to_user((struct fsxattr __user *)arg,
-			  &fsxattr, sizeof(fsxattr)))
+			 &fsxattr, sizeof(fsxattr)))
 		return -EFAULT;
 
 	return 0;
@@ -2344,9 +2343,9 @@ int ll_ioctl_fssetxattr(struct inode *inode, unsigned int cmd,
 		return 0;
 	case LL_IOC_LOV_SETSTRIPE:
 	case LL_IOC_LOV_SETSTRIPE_NEW:
-		return ll_lov_setstripe(inode, file, (void __user *) arg);
+		return ll_lov_setstripe(inode, file, (void __user *)arg);
 	case LL_IOC_LOV_SETEA:
-		return ll_lov_setea(inode, file, (void __user *) arg);
+		return ll_lov_setea(inode, file, (void __user *)arg);
 	case LL_IOC_LOV_SWAP_LAYOUTS: {
 		struct file *file2;
 		struct lustre_swap_layouts lsl;
@@ -2959,7 +2958,8 @@ int ll_fsync(struct file *file, loff_t start, loff_t end, int datasync)
 	if (IS_ERR(op_data))
 		return PTR_ERR(op_data);
 
-	CDEBUG(D_DLMTRACE, "inode=" DFID ", pid=%u, flags=%#llx, mode=%u, start=%llu, end=%llu\n",
+	CDEBUG(D_DLMTRACE,
+	       "inode=" DFID ", pid=%u, flags=%#llx, mode=%u, start=%llu, end=%llu\n",
 	       PFID(ll_inode2fid(inode)), flock.l_flock.pid, flags,
 	       einfo.ei_mode, flock.l_flock.start, flock.l_flock.end);
 
@@ -3167,7 +3167,7 @@ int ll_migrate(struct inode *parent, struct file *file, int mdtidx,
 static int
 ll_file_noflock(struct file *file, int cmd, struct file_lock *file_lock)
 {
-	return -ENOSYS;
+	return -EINVAL;
 }
 
 /**
diff --git a/fs/lustre/llite/llite_internal.h b/fs/lustre/llite/llite_internal.h
index 9da59b1..b8f4e0e 100644
--- a/fs/lustre/llite/llite_internal.h
+++ b/fs/lustre/llite/llite_internal.h
@@ -267,7 +267,7 @@ static inline bool obd_connect_has_secctx(struct obd_connect_data *data)
 	return data->ocd_connect_flags & OBD_CONNECT_FLAGS2 &&
 	       data->ocd_connect_flags2 & OBD_CONNECT2_FILE_SECCTX;
 #else
-       return false;
+	return false;
 #endif
 }
 
@@ -1079,6 +1079,7 @@ enum ras_update_flags {
 	LL_RAS_HIT  = 0x1,
 	LL_RAS_MMAP = 0x2
 };
+
 void ll_ra_count_put(struct ll_sb_info *sbi, unsigned long len);
 void ll_ra_stats_inc(struct inode *inode, enum ra_stat which);
 
@@ -1096,7 +1097,7 @@ enum ras_update_flags {
 #define LL_SA_RUNNING_DEF	16
 
 #define LL_SA_CACHE_BIT	 5
-#define LL_SA_CACHE_SIZE	(1 << LL_SA_CACHE_BIT)
+#define LL_SA_CACHE_SIZE	BIT(LL_SA_CACHE_BIT)
 #define LL_SA_CACHE_MASK	(LL_SA_CACHE_SIZE - 1)
 
 /* per inode struct, for dir only */
@@ -1256,7 +1257,8 @@ static inline void ll_set_lock_data(struct obd_export *exp, struct inode *inode,
 		 */
 		if (it->it_remote_lock_mode) {
 			handle.cookie = it->it_remote_lock_handle;
-			CDEBUG(D_DLMTRACE, "setting l_data to inode " DFID "%p for remote lock %#llx\n",
+			CDEBUG(D_DLMTRACE,
+			       "setting l_data to inode " DFID "%p for remote lock %#llx\n",
 			       PFID(ll_inode2fid(inode)), inode,
 			       handle.cookie);
 			md_set_lock_data(exp, &handle, inode, NULL);
diff --git a/fs/lustre/llite/llite_lib.c b/fs/lustre/llite/llite_lib.c
index 4e98eb4..4e09f0f 100644
--- a/fs/lustre/llite/llite_lib.c
+++ b/fs/lustre/llite/llite_lib.c
@@ -93,7 +93,7 @@ static struct ll_sb_info *ll_init_sbi(void)
 	}
 
 	sbi->ll_ra_info.ra_max_pages_per_file = min(pages / 32,
-					   SBI_DEFAULT_READAHEAD_MAX);
+						    SBI_DEFAULT_READAHEAD_MAX);
 	sbi->ll_ra_info.ra_max_pages = sbi->ll_ra_info.ra_max_pages_per_file;
 	sbi->ll_ra_info.ra_max_read_ahead_whole_pages =
 					   SBI_DEFAULT_READAHEAD_WHOLE_MAX;
@@ -110,10 +110,11 @@ static struct ll_sb_info *ll_init_sbi(void)
 	sbi->ll_flags |= LL_SBI_LAZYSTATFS;
 
 	for (i = 0; i <= LL_PROCESS_HIST_MAX; i++) {
-		spin_lock_init(&sbi->ll_rw_extents_info.pp_extents[i].
-			       pp_r_hist.oh_lock);
-		spin_lock_init(&sbi->ll_rw_extents_info.pp_extents[i].
-			       pp_w_hist.oh_lock);
+		struct per_process_info *pp_ext;
+
+		pp_ext = &sbi->ll_rw_extents_info.pp_extents[i];
+		spin_lock_init(&pp_ext->pp_r_hist.oh_lock);
+		spin_lock_init(&pp_ext->pp_w_hist.oh_lock);
 	}
 
 	/* metadata statahead is enabled by default */
@@ -353,9 +354,8 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt)
 
 	if (data->ocd_ibits_known & MDS_INODELOCK_XATTR) {
 		if (!(data->ocd_connect_flags & OBD_CONNECT_MAX_EASIZE)) {
-			LCONSOLE_INFO(
-				"%s: disabling xattr cache due to unknown maximum xattr size.\n",
-				dt);
+			LCONSOLE_INFO("%s: disabling xattr cache due to unknown maximum xattr size.\n",
+				      dt);
 		} else if (!sbi->ll_xattr_cache_set) {
 			/* If xattr_cache is already set (no matter 0 or 1)
 			 * during processing llog, it won't be enabled here.
@@ -377,7 +377,8 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt)
 	data->ocd_connect_flags = OBD_CONNECT_GRANT     | OBD_CONNECT_VERSION  |
 				  OBD_CONNECT_REQPORTAL | OBD_CONNECT_BRW_SIZE |
 				  OBD_CONNECT_CANCELSET | OBD_CONNECT_FID      |
-				  OBD_CONNECT_SRVLOCK   | OBD_CONNECT_TRUNCLOCK|
+				  OBD_CONNECT_SRVLOCK   |
+				  OBD_CONNECT_TRUNCLOCK |
 				  OBD_CONNECT_AT	| OBD_CONNECT_OSS_CAPA |
 				  OBD_CONNECT_VBR	| OBD_CONNECT_FULL20   |
 				  OBD_CONNECT_64BITHASH | OBD_CONNECT_MAXBYTES |
@@ -2063,7 +2064,7 @@ int ll_iocontrol(struct inode *inode, struct file *file,
 		return rc;
 	}
 	default:
-		return -ENOSYS;
+		return -EINVAL;
 	}
 
 	return 0;
@@ -2235,8 +2236,9 @@ int ll_prep_inode(struct inode **inode, struct ptlrpc_request *req,
 			goto out;
 		}
 
-		*inode = ll_iget(sb, cl_fid_build_ino(&md.body->mbo_fid1,
-					     sbi->ll_flags & LL_SBI_32BIT_API),
+		*inode = ll_iget(sb,
+				 cl_fid_build_ino(&md.body->mbo_fid1,
+						  sbi->ll_flags & LL_SBI_32BIT_API),
 				 &md);
 		if (IS_ERR(*inode)) {
 #ifdef CONFIG_FS_POSIX_ACL
diff --git a/fs/lustre/llite/llite_nfs.c b/fs/lustre/llite/llite_nfs.c
index 9129f47..64bff0a 100644
--- a/fs/lustre/llite/llite_nfs.c
+++ b/fs/lustre/llite/llite_nfs.c
@@ -218,7 +218,8 @@ static int ll_nfs_get_name_filldir(struct dir_context *ctx, const char *name,
 	/* It is hack to access lde_fid for comparison with lgd_fid.
 	 * So the input 'name' must be part of the 'lu_dirent'.
 	 */
-	struct lu_dirent *lde = container_of((void*)name, struct lu_dirent, lde_name);
+	struct lu_dirent *lde = container_of((void *)name, struct lu_dirent,
+					     lde_name);
 	struct ll_getname_data *lgd =
 		container_of(ctx, struct ll_getname_data, ctx);
 	struct lu_fid fid;
diff --git a/fs/lustre/llite/lproc_llite.c b/fs/lustre/llite/lproc_llite.c
index 7cb1c28..99e8a82 100644
--- a/fs/lustre/llite/lproc_llite.c
+++ b/fs/lustre/llite/lproc_llite.c
@@ -501,7 +501,8 @@ static ssize_t ll_max_cached_mb_seq_write(struct file *file,
 					  const char __user *buffer,
 					  size_t count, loff_t *off)
 {
-	struct super_block *sb = ((struct seq_file *)file->private_data)->private;
+	struct seq_file *m = file->private_data;
+	struct super_block *sb = m->private;
 	struct ll_sb_info *sbi = ll_s2sbi(sb);
 	struct cl_client_cache *cache = sbi->ll_cache;
 	struct lu_env *env;
@@ -1094,7 +1095,8 @@ static ssize_t ll_unstable_stats_seq_write(struct file *file,
 					   const char __user *buffer,
 					   size_t count, loff_t *off)
 {
-	struct super_block *sb = ((struct seq_file *)file->private_data)->private;
+	struct seq_file *m = file->private_data;
+	struct super_block *sb = m->private;
 	struct ll_sb_info *sbi = ll_s2sbi(sb);
 	char kernbuf[128];
 	bool val;
@@ -1320,7 +1322,7 @@ void ll_stats_ops_tally(struct ll_sb_info *sbi, int op, int count)
 }
 EXPORT_SYMBOL(ll_stats_ops_tally);
 
-static const char *ra_stat_string[] = {
+static const char *const ra_stat_string[] = {
 	[RA_STAT_HIT]			= "hits",
 	[RA_STAT_MISS]			= "misses",
 	[RA_STAT_DISTANT_READPAGE]	= "readpage not consecutive",
diff --git a/fs/lustre/llite/namei.c b/fs/lustre/llite/namei.c
index a87c8a2..caa759f 100644
--- a/fs/lustre/llite/namei.c
+++ b/fs/lustre/llite/namei.c
@@ -263,13 +263,16 @@ int ll_md_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc,
 				       PFID(ll_inode2fid(inode)), rc);
 		}
 
-		if (bits & MDS_INODELOCK_UPDATE)
-			set_bit(LLIF_UPDATE_ATIME, &ll_i2info(inode)->lli_flags);
+		if (bits & MDS_INODELOCK_UPDATE) {
+			set_bit(LLIF_UPDATE_ATIME,
+				&ll_i2info(inode)->lli_flags);
+		}
 
 		if ((bits & MDS_INODELOCK_UPDATE) && S_ISDIR(inode->i_mode)) {
 			struct ll_inode_info *lli = ll_i2info(inode);
 
-			CDEBUG(D_INODE, "invalidating inode " DFID " lli = %p, pfid  = " DFID "\n",
+			CDEBUG(D_INODE,
+			       "invalidating inode " DFID " lli = %p, pfid  = " DFID "\n",
 			       PFID(ll_inode2fid(inode)), lli,
 			       PFID(&lli->lli_pfid));
 
@@ -563,7 +566,8 @@ static struct dentry *ll_lookup_it(struct inode *parent, struct dentry *dentry,
 		}
 	}
 
-	if (it->it_op & IT_OPEN && it->it_flags & FMODE_WRITE && sb_rdonly(dentry->d_sb))
+	if (it->it_op & IT_OPEN && it->it_flags & FMODE_WRITE &&
+	    sb_rdonly(dentry->d_sb))
 		return ERR_PTR(-EROFS);
 
 	if (it->it_op & IT_CREAT)
@@ -714,7 +718,8 @@ static int ll_atomic_open(struct inode *dir, struct dentry *dentry,
 	struct dentry *de;
 	int rc = 0;
 
-	CDEBUG(D_VFSTRACE, "VFS Op:name=%pd, dir=" DFID "(%p),file %p,open_flags %x,mode %x\n",
+	CDEBUG(D_VFSTRACE,
+	       "VFS Op:name=%pd, dir=" DFID "(%p),file %p,open_flags %x,mode %x\n",
 	       dentry, PFID(ll_inode2fid(dir)), dir, file, open_flags, mode);
 
 	/* Only negative dentries enter here */
diff --git a/fs/lustre/llite/rw26.c b/fs/lustre/llite/rw26.c
index e4ce3b6..805ba32 100644
--- a/fs/lustre/llite/rw26.c
+++ b/fs/lustre/llite/rw26.c
@@ -306,7 +306,8 @@ static ssize_t ll_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
 	if ((file_offset & ~PAGE_MASK) || (count & ~PAGE_MASK))
 		return -EINVAL;
 
-	CDEBUG(D_VFSTRACE, "VFS Op:inode=" DFID "(%p), size=%zd (max %lu), offset=%lld=%llx, pages %zd (max %lu)\n",
+	CDEBUG(D_VFSTRACE,
+	       "VFS Op:inode=" DFID "(%p), size=%zd (max %lu), offset=%lld=%llx, pages %zd (max %lu)\n",
 	       PFID(ll_inode2fid(inode)), inode, count, MAX_DIO_SIZE,
 	       file_offset, file_offset, count >> PAGE_SHIFT,
 	       MAX_DIO_SIZE >> PAGE_SHIFT);
diff --git a/fs/lustre/llite/statahead.c b/fs/lustre/llite/statahead.c
index 53bab47..797ad06 100644
--- a/fs/lustre/llite/statahead.c
+++ b/fs/lustre/llite/statahead.c
@@ -265,8 +265,8 @@ static void sa_free(struct ll_statahead_info *sai, struct sa_entry *entry)
 }
 
 /* called by scanner after use, sa_entry will be killed */
-static void
-sa_put(struct ll_statahead_info *sai, struct sa_entry *entry, struct ll_inode_info *lli)
+static void sa_put(struct ll_statahead_info *sai, struct sa_entry *entry,
+		   struct ll_inode_info *lli)
 {
 	struct sa_entry *tmp, *next;
 
@@ -326,7 +326,8 @@ static void sa_free(struct ll_statahead_info *sai, struct sa_entry *entry)
 	 * LU-9210: ll_statahead_interpet must be able to see this before
 	 * we wake it up
 	 */
-	smp_store_release(&entry->se_state, ret < 0 ? SA_ENTRY_INVA : SA_ENTRY_SUCC);
+	smp_store_release(&entry->se_state,
+			  ret < 0 ? SA_ENTRY_INVA : SA_ENTRY_SUCC);
 
 	return (index == sai->sai_index_wait);
 }
@@ -590,7 +591,8 @@ static void sa_instantiate(struct ll_statahead_info *sai,
 	child = entry->se_inode;
 	if (child) {
 		/* revalidate; unlinked and re-created with the same name */
-		if (unlikely(!lu_fid_eq(&minfo->mi_data.op_fid2, &body->mbo_fid1))) {
+		if (unlikely(!lu_fid_eq(&minfo->mi_data.op_fid2,
+					&body->mbo_fid1))) {
 			entry->se_inode = NULL;
 			iput(child);
 			child = NULL;
@@ -701,6 +703,7 @@ static int ll_statahead_interpret(struct ptlrpc_request *req,
 			wake_up(&sai->sai_waitq);
 	} else {
 		int first = 0;
+
 		entry->se_minfo = minfo;
 		entry->se_req = ptlrpc_request_addref(req);
 		/*
@@ -881,7 +884,9 @@ static int ll_agl_thread(void *arg)
 	struct inode *dir = d_inode(parent);
 	struct ll_inode_info *plli = ll_i2info(dir);
 	struct ll_inode_info *clli;
-	/* We already own this reference, so it is safe to take it without a lock. */
+	/* We already own this reference, so it is safe to take it without
+	 * a lock.
+	 */
 	struct ll_statahead_info *sai = plli->lli_sai;
 
 	CDEBUG(D_READA, "agl thread started: sai %p, parent %pd\n",
@@ -1113,7 +1118,9 @@ static int ll_statahead_thread(void *arg)
 		sa_handle_callback(sai);
 
 		set_current_state(TASK_IDLE);
-		/* ensure we see the NULL stored by ll_deauthorize_statahead() */
+		/* ensure we see the NULL stored by
+		 * ll_deauthorize_statahead()
+		 */
 		if (!sa_has_callback(sai) &&
 		    smp_load_acquire(&sai->sai_task))
 			schedule();
@@ -1408,8 +1415,8 @@ static int revalidate_statahead_dentry(struct inode *dir,
 		spin_lock(&lli->lli_sa_lock);
 		sai->sai_index_wait = entry->se_index;
 		spin_unlock(&lli->lli_sa_lock);
-		if (0 == wait_event_idle_timeout(sai->sai_waitq,
-						 sa_ready(entry), 30 * HZ)) {
+		if (wait_event_idle_timeout(sai->sai_waitq,
+					    sa_ready(entry), 30 * HZ) == 0) {
 			/*
 			 * entry may not be ready, so it may be used by inflight
 			 * statahead RPC, don't free it.
diff --git a/fs/lustre/llite/super25.c b/fs/lustre/llite/super25.c
index a25d03c..2b65e2f 100644
--- a/fs/lustre/llite/super25.c
+++ b/fs/lustre/llite/super25.c
@@ -89,7 +89,8 @@ struct super_operations lustre_super_operations = {
  *
  * @data:	Mount options (e.g. -o flock,abort_recov)
  */
-static int lustre_fill_super(struct super_block *sb, void *lmd2_data, int silent)
+static int lustre_fill_super(struct super_block *sb, void *lmd2_data,
+			     int silent)
 {
 	struct lustre_mount_data *lmd;
 	struct lustre_sb_info *lsi;
diff --git a/fs/lustre/llite/vvp_dev.c b/fs/lustre/llite/vvp_dev.c
index 568943d..4c5a29d 100644
--- a/fs/lustre/llite/vvp_dev.c
+++ b/fs/lustre/llite/vvp_dev.c
@@ -451,7 +451,8 @@ static struct page *vvp_pgcache_current(struct vvp_seq_private *priv)
 		}
 
 		inode = vvp_object_inode(priv->vsp_clob);
-		nr = find_get_pages_contig(inode->i_mapping, priv->vsp_id.vpi_index, 1, &vmpage);
+		nr = find_get_pages_contig(inode->i_mapping,
+					   priv->vsp_id.vpi_index, 1, &vmpage);
 		if (nr > 0) {
 			priv->vsp_id.vpi_index = vmpage->index;
 			return vmpage;
diff --git a/fs/lustre/llite/vvp_io.c b/fs/lustre/llite/vvp_io.c
index 225a858..b2160d6 100644
--- a/fs/lustre/llite/vvp_io.c
+++ b/fs/lustre/llite/vvp_io.c
@@ -641,7 +641,7 @@ static int vvp_io_setattr_time(const struct lu_env *env,
 	struct cl_object *obj = io->ci_obj;
 	struct cl_attr *attr = vvp_env_thread_attr(env);
 	int result;
-	unsigned valid = CAT_CTIME;
+	unsigned int valid = CAT_CTIME;
 
 	cl_object_attr_lock(obj);
 	attr->cat_ctime = io->u.ci_setattr.sa_attr.lvb_ctime;
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [lustre-devel] [PATCH 03/11] lustre: fid: checkpatch cleanup
  2019-07-22  1:52 [lustre-devel] [PATCH 00/11] lustre: cleanup most check patch issues James Simmons
  2019-07-22  1:52 ` [lustre-devel] [PATCH 01/11] lustre: ptlrpc: checkpatch cleanup James Simmons
  2019-07-22  1:52 ` [lustre-devel] [PATCH 02/11] lustre: llite: " James Simmons
@ 2019-07-22  1:52 ` James Simmons
  2019-07-22  1:52 ` [lustre-devel] [PATCH 04/11] lustre: mgc: " James Simmons
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 19+ messages in thread
From: James Simmons @ 2019-07-22  1:52 UTC (permalink / raw)
  To: lustre-devel

Various checkpatch errors exist in the fid /fld layer. This work
address all of those issues making this layer checkpatch error
free.

Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/fid/fid_request.c  | 1 -
 fs/lustre/fid/lproc_fid.c    | 3 ++-
 fs/lustre/fld/fld_internal.h | 5 +++--
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/fs/lustre/fid/fid_request.c b/fs/lustre/fid/fid_request.c
index 45dd275..cdf5402 100644
--- a/fs/lustre/fid/fid_request.c
+++ b/fs/lustre/fid/fid_request.c
@@ -267,7 +267,6 @@ int seq_client_alloc_fid(const struct lu_env *env,
  */
 void seq_client_flush(struct lu_client_seq *seq)
 {
-
 	LASSERT(seq);
 	spin_lock(&seq->lcs_lock);
 
diff --git a/fs/lustre/fid/lproc_fid.c b/fs/lustre/fid/lproc_fid.c
index d7d23b4..94869d4 100644
--- a/fs/lustre/fid/lproc_fid.c
+++ b/fs/lustre/fid/lproc_fid.c
@@ -131,7 +131,8 @@
 	if (seq->lcs_update)
 		rc = -EBUSY;
 	else
-		seq_printf(m, "[%#llx - %#llx]:%x:%s\n", PRANGE(&seq->lcs_space));
+		seq_printf(m, "[%#llx - %#llx]:%x:%s\n",
+			   PRANGE(&seq->lcs_space));
 	spin_unlock(&seq->lcs_lock);
 
 	return rc;
diff --git a/fs/lustre/fld/fld_internal.h b/fs/lustre/fld/fld_internal.h
index e2eda59..465c6ccf 100644
--- a/fs/lustre/fld/fld_internal.h
+++ b/fs/lustre/fld/fld_internal.h
@@ -70,8 +70,9 @@ struct fld_stats {
 
 struct lu_fld_hash {
 	const char	      *fh_name;
-	int (*fh_hash_func)(struct lu_client_fld *, u64);
-	struct lu_fld_target *(*fh_scan_func)(struct lu_client_fld *, u64);
+	int (*fh_hash_func)(struct lu_client_fld *fld, u64 seq);
+	struct lu_fld_target *(*fh_scan_func)(struct lu_client_fld *fld,
+					      u64 seq);
 };
 
 struct fld_cache_entry {
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [lustre-devel] [PATCH 04/11] lustre: mgc: checkpatch cleanup
  2019-07-22  1:52 [lustre-devel] [PATCH 00/11] lustre: cleanup most check patch issues James Simmons
                   ` (2 preceding siblings ...)
  2019-07-22  1:52 ` [lustre-devel] [PATCH 03/11] lustre: fid: " James Simmons
@ 2019-07-22  1:52 ` James Simmons
  2019-07-22  1:52 ` [lustre-devel] [PATCH 05/11] lustre: lmv: " James Simmons
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 19+ messages in thread
From: James Simmons @ 2019-07-22  1:52 UTC (permalink / raw)
  To: lustre-devel

Many checkpatch errors exist in the mgc layer. This address
a good chuck of them. Other are left since future patches will
cleanup those areas. Others will need more code rework so this
patch handles the simple cases. This is a good step forward
toward proper kernel code style compliance.

Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/mgc/mgc_request.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/fs/lustre/mgc/mgc_request.c b/fs/lustre/mgc/mgc_request.c
index 5ce49e7..fa0be5c 100644
--- a/fs/lustre/mgc/mgc_request.c
+++ b/fs/lustre/mgc/mgc_request.c
@@ -96,7 +96,8 @@ int mgc_fsname2resid(char *fsname, struct ldlm_res_id *res_id, int type)
 }
 EXPORT_SYMBOL(mgc_fsname2resid);
 
-static int mgc_logname2resid(char *logname, struct ldlm_res_id *res_id, int type)
+static int mgc_logname2resid(char *logname, struct ldlm_res_id *res_id,
+			     int type)
 {
 	char *name_end;
 	int len;
@@ -474,7 +475,7 @@ int lprocfs_mgc_rd_ir_state(struct seq_file *m, void *data)
 
 	seq_printf(m, "imperative_recovery: %s\n",
 		   OCD_HAS_FLAG(ocd, IMP_RECOV) ? "ENABLED" : "DISABLED");
-	seq_printf(m, "client_state:\n");
+	seq_puts(m, "client_state:\n");
 
 	spin_lock(&config_list_lock);
 	list_for_each_entry(cld, &config_llog_list, cld_list_chain) {
@@ -821,7 +822,8 @@ static int mgc_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc,
 		 */
 		if (!lock->l_conn_export ||
 		    !lock->l_conn_export->exp_obd->u.cli.cl_conn_count) {
-			CDEBUG(D_MGC, "log %.8s: disconnecting, won't requeue\n",
+			CDEBUG(D_MGC,
+			       "log %.8s: disconnecting, won't requeue\n",
 			       cld->cld_logname);
 			config_log_put(cld);
 			break;
@@ -874,7 +876,8 @@ static int mgc_set_mgs_param(struct obd_export *exp,
 	req->rq_delay_limit = MGC_SEND_PARAM_LIMIT;
 	rc = ptlrpc_queue_wait(req);
 	if (!rc) {
-		rep_msp = req_capsule_server_get(&req->rq_pill, &RMF_MGS_SEND_PARAM);
+		rep_msp = req_capsule_server_get(&req->rq_pill,
+						 &RMF_MGS_SEND_PARAM);
 		memcpy(msp, rep_msp, sizeof(*rep_msp));
 	}
 
@@ -1733,7 +1736,7 @@ static int mgc_process_config(struct obd_device *obd, u32 len, void *buf)
 	case LCFG_LOV_DEL_OBD:
 		/* Unregister has no meaning at the moment. */
 		CERROR("lov_del_obd unimplemented\n");
-		rc = -ENOSYS;
+		rc = -ENXIO;
 		break;
 	case LCFG_SPTLRPC_CONF: {
 		rc = sptlrpc_process_config(lcfg);
@@ -1765,8 +1768,8 @@ static int mgc_process_config(struct obd_device *obd, u32 len, void *buf)
 
 		rc = mgc_process_log(obd, cld);
 		if (rc == 0 && cld->cld_recover) {
-			if (OCD_HAS_FLAG(&obd->u.cli.cl_import->
-					 imp_connect_data, IMP_RECOV)) {
+			if (OCD_HAS_FLAG(&obd->u.cli.cl_import->imp_connect_data,
+					 IMP_RECOV)) {
 				rc = mgc_process_log(obd, cld->cld_recover);
 			} else {
 				struct config_llog_data *cir;
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [lustre-devel] [PATCH 05/11] lustre: lmv: checkpatch cleanup
  2019-07-22  1:52 [lustre-devel] [PATCH 00/11] lustre: cleanup most check patch issues James Simmons
                   ` (3 preceding siblings ...)
  2019-07-22  1:52 ` [lustre-devel] [PATCH 04/11] lustre: mgc: " James Simmons
@ 2019-07-22  1:52 ` James Simmons
  2019-07-22  1:52 ` [lustre-devel] [PATCH 06/11] lustre: mdc: " James Simmons
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 19+ messages in thread
From: James Simmons @ 2019-07-22  1:52 UTC (permalink / raw)
  To: lustre-devel

Many checkpatch errors exist in the lmv layer. This address
a good chuck of them. Other are left since future patches will
cleanup those areas. Others will need more code rework so this
patch handles the simple cases. This is a good step forward
toward proper kernel code style compliance.

Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/lmv/lmv_intent.c |  9 ++++++---
 fs/lustre/lmv/lmv_obd.c    | 22 ++++++++++++++--------
 2 files changed, 20 insertions(+), 11 deletions(-)

diff --git a/fs/lustre/lmv/lmv_intent.c b/fs/lustre/lmv/lmv_intent.c
index 8892426..818bb72 100644
--- a/fs/lustre/lmv/lmv_intent.c
+++ b/fs/lustre/lmv/lmv_intent.c
@@ -222,7 +222,8 @@ int lmv_revalidate_slaves(struct obd_export *exp,
 						      &RMF_MDT_BODY);
 			if (!body) {
 				if (it.it_lock_mode && lockh) {
-					ldlm_lock_decref(lockh, it.it_lock_mode);
+					ldlm_lock_decref(lockh,
+							 it.it_lock_mode);
 					it.it_lock_mode = 0;
 				}
 
@@ -309,7 +310,8 @@ static int lmv_intent_open(struct obd_export *exp, struct md_op_data *op_data,
 			return rc;
 	}
 
-	CDEBUG(D_INODE, "OPEN_INTENT with fid1=" DFID ", fid2=" DFID ", name='%s' -> mds #%u\n",
+	CDEBUG(D_INODE,
+	       "OPEN_INTENT with fid1=" DFID ", fid2=" DFID ", name='%s' -> mds #%u\n",
 	       PFID(&op_data->op_fid1),
 	       PFID(&op_data->op_fid2), op_data->op_name, tgt->ltd_idx);
 
@@ -387,7 +389,8 @@ static int lmv_intent_lookup(struct obd_export *exp,
 	if (!fid_is_sane(&op_data->op_fid2))
 		fid_zero(&op_data->op_fid2);
 
-	CDEBUG(D_INODE, "LOOKUP_INTENT with fid1=" DFID ", fid2=" DFID ", name='%s' -> mds #%u lsm=%p lsm_magic=%x\n",
+	CDEBUG(D_INODE,
+	       "LOOKUP_INTENT with fid1=" DFID ", fid2=" DFID ", name='%s' -> mds #%u lsm=%p lsm_magic=%x\n",
 	       PFID(&op_data->op_fid1), PFID(&op_data->op_fid2),
 	       op_data->op_name ? op_data->op_name : "<NULL>",
 	       tgt->ltd_idx, lsm, !lsm ? -1 : lsm->lsm_md_magic);
diff --git a/fs/lustre/lmv/lmv_obd.c b/fs/lustre/lmv/lmv_obd.c
index 64ebaf3..1c43022 100644
--- a/fs/lustre/lmv/lmv_obd.c
+++ b/fs/lustre/lmv/lmv_obd.c
@@ -1630,7 +1630,8 @@ static int lmv_create(struct obd_export *exp, struct md_op_data *op_data,
 	if (rc == 0) {
 		if (!*request)
 			return rc;
-		CDEBUG(D_INODE, "Created - " DFID "\n", PFID(&op_data->op_fid2));
+		CDEBUG(D_INODE, "Created - " DFID "\n",
+		       PFID(&op_data->op_fid2));
 	}
 	return rc;
 }
@@ -1749,8 +1750,8 @@ static int lmv_early_cancel(struct obd_export *exp, struct lmv_tgt_desc *tgt,
 }
 
 /*
- * llite passes fid of an target inode in op_data->op_fid1 and id of directory in
- * op_data->op_fid2
+ * llite passes fid of an target inode in op_data->op_fid1 and id of
+ * directory in op_data->op_fid2
  */
 static int lmv_link(struct obd_export *exp, struct md_op_data *op_data,
 		    struct ptlrpc_request **request)
@@ -1823,7 +1824,8 @@ static int lmv_rename(struct obd_export *exp, struct md_op_data *op_data,
 	op_data->op_cap = current_cap();
 
 	if (op_data->op_cli_flags & CLI_MIGRATE) {
-		LASSERTF(fid_is_sane(&op_data->op_fid3), "invalid FID " DFID "\n",
+		LASSERTF(fid_is_sane(&op_data->op_fid3),
+			 "invalid FID " DFID "\n",
 			 PFID(&op_data->op_fid3));
 
 		if (op_data->op_mea1) {
@@ -2302,8 +2304,10 @@ static int lmv_read_page(struct obd_export *exp, struct md_op_data *op_data,
 	struct lmv_obd *lmv = &obd->u.lmv;
 	struct lmv_tgt_desc *tgt;
 
-	if (unlikely(lsm))
-		return lmv_read_striped_page(exp, op_data, cb_op, offset, ppage);
+	if (unlikely(lsm)) {
+		return lmv_read_striped_page(exp, op_data, cb_op,
+					     offset, ppage);
+	}
 
 	tgt = lmv_find_target(lmv, &op_data->op_fid1);
 	if (IS_ERR(tgt))
@@ -2647,7 +2651,8 @@ static int lmv_unpack_md_v1(struct obd_export *exp, struct lmv_stripe_md *lsm,
 	if (cplen >= sizeof(lsm->lsm_md_pool_name))
 		return -E2BIG;
 
-	CDEBUG(D_INFO, "unpack lsm count %d, master %d hash_type %d layout_version %d\n",
+	CDEBUG(D_INFO,
+	       "unpack lsm count %d, master %d hash_type %d layout_version %d\n",
 	       lsm->lsm_md_stripe_count, lsm->lsm_md_master_mdt_index,
 	       lsm->lsm_md_hash_type, lsm->lsm_md_layout_version);
 
@@ -3016,7 +3021,8 @@ static int lmv_merge_attr(struct obd_export *exp,
 	for (i = 0; i < lsm->lsm_md_stripe_count; i++) {
 		struct inode *inode = lsm->lsm_md_oinfo[i].lmo_root;
 
-		CDEBUG(D_INFO, "" DFID " size %llu, blocks %llu nlink %u, atime %lld ctime %lld, mtime %lld.\n",
+		CDEBUG(D_INFO,
+		       "" DFID " size %llu, blocks %llu nlink %u, atime %lld ctime %lld, mtime %lld.\n",
 		       PFID(&lsm->lsm_md_oinfo[i].lmo_fid),
 		       i_size_read(inode), (unsigned long long)inode->i_blocks,
 		       inode->i_nlink, inode->i_atime.tv_sec,
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [lustre-devel] [PATCH 06/11] lustre: mdc: checkpatch cleanup
  2019-07-22  1:52 [lustre-devel] [PATCH 00/11] lustre: cleanup most check patch issues James Simmons
                   ` (4 preceding siblings ...)
  2019-07-22  1:52 ` [lustre-devel] [PATCH 05/11] lustre: lmv: " James Simmons
@ 2019-07-22  1:52 ` James Simmons
  2019-07-22  1:52 ` [lustre-devel] [PATCH 07/11] lustre: osc: " James Simmons
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 19+ messages in thread
From: James Simmons @ 2019-07-22  1:52 UTC (permalink / raw)
  To: lustre-devel

Many checkpatch errors exist in the mdc layer. This address
a good chuck of them. Other are left since future patches will
cleanup those areas. Others will need more code rework so this
patch handles the simple cases. This is a good step forward
toward proper kernel code style compliance.

Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/mdc/mdc_changelog.c | 15 ++++++++++-----
 fs/lustre/mdc/mdc_lib.c       | 15 ++++++++++-----
 fs/lustre/mdc/mdc_locks.c     |  2 +-
 fs/lustre/mdc/mdc_request.c   | 16 ++++++++++------
 4 files changed, 31 insertions(+), 17 deletions(-)

diff --git a/fs/lustre/mdc/mdc_changelog.c b/fs/lustre/mdc/mdc_changelog.c
index 45aef9c..011bcc9 100644
--- a/fs/lustre/mdc/mdc_changelog.c
+++ b/fs/lustre/mdc/mdc_changelog.c
@@ -112,7 +112,8 @@ enum {
  * @hdr:	Header of the current llog record
  * @data:	chlg_reader_state passed from caller
  *
- * Returns:	0 or LLOG_PROC_* control code on success, negated error on failure.
+ * Returns:	0 or LLOG_PROC_* control code on success,
+ *		negated error on failure.
  */
 static int chlg_read_cat_process_cb(const struct lu_env *env,
 				    struct llog_handle *llh,
@@ -276,7 +277,8 @@ static int chlg_load(void *args)
  * @ppos:	File position, updated with the index number of the next
  *		record to read.
  *
- * Returns:	number of copied bytes on success, negated error code on failure.
+ * Returns:	number of copied bytes on success,
+ *		negated error code on failure.
  */
 static ssize_t chlg_read(struct file *file, char __user *buff, size_t count,
 			 loff_t *ppos)
@@ -377,7 +379,8 @@ static int chlg_set_start_offset(struct chlg_reader_state *crs, u64 offset)
  * @off:	Offset to skip, actually a record index, not byte count
  * @whence:	Relative/Absolute interpretation of the offset
  *
- * Returns:	the resulting position on success or negated error code on failure.
+ * Returns:	the resulting position on success or
+ *		negated error code on failure.
  */
 static loff_t chlg_llseek(struct file *file, loff_t off, int whence)
 {
@@ -434,7 +437,8 @@ static int chlg_clear(struct chlg_reader_state *crs, u32 reader, u64 record)
 	else
 		ret = obd_set_info_async(NULL, obd->obd_self_export,
 					 strlen(KEY_CHANGELOG_CLEAR),
-					 KEY_CHANGELOG_CLEAR, sizeof(cs), &cs, NULL);
+					 KEY_CHANGELOG_CLEAR, sizeof(cs),
+					 &cs, NULL);
 	mutex_unlock(&chlg_registered_dev_lock);
 	return ret;
 }
@@ -451,7 +455,8 @@ static int chlg_clear(struct chlg_reader_state *crs, u32 reader, u64 record)
  * @count:	Number of written bytes
  * @off:	(unused)
  *
- * Returns:	number of written bytes on success, negated error code on failure.
+ * Returns:	number of written bytes on success,
+ *		negated error code on failure.
  */
 static ssize_t chlg_write(struct file *file, const char __user *buff,
 			  size_t count, loff_t *off)
diff --git a/fs/lustre/mdc/mdc_lib.c b/fs/lustre/mdc/mdc_lib.c
index 7680346..6aa9dc2 100644
--- a/fs/lustre/mdc/mdc_lib.c
+++ b/fs/lustre/mdc/mdc_lib.c
@@ -157,7 +157,8 @@ void mdc_create_pack(struct ptlrpc_request *req, struct md_op_data *op_data,
 	char *tmp;
 	u64 flags;
 
-	BUILD_BUG_ON(sizeof(struct mdt_rec_reint) != sizeof(struct mdt_rec_create));
+	BUILD_BUG_ON(sizeof(struct mdt_rec_reint) !=
+		     sizeof(struct mdt_rec_create));
 	rec = req_capsule_client_get(&req->rq_pill, &RMF_REC_REINT);
 
 	rec->cr_opcode = REINT_CREATE;
@@ -225,7 +226,8 @@ void mdc_open_pack(struct ptlrpc_request *req, struct md_op_data *op_data,
 	char *tmp;
 	u64 cr_flags;
 
-	BUILD_BUG_ON(sizeof(struct mdt_rec_reint) != sizeof(struct mdt_rec_create));
+	BUILD_BUG_ON(sizeof(struct mdt_rec_reint) !=
+		     sizeof(struct mdt_rec_create));
 	rec = req_capsule_client_get(&req->rq_pill, &RMF_REC_REINT);
 
 	/* XXX do something about time, uid, gid */
@@ -380,7 +382,8 @@ void mdc_unlink_pack(struct ptlrpc_request *req, struct md_op_data *op_data)
 {
 	struct mdt_rec_unlink *rec;
 
-	BUILD_BUG_ON(sizeof(struct mdt_rec_reint) != sizeof(struct mdt_rec_unlink));
+	BUILD_BUG_ON(sizeof(struct mdt_rec_reint) !=
+		     sizeof(struct mdt_rec_unlink));
 	rec = req_capsule_client_get(&req->rq_pill, &RMF_REC_REINT);
 
 	rec->ul_opcode = op_data->op_cli_flags & CLI_RM_ENTRY ?
@@ -403,7 +406,8 @@ void mdc_link_pack(struct ptlrpc_request *req, struct md_op_data *op_data)
 {
 	struct mdt_rec_link *rec;
 
-	BUILD_BUG_ON(sizeof(struct mdt_rec_reint) != sizeof(struct mdt_rec_link));
+	BUILD_BUG_ON(sizeof(struct mdt_rec_reint) !=
+		     sizeof(struct mdt_rec_link));
 	rec = req_capsule_client_get(&req->rq_pill, &RMF_REC_REINT);
 
 	rec->lk_opcode = REINT_LINK;
@@ -451,7 +455,8 @@ void mdc_rename_pack(struct ptlrpc_request *req, struct md_op_data *op_data,
 {
 	struct mdt_rec_rename *rec;
 
-	BUILD_BUG_ON(sizeof(struct mdt_rec_reint) != sizeof(struct mdt_rec_rename));
+	BUILD_BUG_ON(sizeof(struct mdt_rec_reint) !=
+		     sizeof(struct mdt_rec_rename));
 	rec = req_capsule_client_get(&req->rq_pill, &RMF_REC_REINT);
 
 	/* XXX do something about time, uid, gid */
diff --git a/fs/lustre/mdc/mdc_locks.c b/fs/lustre/mdc/mdc_locks.c
index 430c422..4e6928e 100644
--- a/fs/lustre/mdc/mdc_locks.c
+++ b/fs/lustre/mdc/mdc_locks.c
@@ -630,7 +630,7 @@ static int mdc_finish_enqueue(struct obd_export *exp,
 			mdc_set_open_replay_data(NULL, NULL, it);
 		}
 
-		if ((body->mbo_valid & (OBD_MD_FLDIREA | OBD_MD_FLEASIZE)) != 0) {
+		if (body->mbo_valid & (OBD_MD_FLDIREA | OBD_MD_FLEASIZE)) {
 			void *eadata;
 
 			mdc_update_max_ea_from_body(exp, body);
diff --git a/fs/lustre/mdc/mdc_request.c b/fs/lustre/mdc/mdc_request.c
index 6f933b5..dd90e931 100644
--- a/fs/lustre/mdc/mdc_request.c
+++ b/fs/lustre/mdc/mdc_request.c
@@ -803,8 +803,8 @@ static 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");
 	}
 	if (!req) {
 		/*
@@ -1019,9 +1019,11 @@ static struct page *mdc_page_locate(struct address_space *mapping, u64 *hash,
 			if (unlikely(*start == 1 && *hash == 0))
 				*hash = *start;
 			else
-				LASSERTF(*start <= *hash, "start = %#llx,end = %#llx,hash = %#llx\n",
+				LASSERTF(*start <= *hash,
+					 "start = %#llx,end = %#llx,hash = %#llx\n",
 					 *start, *end, *hash);
-			CDEBUG(D_VFSTRACE, "offset %lx [%#llx %#llx], hash %#llx\n",
+			CDEBUG(D_VFSTRACE,
+			       "offset %lx [%#llx %#llx], hash %#llx\n",
 			       offset, *start, *end, *hash);
 			if (*hash > *end) {
 				kunmap(page);
@@ -1258,7 +1260,8 @@ static int mdc_read_page_remote(void *data, struct page *page0)
 		if (!ret)
 			unlock_page(page);
 		else
-			CDEBUG(D_VFSTRACE, "page %lu add to page cache failed: rc = %d\n",
+			CDEBUG(D_VFSTRACE,
+			       "page %lu add to page cache failed: rc = %d\n",
 			       offset, ret);
 		put_page(page);
 	}
@@ -1325,7 +1328,8 @@ static int mdc_read_page(struct obd_export *exp, struct md_op_data *op_data,
 	page = mdc_page_locate(mapping, &rp_param.rp_off, &start, &end,
 			       rp_param.rp_hash64);
 	if (IS_ERR(page)) {
-		CDEBUG(D_INFO, "%s: dir page locate: " DFID " at %llu: rc %ld\n",
+		CDEBUG(D_INFO,
+		       "%s: dir page locate: " DFID " at %llu: rc %ld\n",
 		       exp->exp_obd->obd_name, PFID(&op_data->op_fid1),
 		       rp_param.rp_off, PTR_ERR(page));
 		rc = PTR_ERR(page);
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [lustre-devel] [PATCH 07/11] lustre: osc: checkpatch cleanup
  2019-07-22  1:52 [lustre-devel] [PATCH 00/11] lustre: cleanup most check patch issues James Simmons
                   ` (5 preceding siblings ...)
  2019-07-22  1:52 ` [lustre-devel] [PATCH 06/11] lustre: mdc: " James Simmons
@ 2019-07-22  1:52 ` James Simmons
  2019-07-22  1:52 ` [lustre-devel] [PATCH 08/11] lustre: lov: " James Simmons
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 19+ messages in thread
From: James Simmons @ 2019-07-22  1:52 UTC (permalink / raw)
  To: lustre-devel

Many checkpatch errors exist in the osc layer. This address
a good chuck of them. Other are left since future patches will
cleanup those areas. Others will need more code rework so this
patch handles the simple cases. This is a good step forward
toward proper kernel code style compliance.

Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/osc/lproc_osc.c    |  7 ++++---
 fs/lustre/osc/osc_cache.c    | 15 +++++----------
 fs/lustre/osc/osc_internal.h |  6 ++++--
 fs/lustre/osc/osc_lock.c     |  6 ++++--
 fs/lustre/osc/osc_object.c   |  6 ++++--
 fs/lustre/osc/osc_page.c     |  3 ++-
 fs/lustre/osc/osc_quota.c    | 20 ++++++++++++--------
 fs/lustre/osc/osc_request.c  | 38 ++++++++++++++++----------------------
 8 files changed, 51 insertions(+), 50 deletions(-)

diff --git a/fs/lustre/osc/lproc_osc.c b/fs/lustre/osc/lproc_osc.c
index 299a69f..eb724f4 100644
--- a/fs/lustre/osc/lproc_osc.c
+++ b/fs/lustre/osc/lproc_osc.c
@@ -197,7 +197,8 @@ static ssize_t osc_cached_mb_seq_write(struct file *file,
 				       const char __user *buffer,
 				       size_t count, loff_t *off)
 {
-	struct obd_device *dev = ((struct seq_file *)file->private_data)->private;
+	struct seq_file *m = file->private_data;
+	struct obd_device *dev = m->private;
 	struct client_obd *cli = &dev->u.cli;
 	long pages_number, rc;
 	char kernbuf[128];
@@ -251,7 +252,6 @@ static ssize_t cur_dirty_bytes_show(struct kobject *kobj,
 	struct client_obd *cli = &dev->u.cli;
 
 	return sprintf(buf, "%lu\n", cli->cl_dirty_pages << PAGE_SHIFT);
-
 }
 LUSTRE_RO_ATTR(cur_dirty_bytes);
 
@@ -405,7 +405,8 @@ static ssize_t osc_checksum_type_seq_write(struct file *file,
 					   const char __user *buffer,
 					   size_t count, loff_t *off)
 {
-	struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
+	struct seq_file *m = file->private_data;
+	struct obd_device *obd = m->private;
 	DECLARE_CKSUM_NAME;
 	char kernbuf[10];
 	int i;
diff --git a/fs/lustre/osc/osc_cache.c b/fs/lustre/osc/osc_cache.c
index f8fddbf..46d578e 100644
--- a/fs/lustre/osc/osc_cache.c
+++ b/fs/lustre/osc/osc_cache.c
@@ -393,13 +393,6 @@ static void osc_extent_free(struct kref *kref)
 		LDLM_LOCK_PUT(ext->oe_dlmlock);
 		ext->oe_dlmlock = NULL;
 	}
-#if 0
-	// When cl_object_put drop the need for 'env',
-	// this code can be enabled.
-	cl_object_put(osc2cl(ext->oe_obj));
-
-	kmem_cache_free(osc_extent_kmem, ext);
-#endif
 }
 
 static struct osc_extent *osc_extent_get(struct osc_extent *ext)
@@ -1547,19 +1540,21 @@ static bool osc_enter_cache_try(struct client_obd *cli,
 				struct osc_async_page *oap,
 				int bytes)
 {
+	bool rc = false;
+
 	OSC_DUMP_GRANT(D_CACHE, cli, "need:%d\n", bytes);
 
 	if (osc_reserve_grant(cli, bytes) < 0)
-		return false;
+		return rc;
 
 	if (cli->cl_dirty_pages < cli->cl_dirty_max_pages &&
 	    atomic_long_read(&obd_dirty_pages) + 1 <= obd_max_dirty_pages) {
 		osc_consume_write_grant(cli, &oap->oap_brw_page);
-		return true;
+		rc = true;
 	} else {
 		__osc_unreserve_grant(cli, bytes, bytes);
-		return false;
 	}
+	return rc;
 }
 
 #define __wait_event_idle_exclusive_timeout_cmd(wq_head, condition,	\
diff --git a/fs/lustre/osc/osc_internal.h b/fs/lustre/osc/osc_internal.h
index 4033365..95f5b93 100644
--- a/fs/lustre/osc/osc_internal.h
+++ b/fs/lustre/osc/osc_internal.h
@@ -48,7 +48,8 @@ enum async_flags {
 					* added to an rpc
 					*/
 	ASYNC_URGENT		= 0x2, /* page must be put into an RPC
-					* before return */
+					* before return
+					*/
 	ASYNC_COUNT_STABLE	= 0x4, /* ap_refresh_count will not be
 					* called to give the caller a
 					* chance to update or cancel
@@ -178,7 +179,8 @@ struct osc_device {
 
 static inline struct osc_device *obd2osc_dev(const struct obd_device *d)
 {
-	return container_of_safe(d->obd_lu_dev, struct osc_device, od_cl.cd_lu_dev);
+	return container_of_safe(d->obd_lu_dev, struct osc_device,
+				 od_cl.cd_lu_dev);
 }
 
 extern struct lu_kmem_descr osc_caches[];
diff --git a/fs/lustre/osc/osc_lock.c b/fs/lustre/osc/osc_lock.c
index 612305a..65b734ea 100644
--- a/fs/lustre/osc/osc_lock.c
+++ b/fs/lustre/osc/osc_lock.c
@@ -212,12 +212,14 @@ static void osc_lock_lvb_update(const struct lu_env *env,
 		if (size > dlmlock->l_policy_data.l_extent.end)
 			size = dlmlock->l_policy_data.l_extent.end + 1;
 		if (size >= oinfo->loi_kms) {
-			LDLM_DEBUG(dlmlock, "lock acquired, setting rss=%llu, kms=%llu",
+			LDLM_DEBUG(dlmlock,
+				   "lock acquired, setting rss=%llu, kms=%llu",
 				   lvb->lvb_size, size);
 			valid |= CAT_KMS;
 			attr->cat_kms = size;
 		} else {
-			LDLM_DEBUG(dlmlock, "lock acquired, setting rss=%llu; leaving kms=%llu, end=%llu",
+			LDLM_DEBUG(dlmlock,
+				   "lock acquired, setting rss=%llu; leaving kms=%llu, end=%llu",
 				   lvb->lvb_size, oinfo->loi_kms,
 				   dlmlock->l_policy_data.l_extent.end);
 		}
diff --git a/fs/lustre/osc/osc_object.c b/fs/lustre/osc/osc_object.c
index 98a0b6c..7468729 100644
--- a/fs/lustre/osc/osc_object.c
+++ b/fs/lustre/osc/osc_object.c
@@ -125,7 +125,8 @@ static void osc_object_free(const struct lu_env *env, struct lu_object *obj)
 int osc_lvb_print(const struct lu_env *env, void *cookie,
 		  lu_printer_t p, const struct ost_lvb *lvb)
 {
-	return (*p)(env, cookie, "size: %llu mtime: %llu atime: %llu ctime: %llu blocks: %llu",
+	return (*p)(env, cookie,
+		    "size: %llu mtime: %llu atime: %llu ctime: %llu blocks: %llu",
 		    lvb->lvb_size, lvb->lvb_mtime, lvb->lvb_atime,
 		    lvb->lvb_ctime, lvb->lvb_blocks);
 }
@@ -137,7 +138,8 @@ static int osc_object_print(const struct lu_env *env, void *cookie,
 	struct lov_oinfo *oinfo = osc->oo_oinfo;
 	struct osc_async_rc *ar = &oinfo->loi_ar;
 
-	(*p)(env, cookie, "id: " DOSTID " idx: %d gen: %d kms_valid: %u kms %llu rc: %d force_sync: %d min_xid: %llu ",
+	(*p)(env, cookie,
+	     "id: " DOSTID " idx: %d gen: %d kms_valid: %u kms %llu rc: %d force_sync: %d min_xid: %llu ",
 	     POSTID(&oinfo->loi_oi), oinfo->loi_ost_idx,
 	     oinfo->loi_ost_gen, oinfo->loi_kms_valid, oinfo->loi_kms,
 	     ar->ar_rc, ar->ar_force_sync, ar->ar_min_xid);
diff --git a/fs/lustre/osc/osc_page.c b/fs/lustre/osc/osc_page.c
index ce911b8..8d541df 100644
--- a/fs/lustre/osc/osc_page.c
+++ b/fs/lustre/osc/osc_page.c
@@ -284,7 +284,8 @@ void osc_page_submit(const struct lu_env *env, struct osc_page *opg,
 {
 	struct osc_async_page *oap = &opg->ops_oap;
 
-	LASSERTF(oap->oap_magic == OAP_MAGIC, "Bad oap magic: oap %p, magic 0x%x\n",
+	LASSERTF(oap->oap_magic == OAP_MAGIC,
+		 "Bad oap magic: oap %p, magic 0x%x\n",
 		 oap, oap->oap_magic);
 	LASSERT(oap->oap_async_flags & ASYNC_READY);
 	LASSERT(oap->oap_async_flags & ASYNC_COUNT_STABLE);
diff --git a/fs/lustre/osc/osc_quota.c b/fs/lustre/osc/osc_quota.c
index 555f1be..5fa85c6 100644
--- a/fs/lustre/osc/osc_quota.c
+++ b/fs/lustre/osc/osc_quota.c
@@ -52,8 +52,8 @@ int osc_quota_chkdq(struct client_obd *cli, const unsigned int qid[])
 	for (type = 0; type < MAXQUOTAS; type++) {
 		struct osc_quota_info *oqi;
 
-		oqi = rhashtable_lookup_fast(&cli->cl_quota_hash[type], &qid[type],
-					     quota_hash_params);
+		oqi = rhashtable_lookup_fast(&cli->cl_quota_hash[type],
+					     &qid[type], quota_hash_params);
 		if (oqi) {
 			/* Must not access oqi here, it could have been
 			 * freed by osc_quota_setdq()
@@ -73,7 +73,8 @@ int osc_quota_chkdq(struct client_obd *cli, const unsigned int qid[])
 
 static void osc_quota_free(struct rcu_head *head)
 {
-	struct osc_quota_info *oqi = container_of(head, struct osc_quota_info, rcu);
+	struct osc_quota_info *oqi = container_of(head, struct osc_quota_info,
+						  rcu);
 
 	kmem_cache_free(osc_quota_kmem, oqi);
 }
@@ -123,8 +124,8 @@ int osc_quota_setdq(struct client_obd *cli, const unsigned int qid[],
 
 		/* lookup the ID in the per-type hash table */
 		rcu_read_lock();
-		oqi = rhashtable_lookup_fast(&cli->cl_quota_hash[type], &qid[type],
-					     quota_hash_params);
+		oqi = rhashtable_lookup_fast(&cli->cl_quota_hash[type],
+					     &qid[type], quota_hash_params);
 		if ((flags & fl_quota_flag(type)) != 0) {
 			/* This ID is getting close to its quota limit, let's
 			 * switch to sync I/O
@@ -140,7 +141,8 @@ int osc_quota_setdq(struct client_obd *cli, const unsigned int qid[],
 			}
 
 			rc = rhashtable_lookup_insert_fast(&cli->cl_quota_hash[type],
-							   &oqi->oqi_hash, quota_hash_params);
+							   &oqi->oqi_hash,
+							   quota_hash_params);
 			/* race with others? */
 			if (rc) {
 				kmem_cache_free(osc_quota_kmem, oqi);
@@ -162,7 +164,8 @@ int osc_quota_setdq(struct client_obd *cli, const unsigned int qid[],
 				continue;
 			}
 			if (rhashtable_remove_fast(&cli->cl_quota_hash[type],
-						   &oqi->oqi_hash, quota_hash_params) == 0)
+						   &oqi->oqi_hash,
+						   quota_hash_params) == 0)
 				call_rcu(&oqi->rcu, osc_quota_free);
 			rcu_read_unlock();
 			CDEBUG(D_QUOTA, "%s: setdq to remove for %s %d (%p)\n",
@@ -187,7 +190,8 @@ int osc_quota_setup(struct obd_device *obd)
 	int i, type;
 
 	for (type = 0; type < MAXQUOTAS; type++) {
-		if (rhashtable_init(&cli->cl_quota_hash[type], &quota_hash_params) != 0)
+		if (rhashtable_init(&cli->cl_quota_hash[type],
+				    &quota_hash_params) != 0)
 			break;
 	}
 
diff --git a/fs/lustre/osc/osc_request.c b/fs/lustre/osc/osc_request.c
index 9484b9a..a64b8ab 100644
--- a/fs/lustre/osc/osc_request.c
+++ b/fs/lustre/osc/osc_request.c
@@ -1413,32 +1413,26 @@ static int check_write_checksum(struct obdo *oa,
 				      aa->aa_ppga, OST_WRITE, cksum_type);
 
 	if (cksum_type != cksum_type_unpack(aa->aa_oa->o_flags))
-		msg = "the server did not use the checksum type specified in the original request - likely a protocol problem"
-			;
+		msg = "the server did not use the checksum type specified in the original request - likely a protocol problem";
 	else if (new_cksum == server_cksum)
-		msg = "changed on the client after we checksummed it - likely false positive due to mmap IO (bug 11742)"
-			;
+		msg = "changed on the client after we checksummed it - likely false positive due to mmap IO (bug 11742)";
 	else if (new_cksum == client_cksum)
 		msg = "changed in transit before arrival at OST";
 	else
-		msg = "changed in transit AND doesn't match the original - likely false positive due to mmap IO (bug 11742)"
-			;
-
-	LCONSOLE_ERROR_MSG(
-		0x132,
-		"%s: BAD WRITE CHECKSUM: %s: from %s inode " DFID
-		" object " DOSTID
-		" extent [%llu-%llu], original client csum %x (type %x), server csum %x (type %x), client csum now %x\n",
-		aa->aa_cli->cl_import->imp_obd->obd_name,
-		msg, libcfs_nid2str(peer->nid),
-		oa->o_valid & OBD_MD_FLFID ? oa->o_parent_seq : (u64)0,
-		oa->o_valid & OBD_MD_FLFID ? oa->o_parent_oid : 0,
-		oa->o_valid & OBD_MD_FLFID ? oa->o_parent_ver : 0,
-		POSTID(&oa->o_oi), aa->aa_ppga[0]->off,
-		aa->aa_ppga[aa->aa_page_count - 1]->off +
-		aa->aa_ppga[aa->aa_page_count - 1]->count - 1,
-		client_cksum, cksum_type_unpack(aa->aa_oa->o_flags),
-		server_cksum, cksum_type, new_cksum);
+		msg = "changed in transit AND doesn't match the original - likely false positive due to mmap IO (bug 11742)";
+
+	LCONSOLE_ERROR_MSG(0x132,
+			   "%s: BAD WRITE CHECKSUM: %s: from %s inode " DFID " object " DOSTID " extent [%llu-%llu], original client csum %x (type %x), server csum %x (type %x), client csum now %x\n",
+			   aa->aa_cli->cl_import->imp_obd->obd_name,
+			   msg, libcfs_nid2str(peer->nid),
+			   oa->o_valid & OBD_MD_FLFID ? oa->o_parent_seq : (u64)0,
+			   oa->o_valid & OBD_MD_FLFID ? oa->o_parent_oid : 0,
+			   oa->o_valid & OBD_MD_FLFID ? oa->o_parent_ver : 0,
+			   POSTID(&oa->o_oi), aa->aa_ppga[0]->off,
+			   aa->aa_ppga[aa->aa_page_count - 1]->off +
+			   aa->aa_ppga[aa->aa_page_count - 1]->count - 1,
+			   client_cksum, cksum_type_unpack(aa->aa_oa->o_flags),
+			   server_cksum, cksum_type, new_cksum);
 
 	return 1;
 }
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [lustre-devel] [PATCH 08/11] lustre: lov: checkpatch cleanup
  2019-07-22  1:52 [lustre-devel] [PATCH 00/11] lustre: cleanup most check patch issues James Simmons
                   ` (6 preceding siblings ...)
  2019-07-22  1:52 ` [lustre-devel] [PATCH 07/11] lustre: osc: " James Simmons
@ 2019-07-22  1:52 ` James Simmons
  2019-07-22  1:52 ` [lustre-devel] [PATCH 09/11] lustre: obdclass: " James Simmons
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 19+ messages in thread
From: James Simmons @ 2019-07-22  1:52 UTC (permalink / raw)
  To: lustre-devel

Many checkpatch errors exist in the lov layer. This address
a good chuck of them. Other are left since future patches will
cleanup those areas. Others will need more code rework so this
patch handles the simple cases. This is a good step forward
toward proper kernel code style compliance.

Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/lov/lov_io.c      |  2 +-
 fs/lustre/lov/lov_lock.c    |  4 ++--
 fs/lustre/lov/lov_merge.c   |  6 ++++--
 fs/lustre/lov/lov_obd.c     |  6 ++++--
 fs/lustre/lov/lov_object.c  |  6 +++---
 fs/lustre/lov/lov_pool.c    | 24 +++++++++++++++++-------
 fs/lustre/lov/lov_request.c |  3 ++-
 7 files changed, 33 insertions(+), 18 deletions(-)

diff --git a/fs/lustre/lov/lov_io.c b/fs/lustre/lov/lov_io.c
index 64982be..8214493 100644
--- a/fs/lustre/lov/lov_io.c
+++ b/fs/lustre/lov/lov_io.c
@@ -406,7 +406,7 @@ static int lov_io_iter_init(const struct lu_env *env,
 			 * it's handled in lov_io_setattr_iter_init()
 			 */
 			if (io->ci_type == CIT_WRITE || cl_io_is_mkwrite(io)) {
-			    io->ci_need_write_intent = 1;
+				io->ci_need_write_intent = 1;
 				rc = -ENODATA;
 				break;
 			}
diff --git a/fs/lustre/lov/lov_lock.c b/fs/lustre/lov/lov_lock.c
index 039c902..5520199 100644
--- a/fs/lustre/lov/lov_lock.c
+++ b/fs/lustre/lov/lov_lock.c
@@ -283,8 +283,8 @@ static void lov_lock_cancel(const struct lu_env *env,
 			cl_lock_cancel(subenv->lse_env, sublock);
 		} else {
 			CL_LOCK_DEBUG(D_ERROR, env, slice->cls_lock,
-				      "lov_lock_cancel fails with %ld.\n",
-				      PTR_ERR(subenv));
+				      "%s fails with %ld.\n",
+				      __func__, PTR_ERR(subenv));
 		}
 	}
 }
diff --git a/fs/lustre/lov/lov_merge.c b/fs/lustre/lov/lov_merge.c
index ab0ba12..a8c23fe 100644
--- a/fs/lustre/lov/lov_merge.c
+++ b/fs/lustre/lov/lov_merge.c
@@ -57,7 +57,8 @@ int lov_merge_lvb_kms(struct lov_stripe_md *lsm, int index,
 	assert_spin_locked(&lsm->lsm_lock);
 	LASSERT(lsm->lsm_lock_owner == current->pid);
 
-	CDEBUG(D_INODE, "MDT ID " DOSTID " initial value: s=%llu m=%llu a=%llu c=%llu b=%llu\n",
+	CDEBUG(D_INODE,
+	       "MDT ID " DOSTID " initial value: s=%llu m=%llu a=%llu c=%llu b=%llu\n",
 	       POSTID(&lsm->lsm_oi), lvb->lvb_size, lvb->lvb_mtime,
 	       lvb->lvb_atime, lvb->lvb_ctime, lvb->lvb_blocks);
 
@@ -90,7 +91,8 @@ int lov_merge_lvb_kms(struct lov_stripe_md *lsm, int index,
 		if (loi->loi_lvb.lvb_ctime > current_ctime)
 			current_ctime = loi->loi_lvb.lvb_ctime;
 
-		CDEBUG(D_INODE, "MDT ID " DOSTID " on OST[%u]: s=%llu m=%llu a=%llu c=%llu b=%llu\n",
+		CDEBUG(D_INODE,
+		       "MDT ID " DOSTID " on OST[%u]: s=%llu m=%llu a=%llu c=%llu b=%llu\n",
 		       POSTID(&lsm->lsm_oi), loi->loi_ost_idx,
 		       loi->loi_lvb.lvb_size, loi->loi_lvb.lvb_mtime,
 		       loi->loi_lvb.lvb_atime, loi->loi_lvb.lvb_ctime,
diff --git a/fs/lustre/lov/lov_obd.c b/fs/lustre/lov/lov_obd.c
index 652ed6a..1d96f28 100644
--- a/fs/lustre/lov/lov_obd.c
+++ b/fs/lustre/lov/lov_obd.c
@@ -104,7 +104,8 @@ void lov_tgts_putref(struct obd_device *obd)
 		mutex_unlock(&lov->lov_lock);
 
 		while (!list_empty(&kill)) {
-			tgt = list_first_entry(&kill, struct lov_tgt_desc, ltd_kill);
+			tgt = list_first_entry(&kill, struct lov_tgt_desc,
+					       ltd_kill);
 			list_del(&tgt->ltd_kill);
 			/* Disconnect */
 			__lov_del_obd(obd, tgt);
@@ -171,7 +172,8 @@ int lov_connect_obd(struct obd_device *obd, u32 index, int activate,
 	}
 
 	if (imp->imp_invalid) {
-		CDEBUG(D_CONFIG, "not connecting OSC %s; administratively disabled\n",
+		CDEBUG(D_CONFIG,
+		       "not connecting OSC %s; administratively disabled\n",
 		       obd_uuid2str(tgt_uuid));
 		return 0;
 	}
diff --git a/fs/lustre/lov/lov_object.c b/fs/lustre/lov/lov_object.c
index 261f7b7..caeff89 100644
--- a/fs/lustre/lov/lov_object.c
+++ b/fs/lustre/lov/lov_object.c
@@ -216,8 +216,8 @@ static int lov_init_raid0(const struct lu_env *env, struct lov_device *dev,
 	r0->lo_nr = lse->lsme_stripe_count;
 	LASSERT(r0->lo_nr <= lov_targets_nr(dev));
 
-	r0->lo_sub = kzalloc(r0->lo_nr * sizeof(r0->lo_sub[0]),
-			      GFP_NOFS);
+	r0->lo_sub = kcalloc(r0->lo_nr, sizeof(r0->lo_sub[0]),
+			     GFP_KERNEL);
 	if (!r0->lo_sub)
 		return -ENOMEM;
 
@@ -1568,7 +1568,7 @@ static int lov_object_fiemap(const struct lu_env *env, struct cl_object *obj,
 				goto finish;
 			if (fs.fs_finish_stripe)
 				break;
-		 } /* for each stripe */
+		} /* for each stripe */
 	} /* for covering layout component */
 
 	/*
diff --git a/fs/lustre/lov/lov_pool.c b/fs/lustre/lov/lov_pool.c
index 833fac9..78a7dd2 100644
--- a/fs/lustre/lov/lov_pool.c
+++ b/fs/lustre/lov/lov_pool.c
@@ -50,13 +50,16 @@
 static u32 pool_hashfh(const void *data, u32 len, u32 seed)
 {
 	const char *pool_name = data;
-	return hashlen_hash(hashlen_string((void*)(unsigned long)seed, pool_name));
+
+	return hashlen_hash(hashlen_string((void *)(unsigned long)seed,
+			    pool_name));
 }
 
 static int pool_cmpfn(struct rhashtable_compare_arg *arg, const void *obj)
 {
 	const struct pool_desc *pool = obj;
 	const char *pool_name = arg->key;
+
 	return strcmp(pool_name, pool->pool_name);
 }
 
@@ -338,6 +341,7 @@ int lov_ost_pool_free(struct ost_pool *op)
 pools_hash_exit(void *vpool, void *data)
 {
 	struct pool_desc *pool = vpool;
+
 	lov_pool_putref(pool);
 }
 
@@ -391,7 +395,8 @@ int lov_pool_new(struct obd_device *obd, char *poolname)
 
 	/* Add to hash table only when it is fully ready.  */
 	rc = rhashtable_lookup_insert_fast(&lov->lov_pools_hash_body,
-					   &new_pool->pool_hash, pools_hash_params);
+					   &new_pool->pool_hash,
+					   pools_hash_params);
 	if (rc) {
 		if (rc != -EEXIST)
 			/*
@@ -428,11 +433,14 @@ int lov_pool_del(struct obd_device *obd, char *poolname)
 
 	/* lookup and kill hash reference */
 	rcu_read_lock();
-	pool = rhashtable_lookup(&lov->lov_pools_hash_body, poolname, pools_hash_params);
-	if (pool)
+	pool = rhashtable_lookup(&lov->lov_pools_hash_body, poolname,
+				 pools_hash_params);
+	if (pool) {
 		if (rhashtable_remove_fast(&lov->lov_pools_hash_body,
-					   &pool->pool_hash, pools_hash_params) != 0)
+					   &pool->pool_hash,
+					   pools_hash_params) != 0)
 			pool = NULL;
+	}
 	rcu_read_unlock();
 	if (!pool)
 		return -ENOENT;
@@ -462,7 +470,8 @@ int lov_pool_add(struct obd_device *obd, char *poolname, char *ostname)
 	lov = &obd->u.lov;
 
 	rcu_read_lock();
-	pool = rhashtable_lookup(&lov->lov_pools_hash_body, poolname, pools_hash_params);
+	pool = rhashtable_lookup(&lov->lov_pools_hash_body, poolname,
+				 pools_hash_params);
 	if (pool && !atomic_inc_not_zero(&pool->pool_refcount))
 		pool = NULL;
 	rcu_read_unlock();
@@ -511,7 +520,8 @@ int lov_pool_remove(struct obd_device *obd, char *poolname, char *ostname)
 	lov = &obd->u.lov;
 
 	rcu_read_lock();
-	pool = rhashtable_lookup(&lov->lov_pools_hash_body, poolname, pools_hash_params);
+	pool = rhashtable_lookup(&lov->lov_pools_hash_body, poolname,
+				 pools_hash_params);
 	if (pool && !atomic_inc_not_zero(&pool->pool_refcount))
 		pool = NULL;
 	rcu_read_unlock();
diff --git a/fs/lustre/lov/lov_request.c b/fs/lustre/lov/lov_request.c
index 7f591ba..057d6ca 100644
--- a/fs/lustre/lov/lov_request.c
+++ b/fs/lustre/lov/lov_request.c
@@ -315,7 +315,8 @@ int lov_prep_statfs_set(struct obd_device *obd, struct obd_info *oinfo,
 		 * administrator
 		 */
 		if (!lov->lov_tgts[i]->ltd_exp) {
-			CDEBUG(D_HA, "lov idx %d administratively disabled\n", i);
+			CDEBUG(D_HA,
+			       "lov idx %d administratively disabled\n", i);
 			continue;
 		}
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [lustre-devel] [PATCH 09/11] lustre: obdclass: checkpatch cleanup
  2019-07-22  1:52 [lustre-devel] [PATCH 00/11] lustre: cleanup most check patch issues James Simmons
                   ` (7 preceding siblings ...)
  2019-07-22  1:52 ` [lustre-devel] [PATCH 08/11] lustre: lov: " James Simmons
@ 2019-07-22  1:52 ` James Simmons
  2019-07-22  1:52 ` [lustre-devel] [PATCH 10/11] lustre: ldlm: " James Simmons
  2019-07-22  1:52 ` [lustre-devel] [PATCH 11/11] lustre: internal headers " James Simmons
  10 siblings, 0 replies; 19+ messages in thread
From: James Simmons @ 2019-07-22  1:52 UTC (permalink / raw)
  To: lustre-devel

Many checkpatch errors exist in the obdclass layer. This address
a good chuck of them. Other are left since future patches will
cleanup those areas. Others will need more code rework so this
patch handles the simple cases. This is a good step forward
toward proper kernel code style compliance.

Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/obdclass/cl_io.c          | 16 +++++++++++-----
 fs/lustre/obdclass/cl_lock.c        |  8 ++++++--
 fs/lustre/obdclass/cl_object.c      | 12 ++++++------
 fs/lustre/obdclass/cl_page.c        |  9 +++++----
 fs/lustre/obdclass/class_obd.c      |  3 ++-
 fs/lustre/obdclass/genops.c         |  9 ++++++---
 fs/lustre/obdclass/llog.c           |  3 ++-
 fs/lustre/obdclass/llog_obd.c       |  8 ++++----
 fs/lustre/obdclass/llog_swab.c      |  6 ++++--
 fs/lustre/obdclass/lprocfs_status.c |  4 ++--
 fs/lustre/obdclass/lu_object.c      |  3 ++-
 fs/lustre/obdclass/obd_config.c     | 12 ++++++++----
 fs/lustre/obdclass/obd_mount.c      |  3 ++-
 fs/lustre/obdecho/debug.c           | 12 ++++++++----
 14 files changed, 68 insertions(+), 40 deletions(-)

diff --git a/fs/lustre/obdclass/cl_io.c b/fs/lustre/obdclass/cl_io.c
index eef0dd8..1f1579b 100644
--- a/fs/lustre/obdclass/cl_io.c
+++ b/fs/lustre/obdclass/cl_io.c
@@ -217,11 +217,16 @@ int cl_io_rw_init(const struct lu_env *env, struct cl_io *io,
 static int cl_lock_descr_cmp(void *priv,
 			     struct list_head *a, struct list_head *b)
 {
-	const struct cl_io_lock_link *l0 = list_entry(a, struct cl_io_lock_link, cill_linkage);
-	const struct cl_io_lock_link *l1 = list_entry(b, struct cl_io_lock_link, cill_linkage);
+	const struct cl_io_lock_link *l0;
+	const struct cl_io_lock_link *l1;
+	const struct cl_lock_descr *d0;
+	const struct cl_lock_descr *d1;
 
-	const struct cl_lock_descr *d0 = &l0->cill_descr;
-	const struct cl_lock_descr *d1 = &l1->cill_descr;
+	l0 = list_entry(a, struct cl_io_lock_link, cill_linkage);
+	l1 = list_entry(b, struct cl_io_lock_link, cill_linkage);
+
+	d0 = &l0->cill_descr;
+	d1 = &l1->cill_descr;
 
 	return lu_fid_cmp(lu_object_fid(&d0->cld_obj->co_lu),
 			  lu_object_fid(&d1->cld_obj->co_lu));
@@ -334,7 +339,8 @@ void cl_io_unlock(const struct lu_env *env, struct cl_io *io)
 	const struct cl_io_slice *scan;
 
 	LASSERT(cl_io_is_loopable(io));
-	LASSERT(CIS_IT_STARTED <= io->ci_state && io->ci_state < CIS_UNLOCKED);
+	LASSERT(CIS_IT_STARTED <= io->ci_state &&
+		io->ci_state < CIS_UNLOCKED);
 	LINVRNT(cl_io_invariant(io));
 
 	set = &io->ci_lockset;
diff --git a/fs/lustre/obdclass/cl_lock.c b/fs/lustre/obdclass/cl_lock.c
index 797302c..af88383 100644
--- a/fs/lustre/obdclass/cl_lock.c
+++ b/fs/lustre/obdclass/cl_lock.c
@@ -80,6 +80,7 @@ void cl_lock_slice_add(struct cl_lock *lock, struct cl_lock_slice *slice,
 void cl_lock_fini(const struct lu_env *env, struct cl_lock *lock)
 {
 	struct cl_lock_slice *slice;
+
 	cl_lock_trace(D_DLMTRACE, env, "destroy lock", lock);
 
 	while ((slice = list_first_entry_or_null(&lock->cll_layers,
@@ -158,7 +159,7 @@ int cl_lock_enqueue(const struct lu_env *env, struct cl_io *io,
 		    struct cl_lock *lock, struct cl_sync_io *anchor)
 {
 	const struct cl_lock_slice *slice;
-	int rc = -ENOSYS;
+	int rc = -EBUSY;
 
 	list_for_each_entry(slice, &lock->cll_layers, cls_linkage) {
 		if (!slice->cls_ops->clo_enqueue)
@@ -246,7 +247,10 @@ void cl_lock_descr_print(const struct lu_env *env, void *cookie,
 	const struct lu_fid *fid;
 
 	fid = lu_object_fid(&descr->cld_obj->co_lu);
-	(*printer)(env, cookie, DDESCR "@" DFID, PDESCR(descr), PFID(fid));
+	(*printer)(env, cookie, DDESCR "@" DFID,
+		   cl_lock_mode_name(descr->cld_mode), descr->cld_mode,
+		   descr->cld_start, descr->cld_end, descr->cld_enq_flags,
+		   PFID(fid));
 }
 EXPORT_SYMBOL(cl_lock_descr_print);
 
diff --git a/fs/lustre/obdclass/cl_object.c b/fs/lustre/obdclass/cl_object.c
index 6c084bc..b4ea585 100644
--- a/fs/lustre/obdclass/cl_object.c
+++ b/fs/lustre/obdclass/cl_object.c
@@ -427,7 +427,7 @@ static int cache_stats_print(const struct cache_stats *cs,
 		seq_printf(m, "%6s", " ");
 		for (i = 0; i < CS_NR; i++)
 			seq_printf(m, "%8s", names[i]);
-		seq_printf(m, "\n");
+		seq_puts(m, "\n");
 	}
 
 	seq_printf(m, "%5.5s:", cs->cs_name);
@@ -489,10 +489,10 @@ int cl_site_stats_print(const struct cl_site *site, struct seq_file *m)
 		[CPS_FREEING]	= "f"
 	};
 /*
-       lookup    hit  total   busy create
-pages: ...... ...... ...... ...... ...... [...... ...... ...... ......]
-locks: ...... ...... ...... ...... ...... [...... ...... ...... ...... ......]
-  env: ...... ...... ...... ...... ......
+ *	lookup    hit  total   busy create
+ * pages: ...... ...... ...... ...... ...... [..... ..... ..... .....]
+ * locks: ...... ...... ...... ...... ...... [..... ..... ..... ..... .....]
+ * env:   ...... ...... ...... ...... ......
  */
 	lu_site_stats_print(&site->cs_lu, m);
 	cache_stats_print(&site->cs_pages, m, 1);
@@ -722,7 +722,7 @@ unsigned int cl_env_cache_purge(unsigned int nr)
 
 	for_each_possible_cpu(i) {
 		write_lock(&cl_envs[i].cec_guard);
-		for (; nr >0 &&
+		for (; nr > 0 &&
 			     (cle = list_first_entry_or_null(
 				     &cl_envs[i].cec_envs,
 				     struct cl_env,
diff --git a/fs/lustre/obdclass/cl_page.c b/fs/lustre/obdclass/cl_page.c
index 349f19e..163f4de 100644
--- a/fs/lustre/obdclass/cl_page.c
+++ b/fs/lustre/obdclass/cl_page.c
@@ -148,8 +148,8 @@ struct cl_page *cl_page_alloc(const struct lu_env *env,
 		lu_ref_init(&page->cp_reference);
 		cl_object_for_each(o2, o) {
 			if (o2->co_ops->coo_page_init) {
-				result = o2->co_ops->coo_page_init(env, o2, page,
-								   ind);
+				result = o2->co_ops->coo_page_init(env, o2,
+								   page, ind);
 				if (result != 0) {
 					__cl_page_delete(env, page);
 					cl_page_free(env, page);
@@ -418,8 +418,9 @@ int cl_page_is_owned(const struct cl_page *pg, const struct cl_io *io)
  * Return:	0 success
  *
  *		-ve failure, e.g., page was destroyed (and landed in
- *		cl_page_state::CPS_FREEING instead of cl_page_state::CPS_CACHED).
- *		or, page was owned by another thread, or in IO.
+ *		cl_page_state::CPS_FREEING instead of
+ *		cl_page_state::CPS_CACHED). or, page was owned by
+ *		another thread, or in IO.
  *
  * \see cl_page_disown()
  * \see cl_page_operations::cpo_own()
diff --git a/fs/lustre/obdclass/class_obd.c b/fs/lustre/obdclass/class_obd.c
index b8fc740..d8fc0db 100644
--- a/fs/lustre/obdclass/class_obd.c
+++ b/fs/lustre/obdclass/class_obd.c
@@ -364,7 +364,8 @@ int class_handle_ioctl(unsigned int cmd, unsigned long arg)
 		 * Today that information is in the sysfs tree so we can in the
 		 * future remove this.
 		 */
-		BUILD_BUG_ON(OBD_OCD_VERSION(3, 0, 53, 0) <= LUSTRE_VERSION_CODE);
+		BUILD_BUG_ON(OBD_OCD_VERSION(3, 0, 53, 0) <=
+			     LUSTRE_VERSION_CODE);
 
 		if (!data->ioc_inlbuf1) {
 			CERROR("No buffer passed in ioctl\n");
diff --git a/fs/lustre/obdclass/genops.c b/fs/lustre/obdclass/genops.c
index 2d12717..9a9de35 100644
--- a/fs/lustre/obdclass/genops.c
+++ b/fs/lustre/obdclass/genops.c
@@ -74,7 +74,8 @@ static struct obd_device *obd_device_alloc(void)
 
 static void obd_device_free(struct obd_device *obd)
 {
-	LASSERTF(obd->obd_magic == OBD_DEVICE_MAGIC, "obd %p obd_magic %08x != %08x\n",
+	LASSERTF(obd->obd_magic == OBD_DEVICE_MAGIC,
+		 "obd %p obd_magic %08x != %08x\n",
 		 obd, obd->obd_magic, OBD_DEVICE_MAGIC);
 	if (obd->obd_namespace) {
 		CERROR("obd %p: namespace %p was not properly cleaned up (obd_force=%d)!\n",
@@ -801,7 +802,8 @@ void class_export_put(struct obd_export *exp)
 
 static void obd_zombie_exp_cull(struct work_struct *ws)
 {
-	struct obd_export *export = container_of(ws, struct obd_export, exp_zombie_work);
+	struct obd_export *export = container_of(ws, struct obd_export,
+						 exp_zombie_work);
 
 	class_export_destroy(export);
 }
@@ -998,7 +1000,8 @@ static void init_imp_at(struct imp_at *at)
 
 static void obd_zombie_imp_cull(struct work_struct *ws)
 {
-	struct obd_import *import = container_of(ws, struct obd_import, imp_zombie_work);
+	struct obd_import *import = container_of(ws, struct obd_import,
+						 imp_zombie_work);
 
 	class_import_destroy(import);
 }
diff --git a/fs/lustre/obdclass/llog.c b/fs/lustre/obdclass/llog.c
index a34b1a7..e9a6514 100644
--- a/fs/lustre/obdclass/llog.c
+++ b/fs/lustre/obdclass/llog.c
@@ -327,7 +327,8 @@ static int llog_process_thread(void *arg)
 					rc = 0;
 					goto out;
 				}
-				CDEBUG(D_OTHER, "Re-read last llog buffer for new records, index %u, last %u\n",
+				CDEBUG(D_OTHER,
+				       "Re-read last llog buffer for new records, index %u, last %u\n",
 				       index, loghandle->lgh_last_idx);
 				/* save offset inside buffer for the re-read */
 				buf_offset = (char *)rec - (char *)buf;
diff --git a/fs/lustre/obdclass/llog_obd.c b/fs/lustre/obdclass/llog_obd.c
index a89ec81..f652eed 100644
--- a/fs/lustre/obdclass/llog_obd.c
+++ b/fs/lustre/obdclass/llog_obd.c
@@ -127,7 +127,7 @@ int llog_cleanup(const struct lu_env *env, struct llog_ctxt *ctxt)
 		       rc, ctxt);
 
 	l_wait_event_abortable(olg->olg_waitq,
-			     llog_group_ctxt_null(olg, idx));
+			       llog_group_ctxt_null(olg, idx));
 
 	return rc;
 }
@@ -165,9 +165,9 @@ int llog_setup(const struct lu_env *env, struct obd_device *obd,
 			ctxt = llog_group_get_ctxt(olg, index);
 			if (ctxt) {
 				/*
-				 * mds_lov_update_desc() might call here multiple
-				 * times. So if the llog is already set up then
-				 * don't to do it again.
+				 * mds_lov_update_desc() might call here
+				 * multiple times. So if the llog is already
+				 * set up then don't to do it again.
 				 */
 				CDEBUG(D_CONFIG, "obd %s ctxt %d already set up\n",
 				       obd->obd_name, index);
diff --git a/fs/lustre/obdclass/llog_swab.c b/fs/lustre/obdclass/llog_swab.c
index 57dadec..49024fd 100644
--- a/fs/lustre/obdclass/llog_swab.c
+++ b/fs/lustre/obdclass/llog_swab.c
@@ -321,7 +321,8 @@ void print_lustre_cfg(struct lustre_cfg *lcfg)
 	CDEBUG(D_OTHER, "\tlcfg->lcfg_command: %#x\n", lcfg->lcfg_command);
 	CDEBUG(D_OTHER, "\tlcfg->lcfg_num: %#x\n", lcfg->lcfg_num);
 	CDEBUG(D_OTHER, "\tlcfg->lcfg_flags: %#x\n", lcfg->lcfg_flags);
-	CDEBUG(D_OTHER, "\tlcfg->lcfg_nid: %s\n", libcfs_nid2str(lcfg->lcfg_nid));
+	CDEBUG(D_OTHER, "\tlcfg->lcfg_nid: %s\n",
+	       libcfs_nid2str(lcfg->lcfg_nid));
 
 	CDEBUG(D_OTHER, "\tlcfg->lcfg_bufcount: %d\n", lcfg->lcfg_bufcount);
 	if (lcfg->lcfg_bufcount < LUSTRE_CFG_MAX_BUFCOUNT)
@@ -407,7 +408,8 @@ void lustre_swab_cfg_marker(struct cfg_marker *marker, int swab, int size)
 		}
 		marker->cm_createtime = createtime;
 		marker->cm_canceltime = canceltime;
-		CDEBUG(D_CONFIG, "Find old cfg_marker(Srv32b,Clt64b) for target %s, converting\n",
+		CDEBUG(D_CONFIG,
+		       "Find old cfg_marker(Srv32b,Clt64b) for target %s, converting\n",
 		       marker->cm_tgtname);
 	} else if (swab) {
 		__swab64s(&marker->cm_createtime);
diff --git a/fs/lustre/obdclass/lprocfs_status.c b/fs/lustre/obdclass/lprocfs_status.c
index 71bf409..c5f5807 100644
--- a/fs/lustre/obdclass/lprocfs_status.c
+++ b/fs/lustre/obdclass/lprocfs_status.c
@@ -330,7 +330,6 @@ void ldebugfs_add_vars(struct dentry *parent, struct lprocfs_vars *list,
 				    list->fops ?: &lprocfs_generic_fops);
 		list++;
 	}
-	return;
 }
 EXPORT_SYMBOL_GPL(ldebugfs_add_vars);
 
@@ -558,7 +557,8 @@ int lprocfs_rd_conn_uuid(struct seq_file *m, void *data)
  * @flags:	CPU interrupt saved state for IRQ-safe locking
  *
  * Returns:	cpuid of current thread or number of allocated structs
- *		negative on error (only for opc LPROCFS_GET_SMP_ID + per-CPU stats)
+ *		negative on error (only for opc LPROCFS_GET_SMP_ID +
+ *				   per-CPU stats)
  */
 int lprocfs_stats_lock(struct lprocfs_stats *stats,
 		       enum lprocfs_stats_lock_ops opc,
diff --git a/fs/lustre/obdclass/lu_object.c b/fs/lustre/obdclass/lu_object.c
index 6f778eb..4302482 100644
--- a/fs/lustre/obdclass/lu_object.c
+++ b/fs/lustre/obdclass/lu_object.c
@@ -498,7 +498,8 @@ struct lu_cdebug_data {
 	.lct_tags	= LCT_MD_THREAD | LCT_DT_THREAD |
 			  LCT_MG_THREAD | LCT_CL_THREAD | LCT_LOCAL,
 	.lct_init	= lu_global_key_init,
-	.lct_fini	= lu_global_key_fini
+	.lct_fini	= lu_global_key_fini,
+	.lct_owner	= THIS_MODULE,
 };
 
 /**
diff --git a/fs/lustre/obdclass/obd_config.c b/fs/lustre/obdclass/obd_config.c
index 0cdadea4..73264fd 100644
--- a/fs/lustre/obdclass/obd_config.c
+++ b/fs/lustre/obdclass/obd_config.c
@@ -509,7 +509,8 @@ static int class_cleanup(struct obd_device *obd, struct lustre_cfg *lcfg)
 		       obd->obd_name, err);
 
 	/* destroy an uuid-export hash body */
-	rhashtable_free_and_destroy(&obd->obd_uuid_hash, uuid_export_exit, NULL);
+	rhashtable_free_and_destroy(&obd->obd_uuid_hash, uuid_export_exit,
+				    NULL);
 
 	class_decref(obd, "setup", obd);
 	obd->obd_set_up = 0;
@@ -831,11 +832,13 @@ int class_process_config(struct lustre_cfg *lcfg)
 		goto out;
 	}
 	case LCFG_ADD_UUID: {
-		CDEBUG(D_IOCTL, "adding mapping from uuid %s to nid %#llx (%s)\n",
+		CDEBUG(D_IOCTL,
+		       "adding mapping from uuid %s to nid %#llx (%s)\n",
 		       lustre_cfg_string(lcfg, 1), lcfg->lcfg_nid,
 		       libcfs_nid2str(lcfg->lcfg_nid));
 
-		err = class_add_uuid(lustre_cfg_string(lcfg, 1), lcfg->lcfg_nid);
+		err = class_add_uuid(lustre_cfg_string(lcfg, 1),
+				     lcfg->lcfg_nid);
 		goto out;
 	}
 	case LCFG_DEL_UUID: {
@@ -893,7 +896,8 @@ int class_process_config(struct lustre_cfg *lcfg)
 
 		marker = lustre_cfg_buf(lcfg, 1);
 		CDEBUG(D_IOCTL, "marker %d (%#x) %.16s %s\n", marker->cm_step,
-		       marker->cm_flags, marker->cm_tgtname, marker->cm_comment);
+		       marker->cm_flags, marker->cm_tgtname,
+		       marker->cm_comment);
 		err = 0;
 		goto out;
 	}
diff --git a/fs/lustre/obdclass/obd_mount.c b/fs/lustre/obdclass/obd_mount.c
index 104e64b..de81baa 100644
--- a/fs/lustre/obdclass/obd_mount.c
+++ b/fs/lustre/obdclass/obd_mount.c
@@ -1187,7 +1187,8 @@ int lmd_parse(char *options, struct lustre_mount_data *lmd)
 	}
 
 	if (!devname) {
-		LCONSOLE_ERROR_MSG(0x164, "Can't find the device name (need mount option 'device=...')\n");
+		LCONSOLE_ERROR_MSG(0x164,
+				   "Can't find the device name (need mount option 'device=...')\n");
 		goto invalid;
 	}
 
diff --git a/fs/lustre/obdecho/debug.c b/fs/lustre/obdecho/debug.c
index 149aca5..a8f773a 100644
--- a/fs/lustre/obdecho/debug.c
+++ b/fs/lustre/obdecho/debug.c
@@ -68,24 +68,28 @@ int block_debug_check(char *who, void *addr, int end, u64 off, u64 id)
 	ne_off = le64_to_cpu(off);
 	id = le64_to_cpu(id);
 	if (memcmp(addr, (char *)&ne_off, LPDS)) {
-		CDEBUG(D_ERROR, "%s: id %#llx offset %llu off: %#llx != %#llx\n",
+		CDEBUG(D_ERROR,
+		       "%s: id %#llx offset %llu off: %#llx != %#llx\n",
 		       who, id, off, *(u64 *)addr, ne_off);
 		err = -EINVAL;
 	}
 	if (memcmp(addr + LPDS, (char *)&id, LPDS)) {
-		CDEBUG(D_ERROR, "%s: id %#llx offset %llu id: %#llx != %#llx\n",
+		CDEBUG(D_ERROR,
+		       "%s: id %#llx offset %llu id: %#llx != %#llx\n",
 		       who, id, off, *(u64 *)(addr + LPDS), id);
 		err = -EINVAL;
 	}
 
 	addr += end - LPDS - LPDS;
 	if (memcmp(addr, (char *)&ne_off, LPDS)) {
-		CDEBUG(D_ERROR, "%s: id %#llx offset %llu end off: %#llx != %#llx\n",
+		CDEBUG(D_ERROR,
+		       "%s: id %#llx offset %llu end off: %#llx != %#llx\n",
 		       who, id, off, *(u64 *)addr, ne_off);
 		err = -EINVAL;
 	}
 	if (memcmp(addr + LPDS, (char *)&id, LPDS)) {
-		CDEBUG(D_ERROR, "%s: id %#llx offset %llu end id: %#llx != %#llx\n",
+		CDEBUG(D_ERROR,
+		       "%s: id %#llx offset %llu end id: %#llx != %#llx\n",
 		       who, id, off, *(u64 *)(addr + LPDS), id);
 		err = -EINVAL;
 	}
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [lustre-devel] [PATCH 10/11] lustre: ldlm: checkpatch cleanup
  2019-07-22  1:52 [lustre-devel] [PATCH 00/11] lustre: cleanup most check patch issues James Simmons
                   ` (8 preceding siblings ...)
  2019-07-22  1:52 ` [lustre-devel] [PATCH 09/11] lustre: obdclass: " James Simmons
@ 2019-07-22  1:52 ` James Simmons
  2019-07-23  2:54   ` NeilBrown
  2019-07-22  1:52 ` [lustre-devel] [PATCH 11/11] lustre: internal headers " James Simmons
  10 siblings, 1 reply; 19+ messages in thread
From: James Simmons @ 2019-07-22  1:52 UTC (permalink / raw)
  To: lustre-devel

Many checkpatch errors exist in the ldlm layer. This address
a good chuck of them. Other are left since future patches will
cleanup those areas. Others will need more code rework so this
patch handles the simple cases. This is a good step forward
toward proper kernel code style compliance.

Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/ldlm/ldlm_extent.c   |  1 -
 fs/lustre/ldlm/ldlm_flock.c    | 15 ++++++++-------
 fs/lustre/ldlm/ldlm_internal.h |  5 +++--
 fs/lustre/ldlm/ldlm_lib.c      |  4 ++--
 fs/lustre/ldlm/ldlm_lock.c     |  8 +++-----
 fs/lustre/ldlm/ldlm_lockd.c    | 22 +++++++++++++---------
 fs/lustre/ldlm/ldlm_pool.c     |  3 ++-
 fs/lustre/ldlm/ldlm_request.c  | 18 ++++++++----------
 8 files changed, 39 insertions(+), 37 deletions(-)

diff --git a/fs/lustre/ldlm/ldlm_extent.c b/fs/lustre/ldlm/ldlm_extent.c
index 99aef0b..0695f7e 100644
--- a/fs/lustre/ldlm/ldlm_extent.c
+++ b/fs/lustre/ldlm/ldlm_extent.c
@@ -79,7 +79,6 @@ u64 ldlm_extent_shift_kms(struct ldlm_lock *lock, u64 old_kms)
 	ldlm_set_kms_ignore(lock);
 
 	list_for_each_entry(lck, &res->lr_granted, l_res_link) {
-
 		if (ldlm_is_kms_ignore(lck))
 			continue;
 
diff --git a/fs/lustre/ldlm/ldlm_flock.c b/fs/lustre/ldlm/ldlm_flock.c
index 4316b2b..d2b4f0d 100644
--- a/fs/lustre/ldlm/ldlm_flock.c
+++ b/fs/lustre/ldlm/ldlm_flock.c
@@ -118,7 +118,7 @@ static int ldlm_process_flock_lock(struct ldlm_lock *req)
 	struct ldlm_lock *new2 = NULL;
 	enum ldlm_mode mode = req->l_req_mode;
 	int added = (mode == LCK_NL);
-	int splitted = 0;
+	int split = 0;
 	const struct ldlm_callback_suite null_cbs = { };
 
 	CDEBUG(D_DLMTRACE,
@@ -146,7 +146,6 @@ static int ldlm_process_flock_lock(struct ldlm_lock *req)
 	 * We may have to merge or split existing locks.
 	 */
 	list_for_each_entry_safe_from(lock, tmp, &res->lr_granted, l_res_link) {
-
 		if (!ldlm_same_flock_owner(lock, new))
 			break;
 
@@ -246,7 +245,7 @@ static int ldlm_process_flock_lock(struct ldlm_lock *req)
 			goto reprocess;
 		}
 
-		splitted = 1;
+		split = 1;
 
 		new2->l_granted_mode = lock->l_granted_mode;
 		new2->l_policy_data.l_flock.pid =
@@ -273,7 +272,7 @@ static int ldlm_process_flock_lock(struct ldlm_lock *req)
 	}
 
 	/* if new2 is created but never used, destroy it*/
-	if (splitted == 0 && new2)
+	if (split == 0 && new2)
 		ldlm_lock_destroy_nolock(new2);
 
 	/* At this point we're granting the lock request. */
@@ -345,12 +344,14 @@ static int ldlm_process_flock_lock(struct ldlm_lock *req)
 		   "client-side enqueue returned a blocked lock, sleeping");
 
 	/* Go to sleep until the lock is granted. */
-	rc = l_wait_event_abortable(lock->l_waitq, is_granted_or_cancelled(lock));
-
+	rc = l_wait_event_abortable(lock->l_waitq,
+				    is_granted_or_cancelled(lock));
 	if (rc) {
 		lock_res_and_lock(lock);
 
-		/* client side - set flag to prevent lock from being put on LRU list */
+		/* client side - set flag to prevent lock from being put on
+		 * LRU list
+		 */
 		ldlm_set_cbpending(lock);
 		unlock_res_and_lock(lock);
 
diff --git a/fs/lustre/ldlm/ldlm_internal.h b/fs/lustre/ldlm/ldlm_internal.h
index d8dcf8a..05d5b08 100644
--- a/fs/lustre/ldlm/ldlm_internal.h
+++ b/fs/lustre/ldlm/ldlm_internal.h
@@ -146,6 +146,7 @@ void ldlm_lock_addref_internal_nolock(struct ldlm_lock *lock,
 void ldlm_lock_decref_internal(struct ldlm_lock *lock, enum ldlm_mode mode);
 void ldlm_lock_decref_internal_nolock(struct ldlm_lock *lock,
 				      enum ldlm_mode mode);
+struct ldlm_lock *ldlm_lock_get(struct ldlm_lock *lock);
 int ldlm_run_ast_work(struct ldlm_namespace *ns, struct list_head *rpc_list,
 		      enum ldlm_desc_ast_t ast_type);
 int ldlm_lock_remove_from_lru_check(struct ldlm_lock *lock, time_t last_use);
@@ -212,8 +213,8 @@ enum ldlm_policy_res {
 #define LDLM_POOL_SYSFS_SET_int(a, b) { a = b; }
 #define LDLM_POOL_SYSFS_PRINT_u64(v) sprintf(buf, "%lld\n", v)
 #define LDLM_POOL_SYSFS_SET_u64(a, b) { a = b; }
-#define LDLM_POOL_SYSFS_PRINT_atomic(v) sprintf(buf, "%d\n", atomic_read(&v))
-#define LDLM_POOL_SYSFS_SET_atomic(a, b) atomic_set(&a, b)
+#define LDLM_POOL_SYSFS_PRINT_atomic(v) sprintf(buf, "%d\n", atomic_read(&(v)))
+#define LDLM_POOL_SYSFS_SET_atomic(a, b) atomic_set(&(a), b)
 
 #define LDLM_POOL_SYSFS_READER_SHOW(var, type)				    \
 	static ssize_t var##_show(struct kobject *kobj,			    \
diff --git a/fs/lustre/ldlm/ldlm_lib.c b/fs/lustre/ldlm/ldlm_lib.c
index 9c61b33..887507d 100644
--- a/fs/lustre/ldlm/ldlm_lib.c
+++ b/fs/lustre/ldlm/ldlm_lib.c
@@ -832,9 +832,9 @@ int ldlm_error2errno(enum ldlm_error error)
 		result = -EBADF;
 		break;
 	default:
-		if (((int)error) < 0)  /* cast to signed type */
+		if (((int)error) < 0) {	/* cast to signed type */
 			result = error; /* as enum ldlm_error can be unsigned */
-		else {
+		} else {
 			CERROR("Invalid DLM result code: %d\n", error);
 			result = -EPROTO;
 		}
diff --git a/fs/lustre/ldlm/ldlm_lock.c b/fs/lustre/ldlm/ldlm_lock.c
index 7ec5fc9..2f2b1ab 100644
--- a/fs/lustre/ldlm/ldlm_lock.c
+++ b/fs/lustre/ldlm/ldlm_lock.c
@@ -874,7 +874,6 @@ static void search_granted_lock(struct list_head *queue,
 	struct ldlm_lock *lock, *mode_end, *policy_end;
 
 	list_for_each_entry(lock, queue, l_res_link) {
-
 		mode_end = list_prev_entry(lock, l_sl_mode);
 
 		if (lock->l_req_mode != req->l_req_mode) {
@@ -1354,8 +1353,7 @@ enum ldlm_mode ldlm_lock_match(struct ldlm_namespace *ns, u64 flags,
 
 		/* check user's security context */
 		if (lock->l_conn_export &&
-		    sptlrpc_import_check_ctx(
-				class_exp2cliimp(lock->l_conn_export))) {
+		    sptlrpc_import_check_ctx(class_exp2cliimp(lock->l_conn_export))) {
 			if (!(flags & LDLM_FL_TEST_LOCK))
 				ldlm_lock_decref_internal(lock, mode);
 			rc = 0;
@@ -1443,7 +1441,7 @@ int ldlm_fill_lvb(struct ldlm_lock *lock, struct req_capsule *pill,
 			if (loc == RCL_CLIENT)
 				lvb = req_capsule_client_swab_get(pill,
 								  &RMF_DLM_LVB,
-							lustre_swab_ost_lvb_v1);
+								  lustre_swab_ost_lvb_v1);
 			else
 				lvb = req_capsule_server_sized_swab_get(pill,
 						&RMF_DLM_LVB, size,
@@ -1744,7 +1742,7 @@ static int ldlm_work_gl_ast_lock(struct ptlrpc_request_set *rqset, void *opaq)
 		return -ENOENT;
 
 	gl_work = list_first_entry(arg->list, struct ldlm_glimpse_work,
-			     gl_list);
+				   gl_list);
 	list_del_init(&gl_work->gl_list);
 
 	lock = gl_work->gl_lock;
diff --git a/fs/lustre/ldlm/ldlm_lockd.c b/fs/lustre/ldlm/ldlm_lockd.c
index 589b89d..56f042c 100644
--- a/fs/lustre/ldlm/ldlm_lockd.c
+++ b/fs/lustre/ldlm/ldlm_lockd.c
@@ -210,9 +210,9 @@ static void ldlm_handle_cp_callback(struct ptlrpc_request *req,
 
 	if (lock->l_resource->lr_type != LDLM_PLAIN) {
 		ldlm_convert_policy_to_local(req->rq_export,
-					  dlm_req->lock_desc.l_resource.lr_type,
-					  &dlm_req->lock_desc.l_policy_data,
-					  &lock->l_policy_data);
+					     dlm_req->lock_desc.l_resource.lr_type,
+					     &dlm_req->lock_desc.l_policy_data,
+					     &lock->l_policy_data);
 		LDLM_DEBUG(lock, "completion AST, new policy data");
 	}
 
@@ -222,7 +222,7 @@ static void ldlm_handle_cp_callback(struct ptlrpc_request *req,
 		   sizeof(lock->l_resource->lr_name)) != 0) {
 		unlock_res_and_lock(lock);
 		rc = ldlm_lock_change_resource(ns, lock,
-				&dlm_req->lock_desc.l_resource.lr_name);
+					       &dlm_req->lock_desc.l_resource.lr_name);
 		if (rc < 0) {
 			LDLM_ERROR(lock, "Failed to allocate resource");
 			goto out;
@@ -286,7 +286,7 @@ static void ldlm_handle_gl_callback(struct ptlrpc_request *req,
 				    struct ldlm_request *dlm_req,
 				    struct ldlm_lock *lock)
 {
-	int rc = -ENOSYS;
+	int rc = -ENXIO;
 
 	LDLM_DEBUG(lock, "client glimpse AST callback handler");
 
@@ -396,8 +396,10 @@ static int ldlm_bl_to_thread(struct ldlm_namespace *ns,
 			     struct list_head *cancels, int count,
 			     enum ldlm_cancel_flags cancel_flags)
 {
+	int rc = 0;
+
 	if (cancels && count == 0)
-		return 0;
+		return rc;
 
 	if (cancel_flags & LCF_ASYNC) {
 		struct ldlm_bl_work_item *blwi;
@@ -407,7 +409,7 @@ static int ldlm_bl_to_thread(struct ldlm_namespace *ns,
 			return -ENOMEM;
 		init_blwi(blwi, ns, ld, cancels, count, lock, cancel_flags);
 
-		return __ldlm_bl_to_thread(blwi, cancel_flags);
+		rc = __ldlm_bl_to_thread(blwi, cancel_flags);
 	} else {
 		/* if it is synchronous call do minimum mem alloc, as it could
 		 * be triggered from kernel shrinker
@@ -416,8 +418,9 @@ static int ldlm_bl_to_thread(struct ldlm_namespace *ns,
 
 		memset(&blwi, 0, sizeof(blwi));
 		init_blwi(&blwi, ns, ld, cancels, count, lock, cancel_flags);
-		return __ldlm_bl_to_thread(&blwi, cancel_flags);
+		rc = __ldlm_bl_to_thread(&blwi, cancel_flags);
 	}
+	return rc;
 }
 
 int ldlm_bl_to_thread_lock(struct ldlm_namespace *ns, struct ldlm_lock_desc *ld,
@@ -446,7 +449,7 @@ static int ldlm_handle_setinfo(struct ptlrpc_request *req)
 	char *key;
 	void *val;
 	int keylen, vallen;
-	int rc = -ENOSYS;
+	int rc = -ENXIO;
 
 	DEBUG_REQ(D_HSM, req, "%s: handle setinfo\n", obd->obd_name);
 
@@ -875,6 +878,7 @@ int ldlm_get_ref(void)
 void ldlm_put_ref(void)
 {
 	int rc = 0;
+
 	mutex_lock(&ldlm_ref_mutex);
 	if (ldlm_refcount == 1) {
 		rc = ldlm_cleanup();
diff --git a/fs/lustre/ldlm/ldlm_pool.c b/fs/lustre/ldlm/ldlm_pool.c
index 1f81795..6714c30 100644
--- a/fs/lustre/ldlm/ldlm_pool.c
+++ b/fs/lustre/ldlm/ldlm_pool.c
@@ -360,7 +360,8 @@ static int ldlm_pool_recalc(struct ldlm_pool *pl)
 	recalc_interval_sec = ktime_get_real_seconds() - pl->pl_recalc_time;
 	if (recalc_interval_sec > 0) {
 		spin_lock(&pl->pl_lock);
-		recalc_interval_sec = ktime_get_real_seconds() - pl->pl_recalc_time;
+		recalc_interval_sec = ktime_get_real_seconds() -
+				      pl->pl_recalc_time;
 
 		if (recalc_interval_sec > 0) {
 			/*
diff --git a/fs/lustre/ldlm/ldlm_request.c b/fs/lustre/ldlm/ldlm_request.c
index a614d74..b7dcfda 100644
--- a/fs/lustre/ldlm/ldlm_request.c
+++ b/fs/lustre/ldlm/ldlm_request.c
@@ -438,7 +438,7 @@ int ldlm_cli_enqueue_fini(struct obd_export *exp, struct ptlrpc_request *req,
 			       PLDLMRES(lock->l_resource));
 
 			rc = ldlm_lock_change_resource(ns, lock,
-					&reply->lock_desc.l_resource.lr_name);
+						       &reply->lock_desc.l_resource.lr_name);
 			if (rc || !lock->l_resource) {
 				rc = -ENOMEM;
 				goto cleanup;
@@ -450,9 +450,9 @@ int ldlm_cli_enqueue_fini(struct obd_export *exp, struct ptlrpc_request *req,
 			      !(exp_connect_flags(exp) & OBD_CONNECT_IBITS)))
 				/* We assume lock type cannot change on server*/
 				ldlm_convert_policy_to_local(exp,
-						lock->l_resource->lr_type,
-						&reply->lock_desc.l_policy_data,
-						&lock->l_policy_data);
+							     lock->l_resource->lr_type,
+							     &reply->lock_desc.l_policy_data,
+							     &lock->l_policy_data);
 		if (type != LDLM_PLAIN)
 			LDLM_DEBUG(lock,
 				   "client-side enqueue, new policy data");
@@ -927,8 +927,7 @@ static int ldlm_cli_cancel_req(struct obd_export *exp,
 		if (rc == LUSTRE_ESTALE) {
 			CDEBUG(D_DLMTRACE,
 			       "client/server (nid %s) out of sync -- not fatal\n",
-			       libcfs_nid2str(req->rq_import->
-					      imp_connection->c_peer.nid));
+			       libcfs_nid2str(req->rq_import->imp_connection->c_peer.nid));
 			rc = 0;
 		} else if (rc == -ETIMEDOUT && /* check there was no reconnect*/
 			   req->rq_import_generation == imp->imp_generation) {
@@ -1290,10 +1289,9 @@ static enum ldlm_policy_res ldlm_cancel_aged_policy(struct ldlm_namespace *ns,
 		LDLM_POLICY_KEEP_LOCK : LDLM_POLICY_CANCEL_LOCK;
 }
 
-typedef enum ldlm_policy_res (*ldlm_cancel_lru_policy_t)(
-						      struct ldlm_namespace *,
-						      struct ldlm_lock *, int,
-						      int, int);
+typedef enum ldlm_policy_res (*ldlm_cancel_lru_policy_t)(struct ldlm_namespace *,
+							 struct ldlm_lock *,
+							 int, int, int);
 
 static ldlm_cancel_lru_policy_t
 ldlm_cancel_lru_policy(struct ldlm_namespace *ns, int lru_flags)
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [lustre-devel] [PATCH 11/11] lustre: internal headers checkpatch cleanup
  2019-07-22  1:52 [lustre-devel] [PATCH 00/11] lustre: cleanup most check patch issues James Simmons
                   ` (9 preceding siblings ...)
  2019-07-22  1:52 ` [lustre-devel] [PATCH 10/11] lustre: ldlm: " James Simmons
@ 2019-07-22  1:52 ` James Simmons
  10 siblings, 0 replies; 19+ messages in thread
From: James Simmons @ 2019-07-22  1:52 UTC (permalink / raw)
  To: lustre-devel

Many checkpatch errors exist in the headers. This address
a good chuck of them. Other are left since future patches will
cleanup those areas. Others will need more code rework so this
patch handles the simple cases. This is a good step forward
toward proper kernel code style compliance.

Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/include/cl_object.h      | 13 +++++-----
 fs/lustre/include/lprocfs_status.h | 11 ++++----
 fs/lustre/include/lu_object.h      | 26 ++++++++++---------
 fs/lustre/include/lustre_acl.h     |  4 +--
 fs/lustre/include/lustre_dlm.h     | 53 +++++++++++++++++++++++---------------
 fs/lustre/include/seq_range.h      |  8 +++---
 6 files changed, 65 insertions(+), 50 deletions(-)

diff --git a/fs/lustre/include/cl_object.h b/fs/lustre/include/cl_object.h
index 691c2f5..be30ce8 100644
--- a/fs/lustre/include/cl_object.h
+++ b/fs/lustre/include/cl_object.h
@@ -987,8 +987,9 @@ struct cl_page_operations {
 /**
  * Helper macro, dumping detailed information about @page into a log.
  */
-#define CL_PAGE_DEBUG(mask, env, page, format, ...)			\
+#define CL_PAGE_DEBUG(_mask, env, page, format, ...)			\
 do {									\
+	typeof(_mask) (mask) = (_mask);					\
 	if (cfs_cdebug_show(mask, DEBUG_SUBSYSTEM)) {			\
 		LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, mask, NULL);	\
 		cl_page_print(env, &msgdata, lu_cdebug_printer, page);  \
@@ -999,8 +1000,9 @@ struct cl_page_operations {
 /**
  * Helper macro, dumping shorter information about @page into a log.
  */
-#define CL_PAGE_HEADER(mask, env, page, format, ...)			\
+#define CL_PAGE_HEADER(_mask, env, page, format, ...)			\
 do {									\
+	typeof(_mask) (mask) = (_mask);					\
 	if (cfs_cdebug_show(mask, DEBUG_SUBSYSTEM)) {			\
 		LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, mask, NULL);	\
 		cl_page_header_print(env, &msgdata, lu_cdebug_printer, page); \
@@ -1163,9 +1165,6 @@ struct cl_lock_descr {
 };
 
 #define DDESCR "%s(%d):[%lu, %lu]:%x"
-#define PDESCR(descr)							\
-	cl_lock_mode_name((descr)->cld_mode), (descr)->cld_mode,	\
-	(descr)->cld_start, (descr)->cld_end, (descr)->cld_enq_flags
 
 const char *cl_lock_mode_name(const enum cl_lock_mode mode);
 
@@ -1237,8 +1236,9 @@ struct cl_lock_operations {
 			 const struct cl_lock_slice *slice);
 };
 
-#define CL_LOCK_DEBUG(mask, env, lock, format, ...)			\
+#define CL_LOCK_DEBUG(_mask, env, lock, format, ...)			\
 do {									\
+	typeof(_mask) (mask) = (_mask);					\
 	LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, mask, NULL);		\
 									\
 	if (cfs_cdebug_show(mask, DEBUG_SUBSYSTEM)) {			\
@@ -1657,6 +1657,7 @@ struct cl_io_lock_link {
 	void	       (*cill_fini)(const struct lu_env *env,
 				    struct cl_io_lock_link *link);
 };
+
 #define cill_descr	cill_lock.cll_descr
 
 /**
diff --git a/fs/lustre/include/lprocfs_status.h b/fs/lustre/include/lprocfs_status.h
index 8565c28..815ca37 100644
--- a/fs/lustre/include/lprocfs_status.h
+++ b/fs/lustre/include/lprocfs_status.h
@@ -435,11 +435,11 @@ void lprocfs_stats_unlock(struct lprocfs_stats *stats,
 	lprocfs_counter_sub(stats, idx, 1)
 
 s64 lprocfs_read_helper(struct lprocfs_counter *lc,
-			  struct lprocfs_counter_header *header,
-			  enum lprocfs_stats_flags flags,
-			  enum lprocfs_fields_flags field);
+			struct lprocfs_counter_header *header,
+			enum lprocfs_stats_flags flags,
+			enum lprocfs_fields_flags field);
 u64 lprocfs_stats_collector(struct lprocfs_stats *stats, int idx,
-			      enum lprocfs_fields_flags field);
+			    enum lprocfs_fields_flags field);
 
 extern struct lprocfs_stats *
 lprocfs_alloc_stats(unsigned int num, enum lprocfs_stats_flags flags);
@@ -553,7 +553,8 @@ void lprocfs_stats_collect(struct lprocfs_stats *stats, int idx,
 	{								\
 		return lprocfs_wr_##type(file, buffer, count, off);	\
 	}								\
-	static int name##_##type##_open(struct inode *inode, struct file *file) \
+	static int name##_##type##_open(struct inode *inode,		\
+					struct file *file)		\
 	{								\
 		return single_open(file, NULL, inode->i_private);	\
 	}								\
diff --git a/fs/lustre/include/lu_object.h b/fs/lustre/include/lu_object.h
index 8137628..05f8d81 100644
--- a/fs/lustre/include/lu_object.h
+++ b/fs/lustre/include/lu_object.h
@@ -142,10 +142,10 @@ struct lu_device_operations {
 	/**
 	 * process config specific for device.
 	 */
-	int (*ldo_process_config)(const struct lu_env *env,
-				  struct lu_device *, struct lustre_cfg *);
-	int (*ldo_recovery_complete)(const struct lu_env *,
-				     struct lu_device *);
+	int (*ldo_process_config)(const struct lu_env *env, struct lu_device *d,
+				  struct lustre_cfg *cfg);
+	int (*ldo_recovery_complete)(const struct lu_env *env,
+				     struct lu_device *dev);
 
 	/**
 	 * initialize local objects for device. this method called after layer
@@ -153,7 +153,7 @@ struct lu_device_operations {
 	 * serving user requests.
 	 */
 
-	int (*ldo_prepare)(const struct lu_env *,
+	int (*ldo_prepare)(const struct lu_env *env,
 			   struct lu_device *parent,
 			   struct lu_device *dev);
 
@@ -347,22 +347,22 @@ struct lu_device_type_operations {
 	 * lu_device_type_operations::ldto_device_alloc(). Returns pointer to
 	 * the next device in the stack.
 	 */
-	struct lu_device *(*ldto_device_free)(const struct lu_env *,
-					      struct lu_device *);
+	struct lu_device *(*ldto_device_free)(const struct lu_env *env,
+					      struct lu_device *dev);
 
 	/**
 	 * Initialize the devices after allocation
 	 */
 	int  (*ldto_device_init)(const struct lu_env *env,
-				 struct lu_device *, const char *,
-				 struct lu_device *);
+				 struct lu_device *dev, const char *name,
+				 struct lu_device *next);
 	/**
 	 * Finalize device. Dual to
 	 * lu_device_type_operations::ldto_device_init(). Returns pointer to
 	 * the next device in the stack.
 	 */
 	struct lu_device *(*ldto_device_fini)(const struct lu_env *env,
-					      struct lu_device *);
+					      struct lu_device *dev);
 	/**
 	 * Initialize device type. This is called on module load.
 	 */
@@ -753,8 +753,9 @@ int lu_cdebug_printer(const struct lu_env *env,
 /**
  * Print object description followed by a user-supplied message.
  */
-#define LU_OBJECT_DEBUG(mask, env, object, format, ...)			\
+#define LU_OBJECT_DEBUG(_mask, env, object, format, ...)		\
 do {									\
+	typeof(_mask) (mask) = (_mask);					\
 	if (cfs_cdebug_show(mask, DEBUG_SUBSYSTEM)) {			\
 		LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, mask, NULL);	\
 		lu_object_print(env, &msgdata, lu_cdebug_printer, object);\
@@ -765,8 +766,9 @@ int lu_cdebug_printer(const struct lu_env *env,
 /**
  * Print short object description followed by a user-supplied message.
  */
-#define LU_OBJECT_HEADER(mask, env, object, format, ...)		\
+#define LU_OBJECT_HEADER(_mask, env, object, format, ...)		\
 do {									\
+	typeof(_mask) (mask) = (_mask);					\
 	if (cfs_cdebug_show(mask, DEBUG_SUBSYSTEM)) {			\
 		LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, mask, NULL);	\
 		lu_object_header_print(env, &msgdata, lu_cdebug_printer,\
diff --git a/fs/lustre/include/lustre_acl.h b/fs/lustre/include/lustre_acl.h
index e7575a1..aff77b0 100644
--- a/fs/lustre/include/lustre_acl.h
+++ b/fs/lustre/include/lustre_acl.h
@@ -40,8 +40,8 @@
 #include <linux/posix_acl_xattr.h>
 
 #define LUSTRE_POSIX_ACL_MAX_ENTRIES	32
-#define LUSTRE_POSIX_ACL_MAX_SIZE_OLD						\
-	(sizeof(struct posix_acl_xattr_header) +				\
+#define LUSTRE_POSIX_ACL_MAX_SIZE_OLD					\
+	(sizeof(struct posix_acl_xattr_header) +			\
 	 LUSTRE_POSIX_ACL_MAX_ENTRIES * sizeof(struct posix_acl_xattr_entry))
 
 #else /* ! CONFIG_FS_POSIX_ACL */
diff --git a/fs/lustre/include/lustre_dlm.h b/fs/lustre/include/lustre_dlm.h
index 1bd5119..a1ff852 100644
--- a/fs/lustre/include/lustre_dlm.h
+++ b/fs/lustre/include/lustre_dlm.h
@@ -165,10 +165,9 @@ static inline int lockmode_compat(enum ldlm_mode exist_mode,
 #define DLM_MDS_NAMESPACE 2
 
 /* XXX
-   - do we just separate this by security domains and use a prefix for
-     multiple namespaces in the same domain?
-   -
-*/
+ * - do we just separate this by security domains and use a prefix for
+ *    multiple namespaces in the same domain?
+ */
 
 /**
  * Locking rules for LDLM:
@@ -444,7 +443,7 @@ struct ldlm_namespace {
 	enum ldlm_appetite	ns_appetite;
 
 	/** Limit of parallel AST RPC count. */
-	unsigned		ns_max_parallel_ast;
+	unsigned int		ns_max_parallel_ast;
 
 	/**
 	 * Callback to check if a lock is good to be canceled by ELC or
@@ -845,8 +844,10 @@ struct ldlm_resource {
 	 */
 	struct ldlm_interval_tree	*lr_itree;
 
-	/** Type of locks this resource can hold. Only one type per resource. */
-	enum ldlm_type			lr_type; /* LDLM_{PLAIN,EXTENT,FLOCK,IBITS} */
+	/** Type of locks this resource can hold. Only one type per resource.
+	 *  LDLM_{PLAIN,EXTENT,FLOCK,IBITS}
+	 */
+	enum ldlm_type			lr_type;
 
 	/**
 	 * Server-side-only lock value block elements.
@@ -944,13 +945,20 @@ struct ldlm_ast_work {
  * Common ldlm_enqueue parameters
  */
 struct ldlm_enqueue_info {
-	enum ldlm_type		ei_type;  /** Type of the lock being enqueued. */
-	enum ldlm_mode		ei_mode;  /** Mode of the lock being enqueued. */
-	void			*ei_cb_bl;  /** blocking lock callback */
-	void			*ei_cb_cp;  /** lock completion callback */
-	void			*ei_cb_gl;  /** lock glimpse callback */
-	void			*ei_cbdata; /** Data to be passed into callbacks. */
-	unsigned int		ei_enq_slave:1; /* whether enqueue slave stripes */
+	/* Type of the lock being enqueued. */
+	enum ldlm_type		ei_type;
+	/* Mode of the lock being enqueued. */
+	enum ldlm_mode		ei_mode;
+	/* blocking lock callback */
+	void			*ei_cb_bl;
+	/* lock completion callback */
+	void			*ei_cb_cp;
+	/* lock glimpse callback */
+	void			*ei_cb_gl;
+	/* Data to be passed into callbacks. */
+	void			*ei_cbdata;
+	/* whether enqueue slave stripes */
+	unsigned int		ei_enq_slave:1;
 };
 
 extern struct obd_ops ldlm_obd_ops;
@@ -1027,7 +1035,8 @@ typedef int (*ldlm_processing_policy)(struct ldlm_lock *lock, u64 *flags,
  * namespace or every resource in a namespace.
  * @{
  */
-int ldlm_resource_iterate(struct ldlm_namespace *, const struct ldlm_res_id *,
+int ldlm_resource_iterate(struct ldlm_namespace *ns,
+			  const struct ldlm_res_id *res_id,
 			  ldlm_iterator_t iter, void *data);
 /** @} ldlm_iterator */
 
@@ -1053,9 +1062,10 @@ struct ldlm_callback_suite {
 /* ldlm_lock.c */
 void ldlm_lock2handle(const struct ldlm_lock *lock,
 		      struct lustre_handle *lockh);
-struct ldlm_lock *__ldlm_handle2lock(const struct lustre_handle *, u64 flags);
-void ldlm_cancel_callback(struct ldlm_lock *);
-int ldlm_lock_remove_from_lru(struct ldlm_lock *);
+struct ldlm_lock *__ldlm_handle2lock(const struct lustre_handle *lh,
+				     u64 flags);
+void ldlm_cancel_callback(struct ldlm_lock *lock);
+int ldlm_lock_remove_from_lru(struct ldlm_lock *lock);
 int ldlm_lock_set_data(const struct lustre_handle *lockh, void *data);
 
 /**
@@ -1155,9 +1165,10 @@ void ldlm_lock_decref_and_cancel(const struct lustre_handle *lockh,
 void ldlm_lock_allow_match(struct ldlm_lock *lock);
 void ldlm_lock_allow_match_locked(struct ldlm_lock *lock);
 enum ldlm_mode ldlm_lock_match(struct ldlm_namespace *ns, u64 flags,
-			       const struct ldlm_res_id *,
-			       enum ldlm_type type, union ldlm_policy_data *,
-			       enum ldlm_mode mode, struct lustre_handle *,
+			       const struct ldlm_res_id *res_id,
+			       enum ldlm_type type,
+			       union ldlm_policy_data *policy,
+			       enum ldlm_mode mode, struct lustre_handle *lh,
 			       int unref);
 enum ldlm_mode ldlm_revalidate_lock_handle(const struct lustre_handle *lockh,
 					   u64 *bits);
diff --git a/fs/lustre/include/seq_range.h b/fs/lustre/include/seq_range.h
index dbf73ea..ede0c4b 100644
--- a/fs/lustre/include/seq_range.h
+++ b/fs/lustre/include/seq_range.h
@@ -191,10 +191,10 @@ static inline int lu_seq_range_compare_loc(const struct lu_seq_range *r1,
  */
 #define DRANGE "[%#16.16llx-%#16.16llx]:%x:%s"
 
-#define PRANGE(range)		\
-	(range)->lsr_start,	\
-	(range)->lsr_end,	\
-	(range)->lsr_index,	\
+#define PRANGE(range)				\
+	(range)->lsr_start,			\
+	(range)->lsr_end,			\
+	(range)->lsr_index,			\
 	fld_range_is_mdt(range) ? "mdt" : "ost"
 
 #endif
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [lustre-devel] [PATCH 10/11] lustre: ldlm: checkpatch cleanup
  2019-07-22  1:52 ` [lustre-devel] [PATCH 10/11] lustre: ldlm: " James Simmons
@ 2019-07-23  2:54   ` NeilBrown
  2019-07-24  3:37     ` James Simmons
  0 siblings, 1 reply; 19+ messages in thread
From: NeilBrown @ 2019-07-23  2:54 UTC (permalink / raw)
  To: lustre-devel

On Sun, Jul 21 2019, James Simmons wrote:

> Many checkpatch errors exist in the ldlm layer. This address
> a good chuck of them. Other are left since future patches will
> cleanup those areas. Others will need more code rework so this
> patch handles the simple cases. This is a good step forward
> toward proper kernel code style compliance.
>
> Signed-off-by: James Simmons <jsimmons@infradead.org>
> ---
>  fs/lustre/ldlm/ldlm_extent.c   |  1 -
>  fs/lustre/ldlm/ldlm_flock.c    | 15 ++++++++-------
>  fs/lustre/ldlm/ldlm_internal.h |  5 +++--
>  fs/lustre/ldlm/ldlm_lib.c      |  4 ++--
>  fs/lustre/ldlm/ldlm_lock.c     |  8 +++-----
>  fs/lustre/ldlm/ldlm_lockd.c    | 22 +++++++++++++---------
>  fs/lustre/ldlm/ldlm_pool.c     |  3 ++-
>  fs/lustre/ldlm/ldlm_request.c  | 18 ++++++++----------
>  8 files changed, 39 insertions(+), 37 deletions(-)
>
> diff --git a/fs/lustre/ldlm/ldlm_extent.c b/fs/lustre/ldlm/ldlm_extent.c
> index 99aef0b..0695f7e 100644
> --- a/fs/lustre/ldlm/ldlm_extent.c
> +++ b/fs/lustre/ldlm/ldlm_extent.c
> @@ -79,7 +79,6 @@ u64 ldlm_extent_shift_kms(struct ldlm_lock *lock, u64 old_kms)
>  	ldlm_set_kms_ignore(lock);
>  
>  	list_for_each_entry(lck, &res->lr_granted, l_res_link) {
> -
>  		if (ldlm_is_kms_ignore(lck))
>  			continue;
>  
> diff --git a/fs/lustre/ldlm/ldlm_flock.c b/fs/lustre/ldlm/ldlm_flock.c
> index 4316b2b..d2b4f0d 100644
> --- a/fs/lustre/ldlm/ldlm_flock.c
> +++ b/fs/lustre/ldlm/ldlm_flock.c
> @@ -118,7 +118,7 @@ static int ldlm_process_flock_lock(struct ldlm_lock *req)
>  	struct ldlm_lock *new2 = NULL;
>  	enum ldlm_mode mode = req->l_req_mode;
>  	int added = (mode == LCK_NL);
> -	int splitted = 0;
> +	int split = 0;
>  	const struct ldlm_callback_suite null_cbs = { };
>  
>  	CDEBUG(D_DLMTRACE,
> @@ -146,7 +146,6 @@ static int ldlm_process_flock_lock(struct ldlm_lock *req)
>  	 * We may have to merge or split existing locks.
>  	 */
>  	list_for_each_entry_safe_from(lock, tmp, &res->lr_granted, l_res_link) {
> -
>  		if (!ldlm_same_flock_owner(lock, new))
>  			break;
>  
> @@ -246,7 +245,7 @@ static int ldlm_process_flock_lock(struct ldlm_lock *req)
>  			goto reprocess;
>  		}
>  
> -		splitted = 1;
> +		split = 1;
>  
>  		new2->l_granted_mode = lock->l_granted_mode;
>  		new2->l_policy_data.l_flock.pid =
> @@ -273,7 +272,7 @@ static int ldlm_process_flock_lock(struct ldlm_lock *req)
>  	}
>  
>  	/* if new2 is created but never used, destroy it*/
> -	if (splitted == 0 && new2)
> +	if (split == 0 && new2)
>  		ldlm_lock_destroy_nolock(new2);
>  
>  	/* At this point we're granting the lock request. */
> @@ -345,12 +344,14 @@ static int ldlm_process_flock_lock(struct ldlm_lock *req)
>  		   "client-side enqueue returned a blocked lock, sleeping");
>  
>  	/* Go to sleep until the lock is granted. */
> -	rc = l_wait_event_abortable(lock->l_waitq, is_granted_or_cancelled(lock));
> -
> +	rc = l_wait_event_abortable(lock->l_waitq,
> +				    is_granted_or_cancelled(lock));
>  	if (rc) {
>  		lock_res_and_lock(lock);
>  
> -		/* client side - set flag to prevent lock from being put on LRU list */
> +		/* client side - set flag to prevent lock from being put on
> +		 * LRU list
> +		 */
>  		ldlm_set_cbpending(lock);
>  		unlock_res_and_lock(lock);
>  
> diff --git a/fs/lustre/ldlm/ldlm_internal.h b/fs/lustre/ldlm/ldlm_internal.h
> index d8dcf8a..05d5b08 100644
> --- a/fs/lustre/ldlm/ldlm_internal.h
> +++ b/fs/lustre/ldlm/ldlm_internal.h
> @@ -146,6 +146,7 @@ void ldlm_lock_addref_internal_nolock(struct ldlm_lock *lock,
>  void ldlm_lock_decref_internal(struct ldlm_lock *lock, enum ldlm_mode mode);
>  void ldlm_lock_decref_internal_nolock(struct ldlm_lock *lock,
>  				      enum ldlm_mode mode);
> +struct ldlm_lock *ldlm_lock_get(struct ldlm_lock *lock);
>  int ldlm_run_ast_work(struct ldlm_namespace *ns, struct list_head *rpc_list,
>  		      enum ldlm_desc_ast_t ast_type);
>  int ldlm_lock_remove_from_lru_check(struct ldlm_lock *lock, time_t last_use);
> @@ -212,8 +213,8 @@ enum ldlm_policy_res {
>  #define LDLM_POOL_SYSFS_SET_int(a, b) { a = b; }
>  #define LDLM_POOL_SYSFS_PRINT_u64(v) sprintf(buf, "%lld\n", v)
>  #define LDLM_POOL_SYSFS_SET_u64(a, b) { a = b; }
> -#define LDLM_POOL_SYSFS_PRINT_atomic(v) sprintf(buf, "%d\n", atomic_read(&v))
> -#define LDLM_POOL_SYSFS_SET_atomic(a, b) atomic_set(&a, b)
> +#define LDLM_POOL_SYSFS_PRINT_atomic(v) sprintf(buf, "%d\n", atomic_read(&(v)))
> +#define LDLM_POOL_SYSFS_SET_atomic(a, b) atomic_set(&(a), b)
>  
>  #define LDLM_POOL_SYSFS_READER_SHOW(var, type)				    \
>  	static ssize_t var##_show(struct kobject *kobj,			    \
> diff --git a/fs/lustre/ldlm/ldlm_lib.c b/fs/lustre/ldlm/ldlm_lib.c
> index 9c61b33..887507d 100644
> --- a/fs/lustre/ldlm/ldlm_lib.c
> +++ b/fs/lustre/ldlm/ldlm_lib.c
> @@ -832,9 +832,9 @@ int ldlm_error2errno(enum ldlm_error error)
>  		result = -EBADF;
>  		break;
>  	default:
> -		if (((int)error) < 0)  /* cast to signed type */
> +		if (((int)error) < 0) {	/* cast to signed type */
>  			result = error; /* as enum ldlm_error can be unsigned */
> -		else {
> +		} else {
>  			CERROR("Invalid DLM result code: %d\n", error);
>  			result = -EPROTO;
>  		}
> diff --git a/fs/lustre/ldlm/ldlm_lock.c b/fs/lustre/ldlm/ldlm_lock.c
> index 7ec5fc9..2f2b1ab 100644
> --- a/fs/lustre/ldlm/ldlm_lock.c
> +++ b/fs/lustre/ldlm/ldlm_lock.c
> @@ -874,7 +874,6 @@ static void search_granted_lock(struct list_head *queue,
>  	struct ldlm_lock *lock, *mode_end, *policy_end;
>  
>  	list_for_each_entry(lock, queue, l_res_link) {
> -
>  		mode_end = list_prev_entry(lock, l_sl_mode);
>  
>  		if (lock->l_req_mode != req->l_req_mode) {
> @@ -1354,8 +1353,7 @@ enum ldlm_mode ldlm_lock_match(struct ldlm_namespace *ns, u64 flags,
>  
>  		/* check user's security context */
>  		if (lock->l_conn_export &&
> -		    sptlrpc_import_check_ctx(
> -				class_exp2cliimp(lock->l_conn_export))) {
> +		    sptlrpc_import_check_ctx(class_exp2cliimp(lock->l_conn_export))) {
>  			if (!(flags & LDLM_FL_TEST_LOCK))
>  				ldlm_lock_decref_internal(lock, mode);
>  			rc = 0;
> @@ -1443,7 +1441,7 @@ int ldlm_fill_lvb(struct ldlm_lock *lock, struct req_capsule *pill,
>  			if (loc == RCL_CLIENT)
>  				lvb = req_capsule_client_swab_get(pill,
>  								  &RMF_DLM_LVB,
> -							lustre_swab_ost_lvb_v1);
> +								  lustre_swab_ost_lvb_v1);
>  			else
>  				lvb = req_capsule_server_sized_swab_get(pill,
>  						&RMF_DLM_LVB, size,
> @@ -1744,7 +1742,7 @@ static int ldlm_work_gl_ast_lock(struct ptlrpc_request_set *rqset, void *opaq)
>  		return -ENOENT;
>  
>  	gl_work = list_first_entry(arg->list, struct ldlm_glimpse_work,
> -			     gl_list);
> +				   gl_list);
>  	list_del_init(&gl_work->gl_list);
>  
>  	lock = gl_work->gl_lock;
> diff --git a/fs/lustre/ldlm/ldlm_lockd.c b/fs/lustre/ldlm/ldlm_lockd.c
> index 589b89d..56f042c 100644
> --- a/fs/lustre/ldlm/ldlm_lockd.c
> +++ b/fs/lustre/ldlm/ldlm_lockd.c
> @@ -210,9 +210,9 @@ static void ldlm_handle_cp_callback(struct ptlrpc_request *req,
>  
>  	if (lock->l_resource->lr_type != LDLM_PLAIN) {
>  		ldlm_convert_policy_to_local(req->rq_export,
> -					  dlm_req->lock_desc.l_resource.lr_type,
> -					  &dlm_req->lock_desc.l_policy_data,
> -					  &lock->l_policy_data);
> +					     dlm_req->lock_desc.l_resource.lr_type,
> +					     &dlm_req->lock_desc.l_policy_data,
> +					     &lock->l_policy_data);
>  		LDLM_DEBUG(lock, "completion AST, new policy data");
>  	}
>  
> @@ -222,7 +222,7 @@ static void ldlm_handle_cp_callback(struct ptlrpc_request *req,
>  		   sizeof(lock->l_resource->lr_name)) != 0) {
>  		unlock_res_and_lock(lock);
>  		rc = ldlm_lock_change_resource(ns, lock,
> -				&dlm_req->lock_desc.l_resource.lr_name);
> +					       &dlm_req->lock_desc.l_resource.lr_name);
>  		if (rc < 0) {
>  			LDLM_ERROR(lock, "Failed to allocate resource");
>  			goto out;
> @@ -286,7 +286,7 @@ static void ldlm_handle_gl_callback(struct ptlrpc_request *req,
>  				    struct ldlm_request *dlm_req,
>  				    struct ldlm_lock *lock)
>  {
> -	int rc = -ENOSYS;
> +	int rc = -ENXIO;

Is this really a checkpatch warning?
Is it safe?
Is there a visible behaviour change here, or is the error status only
used internally?

There seem to be a few others ... maybe checkpatch doesn't like ENOSYS -
probably reasonable.

Everything else looks OK.

Thanks for these!

NeilBrown


>  
>  	LDLM_DEBUG(lock, "client glimpse AST callback handler");
>  
> @@ -396,8 +396,10 @@ static int ldlm_bl_to_thread(struct ldlm_namespace *ns,
>  			     struct list_head *cancels, int count,
>  			     enum ldlm_cancel_flags cancel_flags)
>  {
> +	int rc = 0;
> +
>  	if (cancels && count == 0)
> -		return 0;
> +		return rc;
>  
>  	if (cancel_flags & LCF_ASYNC) {
>  		struct ldlm_bl_work_item *blwi;
> @@ -407,7 +409,7 @@ static int ldlm_bl_to_thread(struct ldlm_namespace *ns,
>  			return -ENOMEM;
>  		init_blwi(blwi, ns, ld, cancels, count, lock, cancel_flags);
>  
> -		return __ldlm_bl_to_thread(blwi, cancel_flags);
> +		rc = __ldlm_bl_to_thread(blwi, cancel_flags);
>  	} else {
>  		/* if it is synchronous call do minimum mem alloc, as it could
>  		 * be triggered from kernel shrinker
> @@ -416,8 +418,9 @@ static int ldlm_bl_to_thread(struct ldlm_namespace *ns,
>  
>  		memset(&blwi, 0, sizeof(blwi));
>  		init_blwi(&blwi, ns, ld, cancels, count, lock, cancel_flags);
> -		return __ldlm_bl_to_thread(&blwi, cancel_flags);
> +		rc = __ldlm_bl_to_thread(&blwi, cancel_flags);
>  	}
> +	return rc;
>  }
>  
>  int ldlm_bl_to_thread_lock(struct ldlm_namespace *ns, struct ldlm_lock_desc *ld,
> @@ -446,7 +449,7 @@ static int ldlm_handle_setinfo(struct ptlrpc_request *req)
>  	char *key;
>  	void *val;
>  	int keylen, vallen;
> -	int rc = -ENOSYS;
> +	int rc = -ENXIO;
>  
>  	DEBUG_REQ(D_HSM, req, "%s: handle setinfo\n", obd->obd_name);
>  
> @@ -875,6 +878,7 @@ int ldlm_get_ref(void)
>  void ldlm_put_ref(void)
>  {
>  	int rc = 0;
> +
>  	mutex_lock(&ldlm_ref_mutex);
>  	if (ldlm_refcount == 1) {
>  		rc = ldlm_cleanup();
> diff --git a/fs/lustre/ldlm/ldlm_pool.c b/fs/lustre/ldlm/ldlm_pool.c
> index 1f81795..6714c30 100644
> --- a/fs/lustre/ldlm/ldlm_pool.c
> +++ b/fs/lustre/ldlm/ldlm_pool.c
> @@ -360,7 +360,8 @@ static int ldlm_pool_recalc(struct ldlm_pool *pl)
>  	recalc_interval_sec = ktime_get_real_seconds() - pl->pl_recalc_time;
>  	if (recalc_interval_sec > 0) {
>  		spin_lock(&pl->pl_lock);
> -		recalc_interval_sec = ktime_get_real_seconds() - pl->pl_recalc_time;
> +		recalc_interval_sec = ktime_get_real_seconds() -
> +				      pl->pl_recalc_time;
>  
>  		if (recalc_interval_sec > 0) {
>  			/*
> diff --git a/fs/lustre/ldlm/ldlm_request.c b/fs/lustre/ldlm/ldlm_request.c
> index a614d74..b7dcfda 100644
> --- a/fs/lustre/ldlm/ldlm_request.c
> +++ b/fs/lustre/ldlm/ldlm_request.c
> @@ -438,7 +438,7 @@ int ldlm_cli_enqueue_fini(struct obd_export *exp, struct ptlrpc_request *req,
>  			       PLDLMRES(lock->l_resource));
>  
>  			rc = ldlm_lock_change_resource(ns, lock,
> -					&reply->lock_desc.l_resource.lr_name);
> +						       &reply->lock_desc.l_resource.lr_name);
>  			if (rc || !lock->l_resource) {
>  				rc = -ENOMEM;
>  				goto cleanup;
> @@ -450,9 +450,9 @@ int ldlm_cli_enqueue_fini(struct obd_export *exp, struct ptlrpc_request *req,
>  			      !(exp_connect_flags(exp) & OBD_CONNECT_IBITS)))
>  				/* We assume lock type cannot change on server*/
>  				ldlm_convert_policy_to_local(exp,
> -						lock->l_resource->lr_type,
> -						&reply->lock_desc.l_policy_data,
> -						&lock->l_policy_data);
> +							     lock->l_resource->lr_type,
> +							     &reply->lock_desc.l_policy_data,
> +							     &lock->l_policy_data);
>  		if (type != LDLM_PLAIN)
>  			LDLM_DEBUG(lock,
>  				   "client-side enqueue, new policy data");
> @@ -927,8 +927,7 @@ static int ldlm_cli_cancel_req(struct obd_export *exp,
>  		if (rc == LUSTRE_ESTALE) {
>  			CDEBUG(D_DLMTRACE,
>  			       "client/server (nid %s) out of sync -- not fatal\n",
> -			       libcfs_nid2str(req->rq_import->
> -					      imp_connection->c_peer.nid));
> +			       libcfs_nid2str(req->rq_import->imp_connection->c_peer.nid));
>  			rc = 0;
>  		} else if (rc == -ETIMEDOUT && /* check there was no reconnect*/
>  			   req->rq_import_generation == imp->imp_generation) {
> @@ -1290,10 +1289,9 @@ static enum ldlm_policy_res ldlm_cancel_aged_policy(struct ldlm_namespace *ns,
>  		LDLM_POLICY_KEEP_LOCK : LDLM_POLICY_CANCEL_LOCK;
>  }
>  
> -typedef enum ldlm_policy_res (*ldlm_cancel_lru_policy_t)(
> -						      struct ldlm_namespace *,
> -						      struct ldlm_lock *, int,
> -						      int, int);
> +typedef enum ldlm_policy_res (*ldlm_cancel_lru_policy_t)(struct ldlm_namespace *,
> +							 struct ldlm_lock *,
> +							 int, int, int);
>  
>  static ldlm_cancel_lru_policy_t
>  ldlm_cancel_lru_policy(struct ldlm_namespace *ns, int lru_flags)
> -- 
> 1.8.3.1
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20190723/553eb280/attachment-0001.sig>

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [lustre-devel] [PATCH 10/11] lustre: ldlm: checkpatch cleanup
  2019-07-23  2:54   ` NeilBrown
@ 2019-07-24  3:37     ` James Simmons
  2019-07-24  7:23       ` Degremont, Aurelien
  0 siblings, 1 reply; 19+ messages in thread
From: James Simmons @ 2019-07-24  3:37 UTC (permalink / raw)
  To: lustre-devel


> > @@ -286,7 +286,7 @@ static void ldlm_handle_gl_callback(struct ptlrpc_request *req,
> >  				    struct ldlm_request *dlm_req,
> >  				    struct ldlm_lock *lock)
> >  {
> > -	int rc = -ENOSYS;
> > +	int rc = -ENXIO;
> 
> Is this really a checkpatch warning?
> Is it safe?
> Is there a visible behaviour change here, or is the error status only
> used internally?
> 
> There seem to be a few others ... maybe checkpatch doesn't like ENOSYS -
> probably reasonable.
> 
> Everything else looks OK.
> 
> Thanks for these!

From checkpatch - "ENOSYS means 'invalid syscall nr' and nothing else"
So using ENOSYS is no no. We get away with this because people rarely
actually handle each error code individually. Only the MDT coordinator
really looks to see if the errno code is ENOSYS.
 
> NeilBrown
> 
> 
> >  
> >  	LDLM_DEBUG(lock, "client glimpse AST callback handler");
> >  
> > @@ -396,8 +396,10 @@ static int ldlm_bl_to_thread(struct ldlm_namespace *ns,
> >  			     struct list_head *cancels, int count,
> >  			     enum ldlm_cancel_flags cancel_flags)
> >  {
> > +	int rc = 0;
> > +
> >  	if (cancels && count == 0)
> > -		return 0;
> > +		return rc;
> >  
> >  	if (cancel_flags & LCF_ASYNC) {
> >  		struct ldlm_bl_work_item *blwi;
> > @@ -407,7 +409,7 @@ static int ldlm_bl_to_thread(struct ldlm_namespace *ns,
> >  			return -ENOMEM;
> >  		init_blwi(blwi, ns, ld, cancels, count, lock, cancel_flags);
> >  
> > -		return __ldlm_bl_to_thread(blwi, cancel_flags);
> > +		rc = __ldlm_bl_to_thread(blwi, cancel_flags);
> >  	} else {
> >  		/* if it is synchronous call do minimum mem alloc, as it could
> >  		 * be triggered from kernel shrinker
> > @@ -416,8 +418,9 @@ static int ldlm_bl_to_thread(struct ldlm_namespace *ns,
> >  
> >  		memset(&blwi, 0, sizeof(blwi));
> >  		init_blwi(&blwi, ns, ld, cancels, count, lock, cancel_flags);
> > -		return __ldlm_bl_to_thread(&blwi, cancel_flags);
> > +		rc = __ldlm_bl_to_thread(&blwi, cancel_flags);
> >  	}
> > +	return rc;
> >  }
> >  
> >  int ldlm_bl_to_thread_lock(struct ldlm_namespace *ns, struct ldlm_lock_desc *ld,
> > @@ -446,7 +449,7 @@ static int ldlm_handle_setinfo(struct ptlrpc_request *req)
> >  	char *key;
> >  	void *val;
> >  	int keylen, vallen;
> > -	int rc = -ENOSYS;
> > +	int rc = -ENXIO;
> >  
> >  	DEBUG_REQ(D_HSM, req, "%s: handle setinfo\n", obd->obd_name);
> >  
> > @@ -875,6 +878,7 @@ int ldlm_get_ref(void)
> >  void ldlm_put_ref(void)
> >  {
> >  	int rc = 0;
> > +
> >  	mutex_lock(&ldlm_ref_mutex);
> >  	if (ldlm_refcount == 1) {
> >  		rc = ldlm_cleanup();
> > diff --git a/fs/lustre/ldlm/ldlm_pool.c b/fs/lustre/ldlm/ldlm_pool.c
> > index 1f81795..6714c30 100644
> > --- a/fs/lustre/ldlm/ldlm_pool.c
> > +++ b/fs/lustre/ldlm/ldlm_pool.c
> > @@ -360,7 +360,8 @@ static int ldlm_pool_recalc(struct ldlm_pool *pl)
> >  	recalc_interval_sec = ktime_get_real_seconds() - pl->pl_recalc_time;
> >  	if (recalc_interval_sec > 0) {
> >  		spin_lock(&pl->pl_lock);
> > -		recalc_interval_sec = ktime_get_real_seconds() - pl->pl_recalc_time;
> > +		recalc_interval_sec = ktime_get_real_seconds() -
> > +				      pl->pl_recalc_time;
> >  
> >  		if (recalc_interval_sec > 0) {
> >  			/*
> > diff --git a/fs/lustre/ldlm/ldlm_request.c b/fs/lustre/ldlm/ldlm_request.c
> > index a614d74..b7dcfda 100644
> > --- a/fs/lustre/ldlm/ldlm_request.c
> > +++ b/fs/lustre/ldlm/ldlm_request.c
> > @@ -438,7 +438,7 @@ int ldlm_cli_enqueue_fini(struct obd_export *exp, struct ptlrpc_request *req,
> >  			       PLDLMRES(lock->l_resource));
> >  
> >  			rc = ldlm_lock_change_resource(ns, lock,
> > -					&reply->lock_desc.l_resource.lr_name);
> > +						       &reply->lock_desc.l_resource.lr_name);
> >  			if (rc || !lock->l_resource) {
> >  				rc = -ENOMEM;
> >  				goto cleanup;
> > @@ -450,9 +450,9 @@ int ldlm_cli_enqueue_fini(struct obd_export *exp, struct ptlrpc_request *req,
> >  			      !(exp_connect_flags(exp) & OBD_CONNECT_IBITS)))
> >  				/* We assume lock type cannot change on server*/
> >  				ldlm_convert_policy_to_local(exp,
> > -						lock->l_resource->lr_type,
> > -						&reply->lock_desc.l_policy_data,
> > -						&lock->l_policy_data);
> > +							     lock->l_resource->lr_type,
> > +							     &reply->lock_desc.l_policy_data,
> > +							     &lock->l_policy_data);
> >  		if (type != LDLM_PLAIN)
> >  			LDLM_DEBUG(lock,
> >  				   "client-side enqueue, new policy data");
> > @@ -927,8 +927,7 @@ static int ldlm_cli_cancel_req(struct obd_export *exp,
> >  		if (rc == LUSTRE_ESTALE) {
> >  			CDEBUG(D_DLMTRACE,
> >  			       "client/server (nid %s) out of sync -- not fatal\n",
> > -			       libcfs_nid2str(req->rq_import->
> > -					      imp_connection->c_peer.nid));
> > +			       libcfs_nid2str(req->rq_import->imp_connection->c_peer.nid));
> >  			rc = 0;
> >  		} else if (rc == -ETIMEDOUT && /* check there was no reconnect*/
> >  			   req->rq_import_generation == imp->imp_generation) {
> > @@ -1290,10 +1289,9 @@ static enum ldlm_policy_res ldlm_cancel_aged_policy(struct ldlm_namespace *ns,
> >  		LDLM_POLICY_KEEP_LOCK : LDLM_POLICY_CANCEL_LOCK;
> >  }
> >  
> > -typedef enum ldlm_policy_res (*ldlm_cancel_lru_policy_t)(
> > -						      struct ldlm_namespace *,
> > -						      struct ldlm_lock *, int,
> > -						      int, int);
> > +typedef enum ldlm_policy_res (*ldlm_cancel_lru_policy_t)(struct ldlm_namespace *,
> > +							 struct ldlm_lock *,
> > +							 int, int, int);
> >  
> >  static ldlm_cancel_lru_policy_t
> >  ldlm_cancel_lru_policy(struct ldlm_namespace *ns, int lru_flags)
> > -- 
> > 1.8.3.1
> 

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [lustre-devel] [PATCH 10/11] lustre: ldlm: checkpatch cleanup
  2019-07-24  3:37     ` James Simmons
@ 2019-07-24  7:23       ` Degremont, Aurelien
  2019-07-25  1:54         ` James Simmons
  0 siblings, 1 reply; 19+ messages in thread
From: Degremont, Aurelien @ 2019-07-24  7:23 UTC (permalink / raw)
  To: lustre-devel



?Le 24/07/2019 05:38, ? lustre-devel au nom de James Simmons ? <lustre-devel-bounces at lists.lustre.org au nom de jsimmons@infradead.org> a ?crit :
    
    From checkpatch - "ENOSYS means 'invalid syscall nr' and nothing else"
    So using ENOSYS is no no. We get away with this because people rarely
    actually handle each error code individually.
.
    
As a general comment about this, I think we should improve this in the futur. Some people asked me "what's the error code when this or that happens in Lustre?". And I've got no real answer for that.
Indeed people, most of the time, only checks returned code against 0. That does not help when looking at specific Lustre issues.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [lustre-devel] [PATCH 10/11] lustre: ldlm: checkpatch cleanup
  2019-07-24  7:23       ` Degremont, Aurelien
@ 2019-07-25  1:54         ` James Simmons
  2019-07-25  8:07           ` Degremont, Aurelien
  0 siblings, 1 reply; 19+ messages in thread
From: James Simmons @ 2019-07-25  1:54 UTC (permalink / raw)
  To: lustre-devel


> ?Le 24/07/2019 05:38, ? lustre-devel au nom de James Simmons ? <lustre-devel-bounces at lists.lustre.org au nom de jsimmons@infradead.org> a ?crit :
>     
>     From checkpatch - "ENOSYS means 'invalid syscall nr' and nothing else"
>     So using ENOSYS is no no. We get away with this because people rarely
>     actually handle each error code individually.
> .
>     
> As a general comment about this, I think we should improve this in the futur. Some people asked me "what's the error code when this or that happens in Lustre?". And I've got no real answer for that.
> Indeed people, most of the time, only checks returned code against 0. That does not help when looking at specific Lustre issues.

perf probe 'lustre_function%return $retval'

Does the same thing as lctl set_param debug=+trace except dynamic probes 
can work on any kernel function without code modification!!!

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [lustre-devel] [PATCH 10/11] lustre: ldlm: checkpatch cleanup
  2019-07-25  1:54         ` James Simmons
@ 2019-07-25  8:07           ` Degremont, Aurelien
  2019-07-29 19:40             ` James Simmons
  0 siblings, 1 reply; 19+ messages in thread
From: Degremont, Aurelien @ 2019-07-25  8:07 UTC (permalink / raw)
  To: lustre-devel



?Le 25/07/2019 03:54, ? James Simmons ? <jsimmons@infradead.org> a ?crit :

    
    > Le 24/07/2019 05:38, ? lustre-devel au nom de James Simmons ? <lustre-devel-bounces at lists.lustre.org au nom de jsimmons@infradead.org> a ?crit :
    >     
    >     From checkpatch - "ENOSYS means 'invalid syscall nr' and nothing else"
    >     So using ENOSYS is no no. We get away with this because people rarely
    >     actually handle each error code individually.
    > .
    >     
    > As a general comment about this, I think we should improve this in the futur. Some people asked me "what's the error code when this or that happens in Lustre?". And I've got no real answer for that.
    > Indeed people, most of the time, only checks returned code against 0. That does not help when looking at specific Lustre issues.
    
    perf probe 'lustre_function%return $retval'
    
    Does the same thing as lctl set_param debug=+trace except dynamic probes 
    can work on any kernel function without code modification!!!
    
I mean from userspace.
When some applications want to adapt its behaviour depending on what is happening in Lustre. 

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [lustre-devel] [PATCH 10/11] lustre: ldlm: checkpatch cleanup
  2019-07-25  8:07           ` Degremont, Aurelien
@ 2019-07-29 19:40             ` James Simmons
  2019-07-30 16:02               ` Degremont, Aurelien
  0 siblings, 1 reply; 19+ messages in thread
From: James Simmons @ 2019-07-29 19:40 UTC (permalink / raw)
  To: lustre-devel


> ?Le 25/07/2019 03:54, ? James Simmons ? <jsimmons@infradead.org> a ?crit :
> 
>     
>     > Le 24/07/2019 05:38, ? lustre-devel au nom de James Simmons ? <lustre-devel-bounces at lists.lustre.org au nom de jsimmons@infradead.org> a ?crit :
>     >     
>     >     From checkpatch - "ENOSYS means 'invalid syscall nr' and nothing else"
>     >     So using ENOSYS is no no. We get away with this because people rarely
>     >     actually handle each error code individually.
>     > .
>     >     
>     > As a general comment about this, I think we should improve this in the futur. Some people asked me "what's the error code when this or that happens in Lustre?". And I've got no real answer for that.
>     > Indeed people, most of the time, only checks returned code against 0. That does not help when looking at specific Lustre issues.
>     
>     perf probe 'lustre_function%return $retval'
>     
>     Does the same thing as lctl set_param debug=+trace except dynamic probes 
>     can work on any kernel function without code modification!!!
>     
> I mean from userspace.
> When some applications want to adapt its behaviour depending on what is happening in Lustre. 

Ah I see what you mean. Actually I'm working on such a project. See
 
https://jira.whamcloud.com/browse/LU-10756

I also gave a LUG talk about this work this year. Currently you can do 
this with sysfs tunables. So if you do a lctl set_param -P on the MGS
server on the clients an udev event is created. Normally udev rules
are used to managed these changes but you can write applications that
responsed to these changes. You just need to use libudev for this type
of monitoring. This is planned to be expanded to other areas for Lustre
2.14. One is the import state which a early patch exist for:

https://review.whamcloud.com/#/c/31407

For this work the import state change is reported using udev to systemed.
The changes seen in this case cover recovery state, evictions, idle etc.
Bascially any state covered in enum lustre_imp_state from lustre_import.h.

Additionally the sysfs work for LNet will always open new possibilities.
We will be able to use udev events to report the network health state and
well as network timeouts etc.

Those are the areas for 2.14. Any others you can think of ? So this kind
of functionality is being added to Lustre. If Amazon is interested in such
work I can add you as a reviewer :-)

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [lustre-devel] [PATCH 10/11] lustre: ldlm: checkpatch cleanup
  2019-07-29 19:40             ` James Simmons
@ 2019-07-30 16:02               ` Degremont, Aurelien
  0 siblings, 0 replies; 19+ messages in thread
From: Degremont, Aurelien @ 2019-07-30 16:02 UTC (permalink / raw)
  To: lustre-devel

Hi James,

I remember your talk(s) at LUG.
This event-based work is a good thing but I was thinking at even simpler things. Thinking at syscall returned codes.
By example: retcode when mounting a lustre filesystem failed, or retcode when doing I/O or even using lustre CLI tools.
This is much more easier to handle that with a 'case' in your app, checking the retcode instead of deploying a more complex event based system.

Aur?lien

?Le 29/07/2019 21:41, ? James Simmons ? <jsimmons@infradead.org> a ?crit :

    
    > Le 25/07/2019 03:54, ? James Simmons ? <jsimmons@infradead.org> a ?crit :
    > 
    >     
    >     > Le 24/07/2019 05:38, ? lustre-devel au nom de James Simmons ? <lustre-devel-bounces at lists.lustre.org au nom de jsimmons@infradead.org> a ?crit :
    >     >     
    >     >     From checkpatch - "ENOSYS means 'invalid syscall nr' and nothing else"
    >     >     So using ENOSYS is no no. We get away with this because people rarely
    >     >     actually handle each error code individually.
    >     > .
    >     >     
    >     > As a general comment about this, I think we should improve this in the futur. Some people asked me "what's the error code when this or that happens in Lustre?". And I've got no real answer for that.
    >     > Indeed people, most of the time, only checks returned code against 0. That does not help when looking at specific Lustre issues.
    >     
    >     perf probe 'lustre_function%return $retval'
    >     
    >     Does the same thing as lctl set_param debug=+trace except dynamic probes 
    >     can work on any kernel function without code modification!!!
    >     
    > I mean from userspace.
    > When some applications want to adapt its behaviour depending on what is happening in Lustre. 
    
    Ah I see what you mean. Actually I'm working on such a project. See
     
    https://jira.whamcloud.com/browse/LU-10756
    
    I also gave a LUG talk about this work this year. Currently you can do 
    this with sysfs tunables. So if you do a lctl set_param -P on the MGS
    server on the clients an udev event is created. Normally udev rules
    are used to managed these changes but you can write applications that
    responsed to these changes. You just need to use libudev for this type
    of monitoring. This is planned to be expanded to other areas for Lustre
    2.14. One is the import state which a early patch exist for:
    
    https://review.whamcloud.com/#/c/31407
    
    For this work the import state change is reported using udev to systemed.
    The changes seen in this case cover recovery state, evictions, idle etc.
    Bascially any state covered in enum lustre_imp_state from lustre_import.h.
    
    Additionally the sysfs work for LNet will always open new possibilities.
    We will be able to use udev events to report the network health state and
    well as network timeouts etc.
    
    Those are the areas for 2.14. Any others you can think of ? So this kind
    of functionality is being added to Lustre. If Amazon is interested in such
    work I can add you as a reviewer :-)

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2019-07-30 16:02 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-22  1:52 [lustre-devel] [PATCH 00/11] lustre: cleanup most check patch issues James Simmons
2019-07-22  1:52 ` [lustre-devel] [PATCH 01/11] lustre: ptlrpc: checkpatch cleanup James Simmons
2019-07-22  1:52 ` [lustre-devel] [PATCH 02/11] lustre: llite: " James Simmons
2019-07-22  1:52 ` [lustre-devel] [PATCH 03/11] lustre: fid: " James Simmons
2019-07-22  1:52 ` [lustre-devel] [PATCH 04/11] lustre: mgc: " James Simmons
2019-07-22  1:52 ` [lustre-devel] [PATCH 05/11] lustre: lmv: " James Simmons
2019-07-22  1:52 ` [lustre-devel] [PATCH 06/11] lustre: mdc: " James Simmons
2019-07-22  1:52 ` [lustre-devel] [PATCH 07/11] lustre: osc: " James Simmons
2019-07-22  1:52 ` [lustre-devel] [PATCH 08/11] lustre: lov: " James Simmons
2019-07-22  1:52 ` [lustre-devel] [PATCH 09/11] lustre: obdclass: " James Simmons
2019-07-22  1:52 ` [lustre-devel] [PATCH 10/11] lustre: ldlm: " James Simmons
2019-07-23  2:54   ` NeilBrown
2019-07-24  3:37     ` James Simmons
2019-07-24  7:23       ` Degremont, Aurelien
2019-07-25  1:54         ` James Simmons
2019-07-25  8:07           ` Degremont, Aurelien
2019-07-29 19:40             ` James Simmons
2019-07-30 16:02               ` Degremont, Aurelien
2019-07-22  1:52 ` [lustre-devel] [PATCH 11/11] lustre: internal headers " James Simmons

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.