mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
vfs: new d_init method
Allow filesystem to initialize dentry at allocation time. Signed-off-by: Miklos Szeredi <[email protected]> Signed-off-by: Al Viro <[email protected]>
This commit is contained in:
parent
17648b871d
commit
285b102d3b
4 changed files with 17 additions and 0 deletions
11
fs/dcache.c
11
fs/dcache.c
|
|
@ -1569,6 +1569,7 @@ struct dentry *__d_alloc(struct super_block *sb, const struct qstr *name)
|
|||
{
|
||||
struct dentry *dentry;
|
||||
char *dname;
|
||||
int err;
|
||||
|
||||
dentry = kmem_cache_alloc(dentry_cache, GFP_KERNEL);
|
||||
if (!dentry)
|
||||
|
|
@ -1627,6 +1628,16 @@ struct dentry *__d_alloc(struct super_block *sb, const struct qstr *name)
|
|||
INIT_LIST_HEAD(&dentry->d_child);
|
||||
d_set_d_op(dentry, dentry->d_sb->s_d_op);
|
||||
|
||||
if (dentry->d_op && dentry->d_op->d_init) {
|
||||
err = dentry->d_op->d_init(dentry);
|
||||
if (err) {
|
||||
if (dname_external(dentry))
|
||||
kfree(external_name(dentry));
|
||||
kmem_cache_free(dentry_cache, dentry);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
this_cpu_inc(nr_dentry);
|
||||
|
||||
return dentry;
|
||||
|
|
|
|||
Loading…
Reference in a new issue