diff options
author | Amir Goldstein <amir73il@gmail.com> | 2018-03-28 19:22:41 +0200 |
---|---|---|
committer | Miklos Szeredi <mszeredi@redhat.com> | 2018-04-12 12:04:50 +0200 |
commit | 5148626b806a74dd219f2bce5f204abf909f6930 (patch) | |
tree | 6798d7117b093018188fe50c112f4dccaba7fd8c /fs/overlayfs/util.c | |
parent | ovl: factor out ovl_map_dev_ino() helper (diff) | |
download | linux-5148626b806a74dd219f2bce5f204abf909f6930.tar.xz linux-5148626b806a74dd219f2bce5f204abf909f6930.zip |
ovl: allocate anon bdev per unique lower fs
Instead of allocating an anonymous bdev per lower layer, allocate
one anonymous bdev per every unique lower fs that is different than
upper fs.
Every unique lower fs is assigned an fsid > 0 and the number of
unique lower fs are stored in ofs->numlowerfs.
The assigned fsid is stored in the lower layer struct and will be
used also for inode number multiplexing.
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Diffstat (limited to 'fs/overlayfs/util.c')
-rw-r--r-- | fs/overlayfs/util.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/fs/overlayfs/util.c b/fs/overlayfs/util.c index 5042293d2078..9dfec74ec77d 100644 --- a/fs/overlayfs/util.c +++ b/fs/overlayfs/util.c @@ -47,7 +47,12 @@ struct super_block *ovl_same_sb(struct super_block *sb) { struct ovl_fs *ofs = sb->s_fs_info; - return ofs->same_sb; + if (!ofs->numlowerfs) + return ofs->upper_mnt->mnt_sb; + else if (ofs->numlowerfs == 1 && !ofs->upper_mnt) + return ofs->lower_fs[0].sb; + else + return NULL; } bool ovl_can_decode_fh(struct super_block *sb) |