aboutsummaryrefslogtreecommitdiff
path: root/fs/overlayfs/readdir.c
diff options
context:
space:
mode:
authorGravatar Amir Goldstein <amir73il@gmail.com> 2023-05-25 08:40:54 +0300
committerGravatar Amir Goldstein <amir73il@gmail.com> 2023-06-19 14:02:00 +0300
commitdcb399de1e404f48b07ebdcc434ec600568c90eb (patch)
tree1fb3ca8a9f10c926ea744cca2fc5324d2e6abc60 /fs/overlayfs/readdir.c
parentovl: clarify ovl_get_root() semantics (diff)
downloadlinux-dcb399de1e404f48b07ebdcc434ec600568c90eb.tar.gz
linux-dcb399de1e404f48b07ebdcc434ec600568c90eb.tar.bz2
linux-dcb399de1e404f48b07ebdcc434ec600568c90eb.zip
ovl: pass ovl_fs to xino helpers
Internal ovl methods should use ovl_fs and not sb as much as possible. Use a constant_table to translate from enum xino mode to string in preperation for new mount api option parsing. Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Diffstat (limited to 'fs/overlayfs/readdir.c')
-rw-r--r--fs/overlayfs/readdir.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/fs/overlayfs/readdir.c b/fs/overlayfs/readdir.c
index b6952b21a7ee..ee5c4736480f 100644
--- a/fs/overlayfs/readdir.c
+++ b/fs/overlayfs/readdir.c
@@ -118,7 +118,7 @@ static bool ovl_calc_d_ino(struct ovl_readdir_data *rdd,
return false;
/* Always recalc d_ino when remapping lower inode numbers */
- if (ovl_xino_bits(rdd->dentry->d_sb))
+ if (ovl_xino_bits(OVL_FS(rdd->dentry->d_sb)))
return true;
/* Always recalc d_ino for parent */
@@ -460,13 +460,14 @@ static int ovl_cache_update_ino(const struct path *path, struct ovl_cache_entry
{
struct dentry *dir = path->dentry;
+ struct ovl_fs *ofs = OVL_FS(dir->d_sb);
struct dentry *this = NULL;
enum ovl_path_type type;
u64 ino = p->real_ino;
- int xinobits = ovl_xino_bits(dir->d_sb);
+ int xinobits = ovl_xino_bits(ofs);
int err = 0;
- if (!ovl_same_dev(dir->d_sb))
+ if (!ovl_same_dev(ofs))
goto out;
if (p->name[0] == '.') {
@@ -515,7 +516,7 @@ get:
ino = ovl_remap_lower_ino(ino, xinobits,
ovl_layer_lower(this)->fsid,
p->name, p->len,
- ovl_xino_warn(dir->d_sb));
+ ovl_xino_warn(ofs));
}
out:
@@ -694,12 +695,13 @@ static int ovl_iterate_real(struct file *file, struct dir_context *ctx)
int err;
struct ovl_dir_file *od = file->private_data;
struct dentry *dir = file->f_path.dentry;
+ struct ovl_fs *ofs = OVL_FS(dir->d_sb);
const struct ovl_layer *lower_layer = ovl_layer_lower(dir);
struct ovl_readdir_translate rdt = {
.ctx.actor = ovl_fill_real,
.orig_ctx = ctx,
- .xinobits = ovl_xino_bits(dir->d_sb),
- .xinowarn = ovl_xino_warn(dir->d_sb),
+ .xinobits = ovl_xino_bits(ofs),
+ .xinowarn = ovl_xino_warn(ofs),
};
if (rdt.xinobits && lower_layer)
@@ -735,6 +737,7 @@ static int ovl_iterate(struct file *file, struct dir_context *ctx)
{
struct ovl_dir_file *od = file->private_data;
struct dentry *dentry = file->f_path.dentry;
+ struct ovl_fs *ofs = OVL_FS(dentry->d_sb);
struct ovl_cache_entry *p;
const struct cred *old_cred;
int err;
@@ -749,8 +752,8 @@ static int ovl_iterate(struct file *file, struct dir_context *ctx)
* dir is impure then need to adjust d_ino for copied up
* entries.
*/
- if (ovl_xino_bits(dentry->d_sb) ||
- (ovl_same_fs(dentry->d_sb) &&
+ if (ovl_xino_bits(ofs) ||
+ (ovl_same_fs(ofs) &&
(ovl_is_impure_dir(file) ||
OVL_TYPE_MERGE(ovl_path_type(dentry->d_parent))))) {
err = ovl_iterate_real(file, ctx);