mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 12:28:41 +08:00
ovl: make consistent use of OVL_FS()
Always use OVL_FS() to retrieve the corresponding struct ovl_fs from a struct super_block. Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Andrea Righi <andrea.righi@canonical.com> Signed-off-by: Amir Goldstein <amir73il@gmail.com>
This commit is contained in:
parent
3629554296
commit
f01d08899f
@ -932,7 +932,7 @@ out:
|
|||||||
static bool ovl_need_meta_copy_up(struct dentry *dentry, umode_t mode,
|
static bool ovl_need_meta_copy_up(struct dentry *dentry, umode_t mode,
|
||||||
int flags)
|
int flags)
|
||||||
{
|
{
|
||||||
struct ovl_fs *ofs = dentry->d_sb->s_fs_info;
|
struct ovl_fs *ofs = OVL_FS(dentry->d_sb);
|
||||||
|
|
||||||
if (!ofs->config.metacopy)
|
if (!ofs->config.metacopy)
|
||||||
return false;
|
return false;
|
||||||
|
@ -183,7 +183,7 @@ static int ovl_connect_layer(struct dentry *dentry)
|
|||||||
*/
|
*/
|
||||||
static int ovl_check_encode_origin(struct dentry *dentry)
|
static int ovl_check_encode_origin(struct dentry *dentry)
|
||||||
{
|
{
|
||||||
struct ovl_fs *ofs = dentry->d_sb->s_fs_info;
|
struct ovl_fs *ofs = OVL_FS(dentry->d_sb);
|
||||||
bool decodable = ofs->config.nfs_export;
|
bool decodable = ofs->config.nfs_export;
|
||||||
|
|
||||||
/* Lower file handle for non-upper non-decodable */
|
/* Lower file handle for non-upper non-decodable */
|
||||||
@ -444,7 +444,7 @@ static struct dentry *ovl_lookup_real_inode(struct super_block *sb,
|
|||||||
struct dentry *real,
|
struct dentry *real,
|
||||||
const struct ovl_layer *layer)
|
const struct ovl_layer *layer)
|
||||||
{
|
{
|
||||||
struct ovl_fs *ofs = sb->s_fs_info;
|
struct ovl_fs *ofs = OVL_FS(sb);
|
||||||
struct dentry *index = NULL;
|
struct dentry *index = NULL;
|
||||||
struct dentry *this = NULL;
|
struct dentry *this = NULL;
|
||||||
struct inode *inode;
|
struct inode *inode;
|
||||||
@ -665,7 +665,7 @@ static struct dentry *ovl_get_dentry(struct super_block *sb,
|
|||||||
struct ovl_path *lowerpath,
|
struct ovl_path *lowerpath,
|
||||||
struct dentry *index)
|
struct dentry *index)
|
||||||
{
|
{
|
||||||
struct ovl_fs *ofs = sb->s_fs_info;
|
struct ovl_fs *ofs = OVL_FS(sb);
|
||||||
const struct ovl_layer *layer = upper ? &ofs->layers[0] : lowerpath->layer;
|
const struct ovl_layer *layer = upper ? &ofs->layers[0] : lowerpath->layer;
|
||||||
struct dentry *real = upper ?: (index ?: lowerpath->dentry);
|
struct dentry *real = upper ?: (index ?: lowerpath->dentry);
|
||||||
|
|
||||||
@ -690,7 +690,7 @@ static struct dentry *ovl_get_dentry(struct super_block *sb,
|
|||||||
static struct dentry *ovl_upper_fh_to_d(struct super_block *sb,
|
static struct dentry *ovl_upper_fh_to_d(struct super_block *sb,
|
||||||
struct ovl_fh *fh)
|
struct ovl_fh *fh)
|
||||||
{
|
{
|
||||||
struct ovl_fs *ofs = sb->s_fs_info;
|
struct ovl_fs *ofs = OVL_FS(sb);
|
||||||
struct dentry *dentry;
|
struct dentry *dentry;
|
||||||
struct dentry *upper;
|
struct dentry *upper;
|
||||||
|
|
||||||
@ -710,7 +710,7 @@ static struct dentry *ovl_upper_fh_to_d(struct super_block *sb,
|
|||||||
static struct dentry *ovl_lower_fh_to_d(struct super_block *sb,
|
static struct dentry *ovl_lower_fh_to_d(struct super_block *sb,
|
||||||
struct ovl_fh *fh)
|
struct ovl_fh *fh)
|
||||||
{
|
{
|
||||||
struct ovl_fs *ofs = sb->s_fs_info;
|
struct ovl_fs *ofs = OVL_FS(sb);
|
||||||
struct ovl_path origin = { };
|
struct ovl_path origin = { };
|
||||||
struct ovl_path *stack = &origin;
|
struct ovl_path *stack = &origin;
|
||||||
struct dentry *dentry = NULL;
|
struct dentry *dentry = NULL;
|
||||||
|
@ -341,7 +341,7 @@ static const char *ovl_get_link(struct dentry *dentry,
|
|||||||
|
|
||||||
bool ovl_is_private_xattr(struct super_block *sb, const char *name)
|
bool ovl_is_private_xattr(struct super_block *sb, const char *name)
|
||||||
{
|
{
|
||||||
struct ovl_fs *ofs = sb->s_fs_info;
|
struct ovl_fs *ofs = OVL_FS(sb);
|
||||||
|
|
||||||
if (ofs->config.userxattr)
|
if (ofs->config.userxattr)
|
||||||
return strncmp(name, OVL_XATTR_USER_PREFIX,
|
return strncmp(name, OVL_XATTR_USER_PREFIX,
|
||||||
@ -696,7 +696,7 @@ int ovl_set_acl(struct mnt_idmap *idmap, struct dentry *dentry,
|
|||||||
int ovl_update_time(struct inode *inode, struct timespec64 *ts, int flags)
|
int ovl_update_time(struct inode *inode, struct timespec64 *ts, int flags)
|
||||||
{
|
{
|
||||||
if (flags & S_ATIME) {
|
if (flags & S_ATIME) {
|
||||||
struct ovl_fs *ofs = inode->i_sb->s_fs_info;
|
struct ovl_fs *ofs = OVL_FS(inode->i_sb);
|
||||||
struct path upperpath = {
|
struct path upperpath = {
|
||||||
.mnt = ovl_upper_mnt(ofs),
|
.mnt = ovl_upper_mnt(ofs),
|
||||||
.dentry = ovl_upperdentry_dereference(OVL_I(inode)),
|
.dentry = ovl_upperdentry_dereference(OVL_I(inode)),
|
||||||
@ -1291,7 +1291,7 @@ struct inode *ovl_get_trap_inode(struct super_block *sb, struct dentry *dir)
|
|||||||
static bool ovl_hash_bylower(struct super_block *sb, struct dentry *upper,
|
static bool ovl_hash_bylower(struct super_block *sb, struct dentry *upper,
|
||||||
struct dentry *lower, bool index)
|
struct dentry *lower, bool index)
|
||||||
{
|
{
|
||||||
struct ovl_fs *ofs = sb->s_fs_info;
|
struct ovl_fs *ofs = OVL_FS(sb);
|
||||||
|
|
||||||
/* No, if pure upper */
|
/* No, if pure upper */
|
||||||
if (!lower)
|
if (!lower)
|
||||||
|
@ -892,7 +892,7 @@ static int ovl_fix_origin(struct ovl_fs *ofs, struct dentry *dentry,
|
|||||||
|
|
||||||
static int ovl_maybe_validate_verity(struct dentry *dentry)
|
static int ovl_maybe_validate_verity(struct dentry *dentry)
|
||||||
{
|
{
|
||||||
struct ovl_fs *ofs = dentry->d_sb->s_fs_info;
|
struct ovl_fs *ofs = OVL_FS(dentry->d_sb);
|
||||||
struct inode *inode = d_inode(dentry);
|
struct inode *inode = d_inode(dentry);
|
||||||
struct path datapath, metapath;
|
struct path datapath, metapath;
|
||||||
int err;
|
int err;
|
||||||
@ -1002,7 +1002,7 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry,
|
|||||||
{
|
{
|
||||||
struct ovl_entry *oe = NULL;
|
struct ovl_entry *oe = NULL;
|
||||||
const struct cred *old_cred;
|
const struct cred *old_cred;
|
||||||
struct ovl_fs *ofs = dentry->d_sb->s_fs_info;
|
struct ovl_fs *ofs = OVL_FS(dentry->d_sb);
|
||||||
struct ovl_entry *poe = OVL_E(dentry->d_parent);
|
struct ovl_entry *poe = OVL_E(dentry->d_parent);
|
||||||
struct ovl_entry *roe = OVL_E(dentry->d_sb->s_root);
|
struct ovl_entry *roe = OVL_E(dentry->d_sb->s_root);
|
||||||
struct ovl_path *stack = NULL, *origin_path = NULL;
|
struct ovl_path *stack = NULL, *origin_path = NULL;
|
||||||
|
@ -117,6 +117,8 @@ static inline struct mnt_idmap *ovl_upper_mnt_idmap(struct ovl_fs *ofs)
|
|||||||
return mnt_idmap(ovl_upper_mnt(ofs));
|
return mnt_idmap(ovl_upper_mnt(ofs));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern struct file_system_type ovl_fs_type;
|
||||||
|
|
||||||
static inline struct ovl_fs *OVL_FS(struct super_block *sb)
|
static inline struct ovl_fs *OVL_FS(struct super_block *sb)
|
||||||
{
|
{
|
||||||
return (struct ovl_fs *)sb->s_fs_info;
|
return (struct ovl_fs *)sb->s_fs_info;
|
||||||
|
@ -662,7 +662,7 @@ static void ovl_free(struct fs_context *fc)
|
|||||||
static int ovl_reconfigure(struct fs_context *fc)
|
static int ovl_reconfigure(struct fs_context *fc)
|
||||||
{
|
{
|
||||||
struct super_block *sb = fc->root->d_sb;
|
struct super_block *sb = fc->root->d_sb;
|
||||||
struct ovl_fs *ofs = sb->s_fs_info;
|
struct ovl_fs *ofs = OVL_FS(sb);
|
||||||
struct super_block *upper_sb;
|
struct super_block *upper_sb;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
@ -947,7 +947,7 @@ int ovl_fs_params_verify(const struct ovl_fs_context *ctx,
|
|||||||
int ovl_show_options(struct seq_file *m, struct dentry *dentry)
|
int ovl_show_options(struct seq_file *m, struct dentry *dentry)
|
||||||
{
|
{
|
||||||
struct super_block *sb = dentry->d_sb;
|
struct super_block *sb = dentry->d_sb;
|
||||||
struct ovl_fs *ofs = sb->s_fs_info;
|
struct ovl_fs *ofs = OVL_FS(sb);
|
||||||
size_t nr, nr_merged_lower = ofs->numlayer - ofs->numdatalayer;
|
size_t nr, nr_merged_lower = ofs->numlayer - ofs->numdatalayer;
|
||||||
const struct ovl_layer *data_layers = &ofs->layers[nr_merged_lower];
|
const struct ovl_layer *data_layers = &ofs->layers[nr_merged_lower];
|
||||||
|
|
||||||
|
@ -185,7 +185,7 @@ static void ovl_destroy_inode(struct inode *inode)
|
|||||||
|
|
||||||
static void ovl_put_super(struct super_block *sb)
|
static void ovl_put_super(struct super_block *sb)
|
||||||
{
|
{
|
||||||
struct ovl_fs *ofs = sb->s_fs_info;
|
struct ovl_fs *ofs = OVL_FS(sb);
|
||||||
|
|
||||||
if (ofs)
|
if (ofs)
|
||||||
ovl_free_fs(ofs);
|
ovl_free_fs(ofs);
|
||||||
@ -194,7 +194,7 @@ static void ovl_put_super(struct super_block *sb)
|
|||||||
/* Sync real dirty inodes in upper filesystem (if it exists) */
|
/* Sync real dirty inodes in upper filesystem (if it exists) */
|
||||||
static int ovl_sync_fs(struct super_block *sb, int wait)
|
static int ovl_sync_fs(struct super_block *sb, int wait)
|
||||||
{
|
{
|
||||||
struct ovl_fs *ofs = sb->s_fs_info;
|
struct ovl_fs *ofs = OVL_FS(sb);
|
||||||
struct super_block *upper_sb;
|
struct super_block *upper_sb;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@ -1501,7 +1501,7 @@ out_err:
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct file_system_type ovl_fs_type = {
|
struct file_system_type ovl_fs_type = {
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
.name = "overlay",
|
.name = "overlay",
|
||||||
.init_fs_context = ovl_init_fs_context,
|
.init_fs_context = ovl_init_fs_context,
|
||||||
|
@ -19,25 +19,25 @@
|
|||||||
|
|
||||||
int ovl_want_write(struct dentry *dentry)
|
int ovl_want_write(struct dentry *dentry)
|
||||||
{
|
{
|
||||||
struct ovl_fs *ofs = dentry->d_sb->s_fs_info;
|
struct ovl_fs *ofs = OVL_FS(dentry->d_sb);
|
||||||
return mnt_want_write(ovl_upper_mnt(ofs));
|
return mnt_want_write(ovl_upper_mnt(ofs));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ovl_drop_write(struct dentry *dentry)
|
void ovl_drop_write(struct dentry *dentry)
|
||||||
{
|
{
|
||||||
struct ovl_fs *ofs = dentry->d_sb->s_fs_info;
|
struct ovl_fs *ofs = OVL_FS(dentry->d_sb);
|
||||||
mnt_drop_write(ovl_upper_mnt(ofs));
|
mnt_drop_write(ovl_upper_mnt(ofs));
|
||||||
}
|
}
|
||||||
|
|
||||||
struct dentry *ovl_workdir(struct dentry *dentry)
|
struct dentry *ovl_workdir(struct dentry *dentry)
|
||||||
{
|
{
|
||||||
struct ovl_fs *ofs = dentry->d_sb->s_fs_info;
|
struct ovl_fs *ofs = OVL_FS(dentry->d_sb);
|
||||||
return ofs->workdir;
|
return ofs->workdir;
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct cred *ovl_override_creds(struct super_block *sb)
|
const struct cred *ovl_override_creds(struct super_block *sb)
|
||||||
{
|
{
|
||||||
struct ovl_fs *ofs = sb->s_fs_info;
|
struct ovl_fs *ofs = OVL_FS(sb);
|
||||||
|
|
||||||
return override_creds(ofs->creator_cred);
|
return override_creds(ofs->creator_cred);
|
||||||
}
|
}
|
||||||
@ -63,7 +63,7 @@ int ovl_can_decode_fh(struct super_block *sb)
|
|||||||
|
|
||||||
struct dentry *ovl_indexdir(struct super_block *sb)
|
struct dentry *ovl_indexdir(struct super_block *sb)
|
||||||
{
|
{
|
||||||
struct ovl_fs *ofs = sb->s_fs_info;
|
struct ovl_fs *ofs = OVL_FS(sb);
|
||||||
|
|
||||||
return ofs->indexdir;
|
return ofs->indexdir;
|
||||||
}
|
}
|
||||||
@ -71,7 +71,7 @@ struct dentry *ovl_indexdir(struct super_block *sb)
|
|||||||
/* Index all files on copy up. For now only enabled for NFS export */
|
/* Index all files on copy up. For now only enabled for NFS export */
|
||||||
bool ovl_index_all(struct super_block *sb)
|
bool ovl_index_all(struct super_block *sb)
|
||||||
{
|
{
|
||||||
struct ovl_fs *ofs = sb->s_fs_info;
|
struct ovl_fs *ofs = OVL_FS(sb);
|
||||||
|
|
||||||
return ofs->config.nfs_export && ofs->config.index;
|
return ofs->config.nfs_export && ofs->config.index;
|
||||||
}
|
}
|
||||||
@ -79,7 +79,7 @@ bool ovl_index_all(struct super_block *sb)
|
|||||||
/* Verify lower origin on lookup. For now only enabled for NFS export */
|
/* Verify lower origin on lookup. For now only enabled for NFS export */
|
||||||
bool ovl_verify_lower(struct super_block *sb)
|
bool ovl_verify_lower(struct super_block *sb)
|
||||||
{
|
{
|
||||||
struct ovl_fs *ofs = sb->s_fs_info;
|
struct ovl_fs *ofs = OVL_FS(sb);
|
||||||
|
|
||||||
return ofs->config.nfs_export && ofs->config.index;
|
return ofs->config.nfs_export && ofs->config.index;
|
||||||
}
|
}
|
||||||
@ -204,7 +204,7 @@ enum ovl_path_type ovl_path_type(struct dentry *dentry)
|
|||||||
|
|
||||||
void ovl_path_upper(struct dentry *dentry, struct path *path)
|
void ovl_path_upper(struct dentry *dentry, struct path *path)
|
||||||
{
|
{
|
||||||
struct ovl_fs *ofs = dentry->d_sb->s_fs_info;
|
struct ovl_fs *ofs = OVL_FS(dentry->d_sb);
|
||||||
|
|
||||||
path->mnt = ovl_upper_mnt(ofs);
|
path->mnt = ovl_upper_mnt(ofs);
|
||||||
path->dentry = ovl_dentry_upper(dentry);
|
path->dentry = ovl_dentry_upper(dentry);
|
||||||
|
Loading…
Reference in New Issue
Block a user