t = d->ld_type;
if (d->ld_obd != NULL) {
- /* finish lprocfs */
- lprocfs_obd_cleanup(d->ld_obd);
d->ld_obd->obd_lu_dev = NULL;
d->ld_obd = NULL;
}
lu_context_key_quiesce(key);
++key_set_version;
- key_fini(&lu_shrink_env.le_ctx, key->lct_index);
-
- if (atomic_read(&key->lct_used) > 1)
- CERROR("key has instances.\n");
spin_lock(&lu_keys_guard);
- lu_keys[key->lct_index] = NULL;
+ key_fini(&lu_shrink_env.le_ctx, key->lct_index);
+ if (lu_keys[key->lct_index]) {
+ lu_keys[key->lct_index] = NULL;
+ lu_ref_fini(&key->lct_reference);
+ }
spin_unlock(&lu_keys_guard);
+
+ LASSERTF(atomic_read(&key->lct_used) == 1, "key has instances: %d\n",
+ atomic_read(&key->lct_used));
}
EXPORT_SYMBOL(lu_context_key_degister);
{
LINVRNT(ctx->lc_state == LCS_ENTERED);
LINVRNT(0 <= key->lct_index && key->lct_index < ARRAY_SIZE(lu_keys));
+ LASSERT(lu_keys[key->lct_index] == key);
return ctx->lc_value[key->lct_index];
}
EXPORT_SYMBOL(lu_context_key_get);
{
int i;
+ spin_lock(&lu_keys_guard);
if (ctx->lc_value != NULL) {
for (i = 0; i < ARRAY_SIZE(lu_keys); ++i)
key_fini(ctx, i);
ARRAY_SIZE(lu_keys) * sizeof ctx->lc_value[0]);
ctx->lc_value = NULL;
}
+ spin_unlock(&lu_keys_guard);
}
static int keys_fill(struct lu_context *ctx)
int remain = nr;
CFS_LIST_HEAD(splice);
- if (nr != 0 && !(gfp_mask & __GFP_FS))
- return -1;
+ if (nr != 0) {
+ if (!(gfp_mask & __GFP_FS))
+ return -1;
+ CDEBUG(D_INODE, "Shrink %d objects\n", nr);
+ }
down(&lu_sites_guard);
list_for_each_entry_safe(s, tmp, &lu_sites, ls_linkage) {
read_lock(&s->ls_guard);
cached += s->ls_total - s->ls_busy;
read_unlock(&s->ls_guard);
- if (remain <= 0)
+ if (nr && remain <= 0)
break;
}
list_splice(&splice, lu_sites.prev);
up(&lu_sites_guard);
+
+ cached = (cached / 100) * sysctl_vfs_cache_pressure;
+ if (nr == 0)
+ CDEBUG(D_INODE, "%d objects cached\n", cached);
return cached;
}
* Debugging printer function using printk().
*/
int lu_printk_printer(const struct lu_env *env,
- void *_, const char *format, ...)
+ void *unused, const char *format, ...)
{
va_list args;
CDEBUG(D_CONSOLE, "Lustre LU module (%p).\n", &lu_keys);
+ result = lu_ref_global_init();
+ if (result != 0)
+ return result;
+
LU_CONTEXT_KEY_INIT(&lu_global_key);
result = lu_context_key_register(&lu_global_key);
if (result != 0)
if (result != 0)
return result;
- result = lu_ref_global_init();
- if (result != 0)
- return result;
/*
* seeks estimation: 3 seeks to read a record from oi, one to read
* inode, one for ea. Unfortunately setting this high value results in
} else {
unsigned char *small_befider;
+ /* as lower 24 bits of FID_SEQ_START are zero, no need to
+ * subtract its value from seq */
+
+ CLASSERT((FID_SEQ_START & 0xffffff) == 0);
+
small_befider = (unsigned char *)befider;
small_befider[0] = seq >> 16;