-/* -*- 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: Lai Siyao <lsy@clusterfs.com>
*/
-#ifndef EXPORT_SYMTAB
-# define EXPORT_SYMTAB
-#endif
#define DEBUG_SUBSYSTEM S_MDS
#include "mdt_internal.h"
int i, rc;
mti = lu_context_key_get(&env->le_ctx, &mdt_thread_key);
- mdt_trans_credit_init(env, mdt, MDT_TXN_CAPA_KEYS_WRITE_OP);
- th = mdt_trans_start(env, mdt);
- if (IS_ERR(th))
- RETURN(PTR_ERR(th));
+ th = dt_trans_create(env, mdt->mdt_bottom);
+ if (IS_ERR(th))
+ RETURN(PTR_ERR(th));
+
+ rc = dt_declare_record_write(env, mdt->mdt_ck_obj,
+ sizeof(*tmp) * 3, 0, th);
+ if (rc)
+ goto stop;
+
+ rc = dt_trans_start_local(env, mdt->mdt_bottom, th);
+ if (rc)
+ goto stop;
tmp = &mti->mti_capa_key;
break;
}
- mdt_trans_stop(env, mdt, th);
+stop:
+ dt_trans_stop(env, mdt->mdt_bottom, th);
CDEBUG(D_INFO, "write capability keys rc = %d:\n", rc);
return rc;
struct ptlrpc_thread *thread = &mdt->mdt_ck_thread;
ENTRY;
- thread->t_flags |= SVC_EVENT;
+ thread_add_flags(thread, SVC_EVENT);
cfs_waitq_signal(&thread->t_ctl_waitq);
EXIT;
}
cfs_daemonize_ctxt("mdt_ck");
cfs_block_allsigs();
- thread->t_flags = SVC_RUNNING;
+ thread_set_flags(thread, SVC_RUNNING);
cfs_waitq_signal(&thread->t_ctl_waitq);
rc = lu_env_init(&env, LCT_MD_THREAD|LCT_REMEMBER|LCT_NOREF);
mdsnum = mdt_md_site(mdt)->ms_node_id;
while (1) {
l_wait_event(thread->t_ctl_waitq,
- thread->t_flags & (SVC_STOPPING | SVC_EVENT),
+ thread_is_stopping(thread) ||
+ thread_is_event(thread),
&lwi);
- if (thread->t_flags & SVC_STOPPING)
+ if (thread_is_stopping(thread))
break;
- thread->t_flags &= ~SVC_EVENT;
+ thread_clear_flags(thread, SVC_EVENT);
if (cfs_time_before(cfs_time_current(), mdt->mdt_ck_expiry))
break;
}
lu_env_fini(&env);
- thread->t_flags = SVC_STOPPED;
+ thread_set_flags(thread, SVC_STOPPED);
cfs_waitq_signal(&thread->t_ctl_waitq);
RETURN(0);
}
return rc;
}
- l_wait_condition(thread->t_ctl_waitq, thread->t_flags & SVC_RUNNING);
+ l_wait_condition(thread->t_ctl_waitq, thread_is_running(thread));
return 0;
}
{
struct ptlrpc_thread *thread = &mdt->mdt_ck_thread;
- if (!(thread->t_flags & SVC_RUNNING))
+ if (!thread_is_running(thread))
return;
- thread->t_flags = SVC_STOPPING;
+ thread_set_flags(thread, SVC_STOPPING);
cfs_waitq_signal(&thread->t_ctl_waitq);
- l_wait_condition(thread->t_ctl_waitq, thread->t_flags & SVC_STOPPED);
+ l_wait_condition(thread->t_ctl_waitq, thread_is_stopped(thread));
}