From: green@linuxhacker.ru
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
devel@driverdev.osuosl.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>,
Oleg Drokin <green@linuxhacker.ru>
Subject: [PATCH 26/32] staging/lustre: Remove ns_is_client()
Date: Thu, 1 Oct 2015 00:12:36 -0400 [thread overview]
Message-ID: <1443672762-982936-27-git-send-email-green@linuxhacker.ru> (raw)
In-Reply-To: <1443672762-982936-1-git-send-email-green@linuxhacker.ru>
From: Oleg Drokin <green@linuxhacker.ru>
Since staging tree code is just the client, ns_is_client is always
true, so change all callers as such and drop all the
dead code for when it's false.
Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
---
drivers/staging/lustre/lustre/include/lustre_dlm.h | 13 ----------
drivers/staging/lustre/lustre/ldlm/ldlm_flock.c | 28 +++------------------
drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 5 +---
drivers/staging/lustre/lustre/ldlm/ldlm_request.c | 9 +++----
drivers/staging/lustre/lustre/ldlm/ldlm_resource.c | 29 ++++++++--------------
5 files changed, 17 insertions(+), 67 deletions(-)
diff --git a/drivers/staging/lustre/lustre/include/lustre_dlm.h b/drivers/staging/lustre/lustre/include/lustre_dlm.h
index 360c7f7..1e40203 100644
--- a/drivers/staging/lustre/lustre/include/lustre_dlm.h
+++ b/drivers/staging/lustre/lustre/include/lustre_dlm.h
@@ -465,19 +465,6 @@ struct ldlm_namespace {
};
/**
- * Returns 1 if namespace \a ns is a client namespace.
- */
-static inline int ns_is_client(struct ldlm_namespace *ns)
-{
- LASSERT(ns != NULL);
- LASSERT(!(ns->ns_client & ~(LDLM_NAMESPACE_CLIENT |
- LDLM_NAMESPACE_SERVER)));
- LASSERT(ns->ns_client == LDLM_NAMESPACE_CLIENT ||
- ns->ns_client == LDLM_NAMESPACE_SERVER);
- return ns->ns_client == LDLM_NAMESPACE_CLIENT;
-}
-
-/**
* Returns 1 if namespace \a ns is a server namespace.
*/
static inline int ns_is_server(struct ldlm_namespace *ns)
diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c b/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c
index 14e6782..7241c34 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c
@@ -63,9 +63,6 @@
#include <linux/list.h>
#include "ldlm_internal.h"
-int ldlm_flock_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc,
- void *data, int flag);
-
/**
* list_for_remaining_safe - iterate over the remaining entries in a list
* and safeguard against removal of a list entry.
@@ -254,7 +251,6 @@ ldlm_process_flock_lock(struct ldlm_lock *req, __u64 *flags, int first_enq,
struct ldlm_lock *new = req;
struct ldlm_lock *new2 = NULL;
ldlm_mode_t mode = req->l_req_mode;
- int local = ns_is_client(ns);
int added = (mode == LCK_NL);
int overlaps = 0;
int splitted = 0;
@@ -269,14 +265,9 @@ ldlm_process_flock_lock(struct ldlm_lock *req, __u64 *flags, int first_enq,
*err = ELDLM_OK;
- if (local) {
- /* No blocking ASTs are sent to the clients for
- * Posix file & record locks */
- req->l_blocking_ast = NULL;
- } else {
- /* Called on the server for lock cancels. */
- req->l_blocking_ast = ldlm_flock_blocking_ast;
- }
+ /* No blocking ASTs are sent to the clients for
+ * Posix file & record locks */
+ req->l_blocking_ast = NULL;
reprocess:
if ((*flags == LDLM_FL_WAIT_NOREPROC) || (mode == LCK_NL)) {
@@ -708,19 +699,6 @@ granted:
}
EXPORT_SYMBOL(ldlm_flock_completion_ast);
-int ldlm_flock_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc,
- void *data, int flag)
-{
- LASSERT(lock);
- LASSERT(flag == LDLM_CB_CANCELING);
-
- /* take lock off the deadlock detection hash list. */
- lock_res_and_lock(lock);
- ldlm_flock_blocking_unlink(lock);
- unlock_res_and_lock(lock);
- return 0;
-}
-
void ldlm_flock_policy_wire18_to_local(const ldlm_wire_policy_data_t *wpolicy,
ldlm_policy_data_t *lpolicy)
{
diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c
index e586d33..6d5e7af 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c
@@ -480,8 +480,6 @@ int ldlm_lock_change_resource(struct ldlm_namespace *ns, struct ldlm_lock *lock,
struct ldlm_resource *newres;
int type;
- LASSERT(ns_is_client(ns));
-
lock_res_and_lock(lock);
if (memcmp(new_resid, &lock->l_resource->lr_name,
sizeof(lock->l_resource->lr_name)) == 0) {
@@ -816,8 +814,7 @@ void ldlm_lock_decref_internal(struct ldlm_lock *lock, __u32 mode)
if ((lock->l_flags & LDLM_FL_ATOMIC_CB) ||
ldlm_bl_to_thread_lock(ns, NULL, lock) != 0)
ldlm_handle_bl_callback(ns, NULL, lock);
- } else if (ns_is_client(ns) &&
- !lock->l_readers && !lock->l_writers &&
+ } else if (!lock->l_readers && !lock->l_writers &&
!(lock->l_flags & LDLM_FL_NO_LRU) &&
!(lock->l_flags & LDLM_FL_BL_AST)) {
diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c
index 2d28fc2..04f4144 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c
@@ -266,8 +266,7 @@ noreproc:
spin_unlock(&imp->imp_lock);
}
- if (ns_is_client(ldlm_lock_to_ns(lock)) &&
- OBD_FAIL_CHECK_RESET(OBD_FAIL_LDLM_INTR_CP_AST,
+ if (OBD_FAIL_CHECK_RESET(OBD_FAIL_LDLM_INTR_CP_AST,
OBD_FAIL_LDLM_CP_BL_RACE | OBD_FAIL_ONCE)) {
lock->l_flags |= LDLM_FL_FAIL_LOC;
rc = -EINTR;
@@ -817,10 +816,8 @@ static __u64 ldlm_cli_cancel_local(struct ldlm_lock *lock)
}
ldlm_lock_cancel(lock);
} else {
- if (ns_is_client(ldlm_lock_to_ns(lock))) {
- LDLM_ERROR(lock, "Trying to cancel local lock");
- LBUG();
- }
+ LDLM_ERROR(lock, "Trying to cancel local lock");
+ LBUG();
}
return rc;
diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c
index 9906372..402fe60 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c
@@ -718,11 +718,12 @@ static void cleanup_resource(struct ldlm_resource *res, struct list_head *q,
__u64 flags)
{
struct list_head *tmp;
- int rc = 0, client = ns_is_client(ldlm_res_to_ns(res));
+ int rc = 0;
bool local_only = !!(flags & LDLM_FL_LOCAL_ONLY);
do {
struct ldlm_lock *lock = NULL;
+ struct lustre_handle lockh;
/* First, we look for non-cleaned-yet lock
* all cleaned locks are marked by CLEANED flag. */
@@ -767,20 +768,11 @@ static void cleanup_resource(struct ldlm_resource *res, struct list_head *q,
continue;
}
- if (client) {
- struct lustre_handle lockh;
-
- unlock_res(res);
- ldlm_lock2handle(lock, &lockh);
- rc = ldlm_cli_cancel(&lockh, LCF_ASYNC);
- if (rc)
- CERROR("ldlm_cli_cancel: %d\n", rc);
- } else {
- ldlm_resource_unlink_lock(lock);
- unlock_res(res);
- LDLM_DEBUG(lock, "Freeing a lock still held by a client node");
- ldlm_lock_destroy(lock);
- }
+ unlock_res(res);
+ ldlm_lock2handle(lock, &lockh);
+ rc = ldlm_cli_cancel(&lockh, LCF_ASYNC);
+ if (rc)
+ CERROR("ldlm_cli_cancel: %d\n", rc);
LDLM_LOCK_RELEASE(lock);
} while (1);
}
@@ -1165,7 +1157,7 @@ ldlm_resource_get(struct ldlm_namespace *ns, struct ldlm_resource *parent,
* namespace. If so, and this is a client namespace, we need to move
* the namespace into the active namespaces list to be patrolled by
* the ldlm_poold. */
- if (ns_is_client(ns) && ns_refcount == 1) {
+ if (ns_refcount == 1) {
mutex_lock(ldlm_namespace_lock(LDLM_NAMESPACE_CLIENT));
ldlm_namespace_move_to_active_locked(ns, LDLM_NAMESPACE_CLIENT);
mutex_unlock(ldlm_namespace_lock(LDLM_NAMESPACE_CLIENT));
@@ -1346,9 +1338,8 @@ void ldlm_namespace_dump(int level, struct ldlm_namespace *ns)
if (!((libcfs_debug | D_ERROR) & level))
return;
- CDEBUG(level, "--- Namespace: %s (rc: %d, side: %s)\n",
- ldlm_ns_name(ns), atomic_read(&ns->ns_bref),
- ns_is_client(ns) ? "client" : "server");
+ CDEBUG(level, "--- Namespace: %s (rc: %d, side: client)\n",
+ ldlm_ns_name(ns), atomic_read(&ns->ns_bref));
if (time_before(cfs_time_current(), ns->ns_next_dump))
return;
--
2.1.0
next prev parent reply other threads:[~2015-10-01 4:15 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-01 4:12 [PATCH 00/32] Lustre (mostly locking) unused code removal green
2015-10-01 4:12 ` [PATCH 01/32] staging/lustre/llite: Remove unused ll_get_default/max_cookiesize() green
2015-10-01 4:12 ` [PATCH 02/32] staging/lustre: KEY_DEFAULT/MAX_COOKIESIZE key is unused, remove them green
2015-10-01 4:12 ` [PATCH 03/32] staging/lustre: Remove ununused ll_ra_read_get() green
2015-10-01 4:12 ` [PATCH 04/32] staging/lustre/llite: Remove unused ll_rmdir_entry() green
2015-10-01 4:12 ` [PATCH 05/32] staging/lustre/lov: Remove unused lov_dump_lmm/pool() green
2015-10-01 4:12 ` [PATCH 06/32] staging/lustre/lov: Remove unused lov_lsm_decref() green
2015-10-01 4:12 ` [PATCH 07/32] staging/lustre/ldlm: Remove unused interval tree bits green
2015-10-01 4:12 ` [PATCH 08/32] staging/lustre/ldlm: Remove unused ldlm_cancel_locks_for_exports() green
2015-10-01 4:12 ` [PATCH 09/32] staging/lustre/ldlm: Remove ldlm_init/destroy_export() green
2015-10-01 4:12 ` [PATCH 10/32] staging/lustre/ldlm: Remove unimplemented lock conversion traces green
2015-10-01 4:12 ` [PATCH 11/32] staging/lustre/ldlm: Get rid of lr_converting queue green
2015-10-01 4:12 ` [PATCH 12/32] staging/lustre/ldlm: Remove unused ldlm_cli_enqueue_local() green
2015-10-01 4:12 ` [PATCH 13/32] staging/lustre/ldlm: Remove unused ldlm_init/fini_flock_export green
2015-10-01 4:12 ` [PATCH 14/32] staging/lustre/ldlm: Remove unused ldlm_enqueue_pack() green
2015-10-01 4:12 ` [PATCH 15/32] staging/lustre/ldlm: Remove ldlm_errno2error() green
2015-10-01 4:12 ` [PATCH 16/32] staging/lustre/ldlm: Remove ldlm_glimpse_ast() green
2015-10-01 4:12 ` [PATCH 17/32] staging/lustre/ldlm: Remove ldlm_lock_fail_match() green
2015-10-01 4:12 ` [PATCH 18/32] staging/lustre/ldlm: Remove ldlm_namespace_free() green
2015-10-01 4:12 ` [PATCH 19/32] staging/lustre/ldlm: Remove unused ldlm_pool_get_clv() green
2015-10-01 4:12 ` [PATCH 20/32] staging/lustre/ldlm: Remove unused ldlm_pool_set_slv() green
2015-10-01 4:12 ` [PATCH 21/32] staging/lustre/ldlm: Remove ldlm_refresh/del_waiting_lock() green
2015-10-01 4:12 ` [PATCH 22/32] staging/lustre/ldlm: Remove intent policies handler green
2015-10-01 4:12 ` [PATCH 23/32] staging/lustre/ldlm: Remove unused ldlm_reprocess_all*() green
2015-10-01 4:12 ` [PATCH 24/32] staging/lustre/ldlm: Remove unused ldlm_resource_insert_lock_after() green
2015-10-01 4:12 ` [PATCH 25/32] staging/lustre/ldlm: Remove unused ldlm_blocking_ast/_nocheck() green
2015-10-01 4:12 ` green [this message]
2015-10-01 4:12 ` [PATCH 27/32] staging/lustre: Remove ns_is_server() green
2015-10-01 4:12 ` [PATCH 28/32] staging/lustre/ldlm: Remove server side code from pool support green
2015-10-01 4:12 ` [PATCH 29/32] staging/lustre/ldlm: Remove unused exported symbols green
2015-10-01 4:12 ` [PATCH 30/32] staging/lustre/ldlm: Remove ldlm_namespace_inactive_list() green
2015-10-01 4:12 ` [PATCH 31/32] staging/lustre/ldlm: Remove posix lock (flock) deadlock detection green
2015-10-01 4:12 ` [PATCH 32/32] staging/lustre/ldlm: Make ldlm_add_ast_work_item() static green
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=1443672762-982936-27-git-send-email-green@linuxhacker.ru \
--to=green@linuxhacker.ru \
--cc=andreas.dilger@intel.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lustre-devel@lists.lustre.org \
/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®