Very simple ones, just to make the further patching simpler. Signed-off-by: Pavel Emelyanov <xemul@xxxxxxxxxx> --- fs/dcache.c | 30 ++++++++++++++++++++++++++++++ include/linux/dcache.h | 7 +++++++ 2 files changed, 37 insertions(+), 0 deletions(-) diff --git a/fs/dcache.c b/fs/dcache.c index 51fb998..bdacea3 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -3006,6 +3006,36 @@ int dcache_new_mob(struct dentry *root) return 0; } +int dcache_set_mob_size(struct dentry *de, unsigned long size) +{ + struct dentry_mob *mob = de->d_mob; + unsigned long usage; + + if (mob == &init_dentry_mob) /* for safety */ + return 0; + + mob->nr_dentry_max = size; + usage = percpu_counter_sum_positive(&mob->nr_dentry); + if (usage > mob->nr_dentry_max) + prune_dcache(mob, usage - mob->nr_dentry_max); + + return 0; +} + +int dcache_get_mob_stat(struct dentry *de, struct dentry_mob_stat __user *stat) +{ + struct dentry_mob *mob = de->d_mob; + struct dentry_mob_stat kstat; + + kstat.nr_dentry = percpu_counter_sum_positive(&mob->nr_dentry); + kstat.nr_dentry_max = mob->nr_dentry_max; + + if (copy_to_user(stat, &kstat, sizeof(kstat))) + return -EFAULT; + + return 0; +} + static __initdata unsigned long dhash_entries; static int __init set_dhash_entries(char *str) { diff --git a/include/linux/dcache.h b/include/linux/dcache.h index 3681307..0d13966 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h @@ -55,7 +55,14 @@ struct dentry_mob { }; struct dentry; +struct dentry_mob_stat { + unsigned long nr_dentry; + unsigned long nr_dentry_max; +}; + int dcache_new_mob(struct dentry *root); +int dcache_set_mob_size(struct dentry *de, unsigned long size); +int dcache_get_mob_stat(struct dentry *de, struct dentry_mob_stat __user *stat); /* * Compare 2 name strings, return 0 if they match, otherwise non-zero. -- 1.5.5.6 -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html