-/* -*- 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) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
+ *
+ * Copyright (c) 2011, 2012, Whamcloud, Inc.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
*/
#define DEBUG_SUBSYSTEM S_CLASS
-#ifndef EXPORT_SYMTAB
-# define EXPORT_SYMTAB
-#endif
#include <libcfs/libcfs.h>
/* class_put_type() */
/** Lock class of cl_object_header::coh_attr_guard */
static cfs_lock_class_key_t cl_attr_guard_class;
+extern __u32 lu_context_tags_default;
+extern __u32 lu_session_tags_default;
/**
* Initialize cl_object_header.
*/
cfs_spin_lock_init(&h->coh_page_guard);
cfs_spin_lock_init(&h->coh_lock_guard);
cfs_spin_lock_init(&h->coh_attr_guard);
- cfs_lockdep_set_class(&h->coh_attr_guard, &cl_page_guard_class);
- cfs_lockdep_set_class(&h->coh_attr_guard, &cl_lock_guard_class);
+ cfs_lockdep_set_class(&h->coh_page_guard, &cl_page_guard_class);
+ cfs_lockdep_set_class(&h->coh_lock_guard, &cl_lock_guard_class);
cfs_lockdep_set_class(&h->coh_attr_guard, &cl_attr_guard_class);
h->coh_pages = 0;
/* XXX hard coded GFP_* mask. */
static unsigned cl_envs_cached_nr = 0;
static unsigned cl_envs_cached_max = 128; /* XXX: prototype: arbitrary limit
* for now. */
-static cfs_spinlock_t cl_envs_guard = CFS_SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(cl_envs_guard);
struct cl_env {
void *ce_magic;
return cle;
}
-static struct lu_env *cl_env_new(__u32 tags, void *debug)
+static struct lu_env *cl_env_new(__u32 ctx_tags, __u32 ses_tags, void *debug)
{
struct lu_env *env;
struct cl_env *cle;
CFS_INIT_LIST_HEAD(&cle->ce_linkage);
cle->ce_magic = &cl_env_init0;
env = &cle->ce_lu;
- rc = lu_env_init(env, LCT_CL_THREAD|tags);
+ rc = lu_env_init(env, LCT_CL_THREAD|ctx_tags);
if (rc == 0) {
- rc = lu_context_init(&cle->ce_ses, LCT_SESSION|tags);
+ rc = lu_context_init(&cle->ce_ses,
+ LCT_SESSION | ses_tags);
if (rc == 0) {
lu_context_enter(&cle->ce_ses);
env->le_ses = &cle->ce_ses;
}
} else {
cfs_spin_unlock(&cl_envs_guard);
- env = cl_env_new(0, debug);
+ env = cl_env_new(lu_context_tags_default,
+ lu_session_tags_default, debug);
}
RETURN(env);
}
struct lu_env *env;
LASSERT(cl_env_peek(refcheck) == NULL);
- env = cl_env_new(tags, __builtin_return_address(0));
+ env = cl_env_new(tags, tags, __builtin_return_address(0));
if (!IS_ERR(env)) {
struct cl_env *cle;