ovl: move redirect to ovl_inode
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
This commit is contained in:
parent
09d8b58673
commit
cf31c46347
@ -435,7 +435,6 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry,
|
|||||||
|
|
||||||
oe->opaque = upperopaque;
|
oe->opaque = upperopaque;
|
||||||
oe->impure = upperimpure;
|
oe->impure = upperimpure;
|
||||||
oe->redirect = upperredirect;
|
|
||||||
memcpy(oe->lowerstack, stack, sizeof(struct path) * ctr);
|
memcpy(oe->lowerstack, stack, sizeof(struct path) * ctr);
|
||||||
dentry->d_fsdata = oe;
|
dentry->d_fsdata = oe;
|
||||||
|
|
||||||
@ -444,6 +443,8 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry,
|
|||||||
inode = ovl_get_inode(dentry, upperdentry);
|
inode = ovl_get_inode(dentry, upperdentry);
|
||||||
if (!inode)
|
if (!inode)
|
||||||
goto out_free_oe;
|
goto out_free_oe;
|
||||||
|
|
||||||
|
OVL_I(inode)->redirect = upperredirect;
|
||||||
}
|
}
|
||||||
|
|
||||||
revert_creds(old_cred);
|
revert_creds(old_cred);
|
||||||
|
@ -40,7 +40,6 @@ struct ovl_entry {
|
|||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
u64 version;
|
u64 version;
|
||||||
const char *redirect;
|
|
||||||
bool opaque;
|
bool opaque;
|
||||||
bool impure;
|
bool impure;
|
||||||
bool copying;
|
bool copying;
|
||||||
@ -54,6 +53,7 @@ struct ovl_entry {
|
|||||||
struct ovl_entry *ovl_alloc_entry(unsigned int numlower);
|
struct ovl_entry *ovl_alloc_entry(unsigned int numlower);
|
||||||
|
|
||||||
struct ovl_inode {
|
struct ovl_inode {
|
||||||
|
const char *redirect;
|
||||||
struct inode vfs_inode;
|
struct inode vfs_inode;
|
||||||
struct dentry *__upperdentry;
|
struct dentry *__upperdentry;
|
||||||
struct inode *lower;
|
struct inode *lower;
|
||||||
|
@ -41,7 +41,6 @@ static void ovl_dentry_release(struct dentry *dentry)
|
|||||||
if (oe) {
|
if (oe) {
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
kfree(oe->redirect);
|
|
||||||
for (i = 0; i < oe->numlower; i++)
|
for (i = 0; i < oe->numlower; i++)
|
||||||
dput(oe->lowerstack[i].dentry);
|
dput(oe->lowerstack[i].dentry);
|
||||||
kfree_rcu(oe, rcu);
|
kfree_rcu(oe, rcu);
|
||||||
@ -170,6 +169,7 @@ static struct inode *ovl_alloc_inode(struct super_block *sb)
|
|||||||
{
|
{
|
||||||
struct ovl_inode *oi = kmem_cache_alloc(ovl_inode_cachep, GFP_KERNEL);
|
struct ovl_inode *oi = kmem_cache_alloc(ovl_inode_cachep, GFP_KERNEL);
|
||||||
|
|
||||||
|
oi->redirect = NULL;
|
||||||
oi->__upperdentry = NULL;
|
oi->__upperdentry = NULL;
|
||||||
oi->lower = NULL;
|
oi->lower = NULL;
|
||||||
|
|
||||||
@ -188,6 +188,7 @@ static void ovl_destroy_inode(struct inode *inode)
|
|||||||
struct ovl_inode *oi = OVL_I(inode);
|
struct ovl_inode *oi = OVL_I(inode);
|
||||||
|
|
||||||
dput(oi->__upperdentry);
|
dput(oi->__upperdentry);
|
||||||
|
kfree(oi->redirect);
|
||||||
|
|
||||||
call_rcu(&inode->i_rcu, ovl_i_callback);
|
call_rcu(&inode->i_rcu, ovl_i_callback);
|
||||||
}
|
}
|
||||||
|
@ -206,17 +206,15 @@ bool ovl_redirect_dir(struct super_block *sb)
|
|||||||
|
|
||||||
const char *ovl_dentry_get_redirect(struct dentry *dentry)
|
const char *ovl_dentry_get_redirect(struct dentry *dentry)
|
||||||
{
|
{
|
||||||
struct ovl_entry *oe = dentry->d_fsdata;
|
return OVL_I(d_inode(dentry))->redirect;
|
||||||
|
|
||||||
return oe->redirect;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ovl_dentry_set_redirect(struct dentry *dentry, const char *redirect)
|
void ovl_dentry_set_redirect(struct dentry *dentry, const char *redirect)
|
||||||
{
|
{
|
||||||
struct ovl_entry *oe = dentry->d_fsdata;
|
struct ovl_inode *oi = OVL_I(d_inode(dentry));
|
||||||
|
|
||||||
kfree(oe->redirect);
|
kfree(oi->redirect);
|
||||||
oe->redirect = redirect;
|
oi->redirect = redirect;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ovl_inode_init(struct inode *inode, struct dentry *upperdentry,
|
void ovl_inode_init(struct inode *inode, struct dentry *upperdentry,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user