Commit cf739f84 authored by Oleg Drokin's avatar Oleg Drokin Committed by Greg Kroah-Hartman
Browse files

staging/lustre: Remove ns_is_client()



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: default avatarOleg Drokin <green@linuxhacker.ru>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent f954e778
Loading
Loading
Loading
Loading
+0 −13
Original line number Diff line number Diff line
@@ -464,19 +464,6 @@ struct ldlm_namespace {
	struct completion	ns_kobj_unregister;
};

/**
 * 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.
 */
+3 −25
Original line number Diff line number Diff line
@@ -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;
	}

reprocess:
	if ((*flags == LDLM_FL_WAIT_NOREPROC) || (mode == LCK_NL)) {
@@ -708,19 +699,6 @@ ldlm_flock_completion_ast(struct ldlm_lock *lock, __u64 flags, void *data)
}
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)
{
+1 −4
Original line number Diff line number Diff line
@@ -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)) {

+3 −6
Original line number Diff line number Diff line
@@ -266,8 +266,7 @@ int ldlm_completion_ast(struct ldlm_lock *lock, __u64 flags, void *data)
		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,11 +816,9 @@ 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();
	}
	}

	return rc;
}
+10 −19
Original line number Diff line number Diff line
@@ -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);
		}
		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;