mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.com>
To: Oleg Drokin <oleg.drokin@intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	James Simmons <jsimmons@infradead.org>,
	Andreas Dilger <andreas.dilger@intel.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Lustre Development List <lustre-devel@lists.lustre.org>
Subject: [PATCH 06/30] staging: lustre: remove current_pid() and current_comm()
Date: Mon, 21 May 2018 14:35:12 +1000	[thread overview]
Message-ID: <152687731258.24196.14857062582444612938.stgit@noble> (raw)
In-Reply-To: <152687724799.24196.7718555295926047576.stgit@noble>

Just use current->pid and current->comm directly, instead
of having wrappers.

Signed-off-by: NeilBrown <neilb@suse.com>
---
 .../staging/lustre/include/linux/libcfs/curproc.h  |    4 ----
 drivers/staging/lustre/lnet/libcfs/debug.c         |    2 +-
 drivers/staging/lustre/lustre/ldlm/ldlm_lock.c     |    2 +-
 .../staging/lustre/lustre/llite/llite_internal.h   |    2 +-
 drivers/staging/lustre/lustre/llite/statahead.c    |    6 +++---
 drivers/staging/lustre/lustre/lov/lov_merge.c      |    2 +-
 drivers/staging/lustre/lustre/lov/lov_obd.c        |    6 +++---
 drivers/staging/lustre/lustre/obdclass/class_obd.c |    2 +-
 drivers/staging/lustre/lustre/osc/osc_request.c    |    2 +-
 drivers/staging/lustre/lustre/ptlrpc/client.c      |    8 ++++----
 drivers/staging/lustre/lustre/ptlrpc/service.c     |    6 +++---
 11 files changed, 19 insertions(+), 23 deletions(-)

diff --git a/drivers/staging/lustre/include/linux/libcfs/curproc.h b/drivers/staging/lustre/include/linux/libcfs/curproc.h
index d6e4f47b5daf..83526f84495d 100644
--- a/drivers/staging/lustre/include/linux/libcfs/curproc.h
+++ b/drivers/staging/lustre/include/linux/libcfs/curproc.h
@@ -48,10 +48,6 @@
  * kernel_cap_t
  */
 
-/* check if task is running in compat mode.*/
-#define current_pid()		(current->pid)
-#define current_comm()		(current->comm)
-
 typedef u32 cfs_cap_t;
 
 #define CFS_CAP_FS_MASK (BIT(CAP_CHOWN) |		\
diff --git a/drivers/staging/lustre/lnet/libcfs/debug.c b/drivers/staging/lustre/lnet/libcfs/debug.c
index 5862f0730dd0..724a453a27ac 100644
--- a/drivers/staging/lustre/lnet/libcfs/debug.c
+++ b/drivers/staging/lustre/lnet/libcfs/debug.c
@@ -373,7 +373,7 @@ void libcfs_debug_dumplog(void)
 	add_wait_queue(&debug_ctlwq, &wait);
 
 	dumper = kthread_run(libcfs_debug_dumplog_thread,
-			     (void *)(long)current_pid(),
+			     (void *)(long)current->pid,
 			     "libcfs_debug_dumper");
 	set_current_state(TASK_INTERRUPTIBLE);
 	if (IS_ERR(dumper))
diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c
index 22c49cc593e3..763acd2311a2 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c
@@ -1558,7 +1558,7 @@ struct ldlm_lock *ldlm_lock_create(struct ldlm_namespace *ns,
 
 	lock->l_req_mode = mode;
 	lock->l_ast_data = data;
-	lock->l_pid = current_pid();
+	lock->l_pid = current->pid;
 	if (cbs) {
 		lock->l_blocking_ast = cbs->lcs_blocking;
 		lock->l_completion_ast = cbs->lcs_completion;
diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h b/drivers/staging/lustre/lustre/llite/llite_internal.h
index 6504850e3689..379d88e20cd3 100644
--- a/drivers/staging/lustre/lustre/llite/llite_internal.h
+++ b/drivers/staging/lustre/lustre/llite/llite_internal.h
@@ -1140,7 +1140,7 @@ dentry_may_statahead(struct inode *dir, struct dentry *dentry)
 		return false;
 
 	/* not the same process, don't statahead */
-	if (lli->lli_opendir_pid != current_pid())
+	if (lli->lli_opendir_pid != current->pid)
 		return false;
 
 	/*
diff --git a/drivers/staging/lustre/lustre/llite/statahead.c b/drivers/staging/lustre/lustre/llite/statahead.c
index b4a6ee6c83f3..d864f5f36d85 100644
--- a/drivers/staging/lustre/lustre/llite/statahead.c
+++ b/drivers/staging/lustre/lustre/llite/statahead.c
@@ -1075,7 +1075,7 @@ static int ll_statahead_thread(void *arg)
 			CDEBUG(D_READA, "Statahead for dir " DFID " hit ratio too low: hit/miss %llu/%llu, sent/replied %llu/%llu, stopping statahead thread: pid %d\n",
 			       PFID(&lli->lli_fid), sai->sai_hit,
 			       sai->sai_miss, sai->sai_sent,
-			       sai->sai_replied, current_pid());
+			       sai->sai_replied, current->pid);
 			break;
 		}
 	}
@@ -1147,7 +1147,7 @@ void ll_authorize_statahead(struct inode *dir, void *key)
 		 */
 		LASSERT(!lli->lli_opendir_pid);
 		lli->lli_opendir_key = key;
-		lli->lli_opendir_pid = current_pid();
+		lli->lli_opendir_pid = current->pid;
 		lli->lli_sa_enabled = 1;
 	}
 	spin_unlock(&lli->lli_sa_lock);
@@ -1506,7 +1506,7 @@ static int start_statahead_thread(struct inode *dir, struct dentry *dentry)
 	atomic_inc(&ll_i2sbi(parent->d_inode)->ll_sa_running);
 
 	CDEBUG(D_READA, "start statahead thread: [pid %d] [parent %pd]\n",
-	       current_pid(), parent);
+	       current->pid, parent);
 
 	task = kthread_create(ll_statahead_thread, parent, "ll_sa_%u",
 			      lli->lli_opendir_pid);
diff --git a/drivers/staging/lustre/lustre/lov/lov_merge.c b/drivers/staging/lustre/lustre/lov/lov_merge.c
index 3796bbb25305..3a0f21dc1f8a 100644
--- a/drivers/staging/lustre/lustre/lov/lov_merge.c
+++ b/drivers/staging/lustre/lustre/lov/lov_merge.c
@@ -56,7 +56,7 @@ int lov_merge_lvb_kms(struct lov_stripe_md *lsm,
 	int rc = 0;
 
 	assert_spin_locked(&lsm->lsm_lock);
-	LASSERT(lsm->lsm_lock_owner == current_pid());
+	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",
 	       POSTID(&lsm->lsm_oi), lvb->lvb_size, lvb->lvb_mtime,
diff --git a/drivers/staging/lustre/lustre/lov/lov_obd.c b/drivers/staging/lustre/lustre/lov/lov_obd.c
index d091e03098b5..a5ab0ce38e41 100644
--- a/drivers/staging/lustre/lustre/lov/lov_obd.c
+++ b/drivers/staging/lustre/lustre/lov/lov_obd.c
@@ -1297,16 +1297,16 @@ static int lov_set_info_async(const struct lu_env *env, struct obd_export *exp,
 void lov_stripe_lock(struct lov_stripe_md *md)
 		__acquires(&md->lsm_lock)
 {
-	LASSERT(md->lsm_lock_owner != current_pid());
+	LASSERT(md->lsm_lock_owner != current->pid);
 	spin_lock(&md->lsm_lock);
 	LASSERT(md->lsm_lock_owner == 0);
-	md->lsm_lock_owner = current_pid();
+	md->lsm_lock_owner = current->pid;
 }
 
 void lov_stripe_unlock(struct lov_stripe_md *md)
 		__releases(&md->lsm_lock)
 {
-	LASSERT(md->lsm_lock_owner == current_pid());
+	LASSERT(md->lsm_lock_owner == current->pid);
 	md->lsm_lock_owner = 0;
 	spin_unlock(&md->lsm_lock);
 }
diff --git a/drivers/staging/lustre/lustre/obdclass/class_obd.c b/drivers/staging/lustre/lustre/obdclass/class_obd.c
index 2dd8728760d1..bc5e7f560b71 100644
--- a/drivers/staging/lustre/lustre/obdclass/class_obd.c
+++ b/drivers/staging/lustre/lustre/obdclass/class_obd.c
@@ -100,7 +100,7 @@ int lustre_get_jobid(char *jobid)
 	/* Use process name + fsuid as jobid */
 	if (strcmp(obd_jobid_var, JOBSTATS_PROCNAME_UID) == 0) {
 		snprintf(jobid, LUSTRE_JOBID_SIZE, "%s.%u",
-			 current_comm(),
+			 current->comm,
 			 from_kuid(&init_user_ns, current_fsuid()));
 		return 0;
 	}
diff --git a/drivers/staging/lustre/lustre/osc/osc_request.c b/drivers/staging/lustre/lustre/osc/osc_request.c
index 2c92119b37be..0155294184f1 100644
--- a/drivers/staging/lustre/lustre/osc/osc_request.c
+++ b/drivers/staging/lustre/lustre/osc/osc_request.c
@@ -2296,7 +2296,7 @@ static int osc_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
 		goto out;
 	default:
 		CDEBUG(D_INODE, "unrecognised ioctl %#x by %s\n",
-		       cmd, current_comm());
+		       cmd, current->comm);
 		err = -ENOTTY;
 		goto out;
 	}
diff --git a/drivers/staging/lustre/lustre/ptlrpc/client.c b/drivers/staging/lustre/lustre/ptlrpc/client.c
index a868ff6e720f..dd71eefe8452 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/client.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/client.c
@@ -1552,7 +1552,7 @@ static int ptlrpc_send_new_req(struct ptlrpc_request *req)
 
 	lustre_msg_set_last_xid(req->rq_reqmsg, min_xid);
 
-	lustre_msg_set_status(req->rq_reqmsg, current_pid());
+	lustre_msg_set_status(req->rq_reqmsg, current->pid);
 
 	rc = sptlrpc_req_refresh_ctx(req, -1);
 	if (rc) {
@@ -1567,7 +1567,7 @@ static int ptlrpc_send_new_req(struct ptlrpc_request *req)
 	}
 
 	CDEBUG(D_RPCTRACE, "Sending RPC pname:cluuid:pid:xid:nid:opc %s:%s:%d:%llu:%s:%d\n",
-	       current_comm(),
+	       current->comm,
 	       imp->imp_obd->obd_uuid.uuid,
 	       lustre_msg_get_status(req->rq_reqmsg), req->rq_xid,
 	       libcfs_nid2str(imp->imp_connection->c_peer.nid),
@@ -1978,7 +1978,7 @@ int ptlrpc_check_set(const struct lu_env *env, struct ptlrpc_request_set *set)
 
 		CDEBUG(req->rq_reqmsg ? D_RPCTRACE : 0,
 		       "Completed RPC pname:cluuid:pid:xid:nid:opc %s:%s:%d:%llu:%s:%d\n",
-		       current_comm(), imp->imp_obd->obd_uuid.uuid,
+		       current->comm, imp->imp_obd->obd_uuid.uuid,
 		       lustre_msg_get_status(req->rq_reqmsg), req->rq_xid,
 		       libcfs_nid2str(imp->imp_connection->c_peer.nid),
 		       lustre_msg_get_opc(req->rq_reqmsg));
@@ -2760,7 +2760,7 @@ int ptlrpc_queue_wait(struct ptlrpc_request *req)
 	}
 
 	/* for distributed debugging */
-	lustre_msg_set_status(req->rq_reqmsg, current_pid());
+	lustre_msg_set_status(req->rq_reqmsg, current->pid);
 
 	/* add a ref for the set (see comment in ptlrpc_set_add_req) */
 	ptlrpc_request_addref(req);
diff --git a/drivers/staging/lustre/lustre/ptlrpc/service.c b/drivers/staging/lustre/lustre/ptlrpc/service.c
index 1d28139c950e..f1de9dd551cd 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/service.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/service.c
@@ -1679,7 +1679,7 @@ ptlrpc_server_handle_request(struct ptlrpc_service_part *svcpt,
 	}
 
 	CDEBUG(D_RPCTRACE, "Handling RPC pname:cluuid+ref:pid:xid:nid:opc %s:%s+%d:%d:x%llu:%s:%d\n",
-	       current_comm(),
+	       current->comm,
 	       (request->rq_export ?
 		(char *)request->rq_export->exp_client_uuid.uuid : "0"),
 	       (request->rq_export ?
@@ -1723,7 +1723,7 @@ ptlrpc_server_handle_request(struct ptlrpc_service_part *svcpt,
 	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",
-	       current_comm(),
+	       current->comm,
 	       (request->rq_export ?
 		(char *)request->rq_export->exp_client_uuid.uuid : "0"),
 	       (request->rq_export ?
@@ -2018,7 +2018,7 @@ static int ptlrpc_main(void *arg)
 	struct lu_env *env;
 	int counter = 0, rc = 0;
 
-	thread->t_pid = current_pid();
+	thread->t_pid = current->pid;
 	unshare_fs_struct();
 
 	/* NB: we will call cfs_cpt_bind() for all threads, because we

  reply	other threads:[~2018-05-21  4:38 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-21  4:35 [PATCH 00/30] staging: lustre: tidy up - module init and includes NeilBrown
2018-05-21  4:35 ` NeilBrown [this message]
2018-05-21  4:35 ` [PATCH 02/30] staging: lustre: refactor libcfs initialization NeilBrown
2018-05-21  4:35 ` [PATCH 14/30] staging: lustre: clean up __LIBCFS_H macro NeilBrown
2018-05-21  4:35 ` [PATCH 16/30] staging: lustre: move lnet_debug_log_upcall declaration to tracefile.h NeilBrown
2018-05-21  4:35 ` [PATCH 04/30] staging: lustre: rename cfs_cpt_table to cfs_cpt_tab NeilBrown
2018-05-21  4:35 ` [PATCH 10/30] staging: lustre: discard CFS_TICK NeilBrown
2018-05-21  4:35 ` [PATCH 05/30] staging: lustre: remove conditional compilation from libcfs_cpu.c NeilBrown
2018-05-21  4:35 ` [PATCH 09/30] staging: lustre: discard LOWEST_BIT_SET() NeilBrown
2018-05-21  4:35 ` [PATCH 13/30] staging: lustre: replace libcfs_register_ioctl with a blocking notifier_chain NeilBrown
2018-05-21 16:06   ` [lustre-devel] " Patrick Farrell
2018-05-22 21:06     ` NeilBrown
2018-05-21  4:35 ` [PATCH 03/30] staging: lustre: move files out of lustre/lnet/libcfs/linux/ NeilBrown
2018-05-21  4:35 ` [PATCH 12/30] staging: lustre: discard cfs_block_sigsinv() NeilBrown
2018-05-21  4:35 ` [PATCH 08/30] staging: lustre: discard cfs_cap_t, use kernel_cap_t NeilBrown
2018-05-21  4:35 ` [PATCH 11/30] staging: lustre: move LERRCHKSUM() to libcfs_debug.h NeilBrown
2018-05-21  4:35 ` [PATCH 15/30] staging: lustre: make lnet_debugfs_symlink_def local to libcfs/modules.c NeilBrown
2018-05-21  4:35 ` [PATCH 01/30] staging: lustre: osc: tidy up osc_init() NeilBrown
2018-05-21  4:35 ` [PATCH 07/30] staging: lustre: simplify capability dropping NeilBrown
2018-05-21  4:35 ` [PATCH 24/30] staging: lustre: remove libcfs_all.h from lustre/include/*.h NeilBrown
2018-05-21  4:35 ` [PATCH 30/30] staging: lustre: remove libcfs_all.h NeilBrown
2018-05-21  4:35 ` [PATCH 19/30] staging: lustre: discard libcfs_prim.h NeilBrown
2018-05-21  4:35 ` [PATCH 23/30] staging: lustre: remove libcfs_all.h from includes lustre/lnet NeilBrown
2018-05-21  4:35 ` [PATCH 17/30] staging: lustre: move RESV_PORT definitions to lnet/lib-lnet.h NeilBrown
2018-05-21  4:35 ` [PATCH 22/30] staging: lustre: remove libcfs_all.h includes from lnet/klnd NeilBrown
2018-05-21  4:35 ` [PATCH 20/30] staging: lustre: start moving includes out of libcfs.h NeilBrown
2018-05-21  4:35 ` [PATCH 25/30] staging: lustre: remove libcfs_all.h from remaining .h files NeilBrown
2018-05-21  4:35 ` [PATCH 28/30] staging: lustre: remove remaining libcfs_all.h includes from lustre/lustre NeilBrown
2018-05-21  4:35 ` [PATCH 27/30] staging: lustre: remove libcfs_all.h from fid, fld, obdclass NeilBrown
2018-05-21  4:35 ` [PATCH 26/30] staging: lustre: remove libcfs_all from ptlrpc NeilBrown
2018-05-21  4:35 ` [PATCH 18/30] staging: lustre: replace memory_presure funcitons by standard interfaces NeilBrown
2018-05-21  4:35 ` [PATCH 29/30] staging: lustre: move all libcfs_all includes except in lustre/lnet/libcfs/ NeilBrown
2018-05-21  4:35 ` [PATCH 21/30] staging: lustre: don't include libcfs.h in lnet/lib-lnet.h NeilBrown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=152687731258.24196.14857062582444612938.stgit@noble \
    --to=neilb@suse.com \
    --cc=andreas.dilger@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jsimmons@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lustre-devel@lists.lustre.org \
    --cc=oleg.drokin@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®