void (*lct_fini)(const struct lu_context *ctx,
struct lu_context_key *key, void *data);
/*
+ * Optional method called on lu_context_exit() for all allocated
+ * keys. Can be used by debugging code checking that locks are
+ * released, etc.
+ */
+ void (*lct_exit)(const struct lu_context *ctx,
+ struct lu_context_key *key, void *data);
+ /*
* Internal implementation detail: index within ->lc_value[] reserved
* for this key.
*/
*/
void lu_context_exit(struct lu_context *ctx)
{
+ int i;
+
+ if (ctx->lc_value != NULL) {
+ for (i = 0; i < ARRAY_SIZE(lu_keys); ++i) {
+ if (ctx->lc_value[i] != NULL) {
+ struct lu_context_key *key;
+
+ key = lu_keys[i];
+ LASSERT(key != NULL);
+ if (key->lct_exit != NULL)
+ key->lct_exit(ctx,
+ key, ctx->lc_value[i]);
+ }
+ }
+ }
}
EXPORT_SYMBOL(lu_context_exit);