#include <obd_support.h>
#include <lprocfs_status.h>
-#include <dt_object.h>
#include <md_object.h>
-#include <lustre_req_layout.h>
-#include <lustre_fld.h>
+
#include "fld_internal.h"
#ifdef __KERNEL__
+static void *fld_key_init(const struct lu_context *ctx,
+ struct lu_context_key *key)
+{
+ struct fld_thread_info *info;
+ ENTRY;
+
+ OBD_ALLOC_PTR(info);
+ if (info == NULL)
+ info = ERR_PTR(-ENOMEM);
+ RETURN(info);
+}
+
+static void fld_key_fini(const struct lu_context *ctx,
+ struct lu_context_key *key, void *data)
+{
+ struct fld_thread_info *info = data;
+ ENTRY;
+ OBD_FREE_PTR(info);
+ EXIT;
+}
+
+struct lu_context_key fld_thread_key = {
+ .lct_tags = LCT_MD_THREAD|LCT_DT_THREAD,
+ .lct_init = fld_key_init,
+ .lct_fini = fld_key_fini
+};
+
static int __init fld_mod_init(void)
{
- /* nothing to init seems */
+ lu_context_key_register(&fld_thread_key);
return 0;
}
static void __exit fld_mod_exit(void)
{
- /* nothing to fini seems */
+ lu_context_key_degister(&fld_thread_key);
return;
}
}
-struct fld_thread_info {
- struct req_capsule fti_pill;
- int fti_rep_buf_size[3];
-};
-
static int fld_req_handle0(const struct lu_context *ctx,
struct lu_server_fld *fld,
struct ptlrpc_request *req,
RETURN(rc);
}
-static void *fld_thread_init(const struct lu_context *ctx,
- struct lu_context_key *key)
-{
- struct fld_thread_info *info;
-
- /*
- * check that no high order allocations are incurred.
- */
- CLASSERT(CFS_PAGE_SIZE >= sizeof *info);
- OBD_ALLOC_PTR(info);
- if (info == NULL)
- info = ERR_PTR(-ENOMEM);
- return info;
-}
-
-static void fld_thread_fini(const struct lu_context *ctx,
- struct lu_context_key *key, void *data)
-{
- struct fld_thread_info *info = data;
- OBD_FREE_PTR(info);
-}
-
-struct lu_context_key fld_thread_key = {
- .lct_tags = LCT_MD_THREAD|LCT_DT_THREAD,
- .lct_init = fld_thread_init,
- .lct_fini = fld_thread_fini
-};
-
static void fld_thread_info_init(struct ptlrpc_request *req,
struct fld_thread_info *info)
{
FLD_TXN_INDEX_DELETE_CREDITS = 20,
};
-struct fld_thread_info {
- __u64 fti_key;
- __u64 fti_rec;
-};
-
-static void *fld_key_init(const struct lu_context *ctx,
- struct lu_context_key *key)
-{
- struct fld_thread_info *info;
- ENTRY;
-
- OBD_ALLOC_PTR(info);
- if (info == NULL)
- info = ERR_PTR(-ENOMEM);
- RETURN(info);
-}
-
-static void fld_key_fini(const struct lu_context *ctx,
- struct lu_context_key *key, void *data)
-{
- struct fld_thread_info *info = data;
- ENTRY;
- OBD_FREE_PTR(info);
- EXIT;
-}
-
-static int fld_key_registered = 0;
-
-static struct lu_context_key fld_thread_key = {
- .lct_tags = LCT_MD_THREAD|LCT_DT_THREAD,
- .lct_init = fld_key_init,
- .lct_fini = fld_key_fini
-};
+extern struct lu_context_key fld_thread_key;
static struct dt_key *fld_key(const struct lu_context *ctx,
const seqno_t seq)
int rc;
ENTRY;
- if (fld_key_registered == 0) {
- rc = lu_context_key_register(&fld_thread_key);
- if (rc != 0)
- RETURN(rc);
- }
- fld_key_registered++;
-
/*
* lu_context_key has to be registered before threads are started,
* check this.
lu_object_put(ctx, &fld->fld_obj->do_lu);
fld->fld_obj = NULL;
}
- if (fld_key_registered > 0) {
- if (--fld_key_registered == 0)
- lu_context_key_degister(&fld_thread_key);
- }
EXIT;
}