forked from Minki/linux
ovl: store layer index in ovl_layer
Store the fs root layer index inside ovl_layer struct, so we can get the root fs layer index from merge dir lower layer instead of find it with ovl_find_layer() helper. Signed-off-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
This commit is contained in:
parent
972d0093c2
commit
d583ed7d13
@ -572,18 +572,6 @@ int ovl_path_next(int idx, struct dentry *dentry, struct path *path)
|
||||
return (idx < oe->numlower) ? idx + 1 : -1;
|
||||
}
|
||||
|
||||
static int ovl_find_layer(struct ovl_fs *ofs, struct ovl_path *path)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ofs->numlower; i++) {
|
||||
if (ofs->lower_layers[i].mnt == path->layer->mnt)
|
||||
break;
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
/* Fix missing 'origin' xattr */
|
||||
static int ovl_fix_origin(struct dentry *dentry, struct dentry *lower,
|
||||
struct dentry *upper)
|
||||
@ -733,11 +721,8 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry,
|
||||
|
||||
if (d.redirect && d.redirect[0] == '/' && poe != roe) {
|
||||
poe = roe;
|
||||
|
||||
/* Find the current layer on the root dentry */
|
||||
i = ovl_find_layer(ofs, &lower);
|
||||
if (WARN_ON(i == ofs->numlower))
|
||||
break;
|
||||
i = lower.layer->idx - 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,8 @@ struct ovl_config {
|
||||
struct ovl_layer {
|
||||
struct vfsmount *mnt;
|
||||
dev_t pseudo_dev;
|
||||
/* Index of this layer in fs root (upper == 0) */
|
||||
int idx;
|
||||
};
|
||||
|
||||
struct ovl_path {
|
||||
|
@ -1106,6 +1106,7 @@ static int ovl_get_lower_layers(struct ovl_fs *ofs, struct path *stack,
|
||||
|
||||
ofs->lower_layers[ofs->numlower].mnt = mnt;
|
||||
ofs->lower_layers[ofs->numlower].pseudo_dev = dev;
|
||||
ofs->lower_layers[ofs->numlower].idx = i + 1;
|
||||
ofs->numlower++;
|
||||
|
||||
/* Check if all lower layers are on same sb */
|
||||
|
Loading…
Reference in New Issue
Block a user