Whamcloud - gitweb
git://git.whamcloud.com
/
fs
/
lustre-release.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
LU-1303 lod: add lprocfs support to lod
[fs/lustre-release.git]
/
lustre
/
ldlm
/
ldlm_pool.c
diff --git
a/lustre/ldlm/ldlm_pool.c
b/lustre/ldlm/ldlm_pool.c
index
4f5b42d
..
565c6f7
100644
(file)
--- a/
lustre/ldlm/ldlm_pool.c
+++ b/
lustre/ldlm/ldlm_pool.c
@@
-1,6
+1,4
@@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
+/*
* GPL HEADER START
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* GPL HEADER START
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@
-29,8
+27,7
@@
* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
- * Copyright (c) 2011 Whamcloud, Inc.
- *
+ * Copyright (c) 2011, 2012, Whamcloud, Inc.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
*/
/*
* This file is part of Lustre, http://www.lustre.org/
@@
-1098,16
+1095,16
@@
static int ldlm_pools_shrink(ldlm_side_t client, int nr,
for (nr_ns = cfs_atomic_read(ldlm_namespace_nr(client));
nr_ns > 0; nr_ns--)
{
for (nr_ns = cfs_atomic_read(ldlm_namespace_nr(client));
nr_ns > 0; nr_ns--)
{
- cfs_mutex_
down
(ldlm_namespace_lock(client));
+ cfs_mutex_
lock
(ldlm_namespace_lock(client));
if (cfs_list_empty(ldlm_namespace_list(client))) {
if (cfs_list_empty(ldlm_namespace_list(client))) {
- cfs_mutex_u
p
(ldlm_namespace_lock(client));
+ cfs_mutex_u
nlock
(ldlm_namespace_lock(client));
cl_env_reexit(cookie);
return 0;
}
ns = ldlm_namespace_first_locked(client);
ldlm_namespace_get(ns);
ldlm_namespace_move_locked(ns, client);
cl_env_reexit(cookie);
return 0;
}
ns = ldlm_namespace_first_locked(client);
ldlm_namespace_get(ns);
ldlm_namespace_move_locked(ns, client);
- cfs_mutex_u
p
(ldlm_namespace_lock(client));
+ cfs_mutex_u
nlock
(ldlm_namespace_lock(client));
total += ldlm_pool_shrink(&ns->ns_pool, 0, gfp_mask);
ldlm_namespace_put(ns);
}
total += ldlm_pool_shrink(&ns->ns_pool, 0, gfp_mask);
ldlm_namespace_put(ns);
}
@@
-1128,9
+1125,9
@@
static int ldlm_pools_shrink(ldlm_side_t client, int nr,
/*
* Do not call shrink under ldlm_namespace_lock(client)
*/
/*
* Do not call shrink under ldlm_namespace_lock(client)
*/
- cfs_mutex_
down
(ldlm_namespace_lock(client));
+ cfs_mutex_
lock
(ldlm_namespace_lock(client));
if (cfs_list_empty(ldlm_namespace_list(client))) {
if (cfs_list_empty(ldlm_namespace_list(client))) {
- cfs_mutex_u
p
(ldlm_namespace_lock(client));
+ cfs_mutex_u
nlock
(ldlm_namespace_lock(client));
/*
* If list is empty, we can't return any @cached > 0,
* that probably would cause needless shrinker
/*
* If list is empty, we can't return any @cached > 0,
* that probably would cause needless shrinker
@@
-1142,7
+1139,7
@@
static int ldlm_pools_shrink(ldlm_side_t client, int nr,
ns = ldlm_namespace_first_locked(client);
ldlm_namespace_get(ns);
ldlm_namespace_move_locked(ns, client);
ns = ldlm_namespace_first_locked(client);
ldlm_namespace_get(ns);
ldlm_namespace_move_locked(ns, client);
- cfs_mutex_u
p
(ldlm_namespace_lock(client));
+ cfs_mutex_u
nlock
(ldlm_namespace_lock(client));
nr_locks = ldlm_pool_granted(&ns->ns_pool);
cancel = 1 + nr_locks * nr / total;
nr_locks = ldlm_pool_granted(&ns->ns_pool);
cancel = 1 + nr_locks * nr / total;
@@
-1151,7
+1148,9
@@
static int ldlm_pools_shrink(ldlm_side_t client, int nr,
ldlm_namespace_put(ns);
}
cl_env_reexit(cookie);
ldlm_namespace_put(ns);
}
cl_env_reexit(cookie);
- return cached;
+ /* we only decrease the SLV in server pools shrinker, return -1 to
+ * kernel to avoid needless loop. LU-1128 */
+ return (client == LDLM_NAMESPACE_SERVER) ? -1 : cached;
}
static int ldlm_pools_srv_shrink(SHRINKER_ARGS(sc, nr_to_scan, gfp_mask))
}
static int ldlm_pools_srv_shrink(SHRINKER_ARGS(sc, nr_to_scan, gfp_mask))
@@
-1181,7
+1180,7
@@
void ldlm_pools_recalc(ldlm_side_t client)
/*
* Check all modest namespaces first.
*/
/*
* Check all modest namespaces first.
*/
- cfs_mutex_
down
(ldlm_namespace_lock(client));
+ cfs_mutex_
lock
(ldlm_namespace_lock(client));
cfs_list_for_each_entry(ns, ldlm_namespace_list(client),
ns_list_chain)
{
cfs_list_for_each_entry(ns, ldlm_namespace_list(client),
ns_list_chain)
{
@@
-1244,7
+1243,7
@@
void ldlm_pools_recalc(ldlm_side_t client)
}
ldlm_pool_setup(&ns->ns_pool, l);
}
}
ldlm_pool_setup(&ns->ns_pool, l);
}
- cfs_mutex_u
p
(ldlm_namespace_lock(client));
+ cfs_mutex_u
nlock
(ldlm_namespace_lock(client));
}
/*
}
/*
@@
-1259,9
+1258,9
@@
void ldlm_pools_recalc(ldlm_side_t client)
* rid of potential deadlock on client nodes when canceling
* locks synchronously.
*/
* rid of potential deadlock on client nodes when canceling
* locks synchronously.
*/
- cfs_mutex_
down
(ldlm_namespace_lock(client));
+ cfs_mutex_
lock
(ldlm_namespace_lock(client));
if (cfs_list_empty(ldlm_namespace_list(client))) {
if (cfs_list_empty(ldlm_namespace_list(client))) {
- cfs_mutex_u
p
(ldlm_namespace_lock(client));
+ cfs_mutex_u
nlock
(ldlm_namespace_lock(client));
break;
}
ns = ldlm_namespace_first_locked(client);
break;
}
ns = ldlm_namespace_first_locked(client);
@@
-1280,7
+1279,7
@@
void ldlm_pools_recalc(ldlm_side_t client)
cfs_spin_unlock(&ns->ns_lock);
ldlm_namespace_move_locked(ns, client);
cfs_spin_unlock(&ns->ns_lock);
ldlm_namespace_move_locked(ns, client);
- cfs_mutex_u
p
(ldlm_namespace_lock(client));
+ cfs_mutex_u
nlock
(ldlm_namespace_lock(client));
/*
* After setup is done - recalc the pool.
/*
* After setup is done - recalc the pool.
@@
-1300,7
+1299,7
@@
static int ldlm_pools_thread_main(void *arg)
ENTRY;
cfs_daemonize(t_name);
ENTRY;
cfs_daemonize(t_name);
- thread
->t_flags = SVC_RUNNING
;
+ thread
_set_flags(thread, SVC_RUNNING)
;
cfs_waitq_signal(&thread->t_ctl_waitq);
CDEBUG(D_DLMTRACE, "%s: pool thread starting, process %d\n",
cfs_waitq_signal(&thread->t_ctl_waitq);
CDEBUG(D_DLMTRACE, "%s: pool thread starting, process %d\n",
@@
-1321,19
+1320,18
@@
static int ldlm_pools_thread_main(void *arg)
*/
lwi = LWI_TIMEOUT(cfs_time_seconds(LDLM_POOLS_THREAD_PERIOD),
NULL, NULL);
*/
lwi = LWI_TIMEOUT(cfs_time_seconds(LDLM_POOLS_THREAD_PERIOD),
NULL, NULL);
- l_wait_event(thread->t_ctl_waitq, (thread->t_flags &
- (SVC_STOPPING|SVC_EVENT)),
+ l_wait_event(thread->t_ctl_waitq,
+ thread_is_stopping(thread) ||
+ thread_is_event(thread),
&lwi);
&lwi);
- if (thread->t_flags & SVC_STOPPING) {
- thread->t_flags &= ~SVC_STOPPING;
+ if (thread_test_and_clear_flags(thread, SVC_STOPPING))
break;
break;
- } else if (thread->t_flags & SVC_EVENT) {
- thread->t_flags &= ~SVC_EVENT;
- }
+ else
+ thread_test_and_clear_flags(thread, SVC_EVENT);
}
}
- thread
->t_flags = SVC_STOPPED
;
+ thread
_set_flags(thread, SVC_STOPPED)
;
cfs_waitq_signal(&thread->t_ctl_waitq);
CDEBUG(D_DLMTRACE, "%s: pool thread exiting, process %d\n",
cfs_waitq_signal(&thread->t_ctl_waitq);
CDEBUG(D_DLMTRACE, "%s: pool thread exiting, process %d\n",
@@
-1372,7
+1370,7
@@
static int ldlm_pools_thread_start(void)
RETURN(rc);
}
l_wait_event(ldlm_pools_thread->t_ctl_waitq,
RETURN(rc);
}
l_wait_event(ldlm_pools_thread->t_ctl_waitq,
-
(ldlm_pools_thread->t_flags & SVC_RUNNING
), &lwi);
+
thread_is_running(ldlm_pools_thread
), &lwi);
RETURN(0);
}
RETURN(0);
}
@@
-1385,7
+1383,7
@@
static void ldlm_pools_thread_stop(void)
return;
}
return;
}
-
ldlm_pools_thread->t_flags = SVC_STOPPING
;
+
thread_set_flags(ldlm_pools_thread, SVC_STOPPING)
;
cfs_waitq_signal(&ldlm_pools_thread->t_ctl_waitq);
/*
cfs_waitq_signal(&ldlm_pools_thread->t_ctl_waitq);
/*