From: nikita Date: Sat, 5 Aug 2006 09:02:36 +0000 (+0000) Subject: lu_object: add ->lct_exit() method to lu_context_key X-Git-Tag: v1_8_0_110~486^2~1266 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=57a12e5a489a5656a411948477ee4e6f9b679595;p=fs%2Flustre-release.git lu_object: add ->lct_exit() method to lu_context_key --- diff --git a/lustre/include/lu_object.h b/lustre/include/lu_object.h index 05f41835..530f5c1 100644 --- a/lustre/include/lu_object.h +++ b/lustre/include/lu_object.h @@ -872,6 +872,13 @@ struct lu_context_key { 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. */ diff --git a/lustre/obdclass/lu_object.c b/lustre/obdclass/lu_object.c index 8640cd9..50223cb 100644 --- a/lustre/obdclass/lu_object.c +++ b/lustre/obdclass/lu_object.c @@ -819,6 +819,21 @@ EXPORT_SYMBOL(lu_context_enter); */ 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);