-/* -*- 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.
/*
* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
+ *
+ * Copyright (c) 2012, Whamcloud, Inc.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
* Author: Eric Mei <ericm@clusterfs.com>
*/
-#ifndef EXPORT_SYMTAB
-# define EXPORT_SYMTAB
-#endif
#define DEBUG_SUBSYSTEM S_SEC
#ifndef __KERNEL__
cfs_list_add(&ctx->cc_gc_chain, &sec_gc_ctx_list);
cfs_spin_unlock(&sec_gc_ctx_list_lock);
- sec_gc_thread.t_flags |= SVC_SIGNAL;
+ thread_add_flags(&sec_gc_thread, SVC_SIGNAL);
cfs_waitq_signal(&sec_gc_thread.t_ctl_waitq);
}
EXPORT_SYMBOL(sptlrpc_gc_add_ctx);
LASSERT(sec->ps_policy->sp_cops->gc_ctx);
if (unlikely(sec->ps_gc_next == 0)) {
- CWARN("sec %p(%s) has 0 gc time\n",
+ CDEBUG(D_SEC, "sec %p(%s) has 0 gc time\n",
sec, sec->ps_policy->sp_name);
return;
}
cfs_daemonize_ctxt("sptlrpc_gc");
/* Record that the thread is running */
- thread->t_flags = SVC_RUNNING;
+ thread_set_flags(thread, SVC_RUNNING);
cfs_waitq_signal(&thread->t_ctl_waitq);
while (1) {
struct ptlrpc_sec *sec;
- thread->t_flags &= ~SVC_SIGNAL;
+ thread_clear_flags(thread, SVC_SIGNAL);
sec_process_ctx_list();
again:
/* go through sec list do gc.
/* if someone is waiting to be deleted, let it
* proceed as soon as possible. */
if (cfs_atomic_read(&sec_gc_wait_del)) {
- CWARN("deletion pending, start over\n");
+ CDEBUG(D_SEC, "deletion pending, start over\n");
cfs_mutex_unlock(&sec_gc_mutex);
goto again;
}
lwi = LWI_TIMEOUT(SEC_GC_INTERVAL * CFS_HZ, NULL, NULL);
l_wait_event(thread->t_ctl_waitq,
- thread->t_flags & (SVC_STOPPING | SVC_SIGNAL),
+ thread_is_stopping(thread) ||
+ thread_is_signal(thread),
&lwi);
- if (thread->t_flags & SVC_STOPPING) {
- thread->t_flags &= ~SVC_STOPPING;
+ if (thread_test_and_clear_flags(thread, SVC_STOPPING))
break;
- }
}
- thread->t_flags = SVC_STOPPED;
+ thread_set_flags(thread, SVC_STOPPED);
cfs_waitq_signal(&thread->t_ctl_waitq);
return 0;
}
memset(&sec_gc_thread, 0, sizeof(sec_gc_thread));
cfs_waitq_init(&sec_gc_thread.t_ctl_waitq);
- rc = cfs_kernel_thread(sec_gc_main, &sec_gc_thread,
- CLONE_VM | CLONE_FILES);
+ rc = cfs_create_thread(sec_gc_main, &sec_gc_thread, CFS_DAEMON_FLAGS);
if (rc < 0) {
CERROR("can't start gc thread: %d\n", rc);
return rc;
}
l_wait_event(sec_gc_thread.t_ctl_waitq,
- sec_gc_thread.t_flags & SVC_RUNNING, &lwi);
+ thread_is_running(&sec_gc_thread), &lwi);
return 0;
}
{
struct l_wait_info lwi = { 0 };
- sec_gc_thread.t_flags = SVC_STOPPING;
+ thread_set_flags(&sec_gc_thread, SVC_STOPPING);
cfs_waitq_signal(&sec_gc_thread.t_ctl_waitq);
l_wait_event(sec_gc_thread.t_ctl_waitq,
- sec_gc_thread.t_flags & SVC_STOPPED, &lwi);
+ thread_is_stopped(&sec_gc_thread), &lwi);
}
#else /* !__KERNEL__ */