mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-24 12:44:11 +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,
|
||||
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)
|
||||
return false;
|
||||
|
@ -183,7 +183,7 @@ static int ovl_connect_layer(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;
|
||||
|
||||
/* 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,
|
||||
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 *this = NULL;
|
||||
struct inode *inode;
|
||||
@ -665,7 +665,7 @@ static struct dentry *ovl_get_dentry(struct super_block *sb,
|
||||
struct ovl_path *lowerpath,
|
||||
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;
|
||||
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,
|
||||
struct ovl_fh *fh)
|
||||
{
|
||||
struct ovl_fs *ofs = sb->s_fs_info;
|
||||
struct ovl_fs *ofs = OVL_FS(sb);
|
||||
struct dentry *dentry;
|
||||
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,
|
||||
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 *stack = &origin;
|
||||
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)
|
||||
{
|
||||
struct ovl_fs *ofs = sb->s_fs_info;
|
||||
struct ovl_fs *ofs = OVL_FS(sb);
|
||||
|
||||
if (ofs->config.userxattr)
|
||||
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)
|
||||
{
|
||||
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 = {
|
||||
.mnt = ovl_upper_mnt(ofs),
|
||||
.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,
|
||||
struct dentry *lower, bool index)
|
||||
{
|
||||
struct ovl_fs *ofs = sb->s_fs_info;
|
||||
struct ovl_fs *ofs = OVL_FS(sb);
|
||||
|
||||
/* No, if pure upper */
|
||||
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)
|
||||
{
|
||||
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 path datapath, metapath;
|
||||
int err;
|
||||
@ -1002,7 +1002,7 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry,
|
||||
{
|
||||
struct ovl_entry *oe = NULL;
|
||||
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 *roe = OVL_E(dentry->d_sb->s_root);
|
||||
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));
|
||||
}
|
||||
|
||||
extern struct file_system_type ovl_fs_type;
|
||||
|
||||
static inline struct ovl_fs *OVL_FS(struct super_block *sb)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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;
|
||||
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)
|
||||
{
|
||||
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;
|
||||
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)
|
||||
{
|
||||
struct ovl_fs *ofs = sb->s_fs_info;
|
||||
struct ovl_fs *ofs = OVL_FS(sb);
|
||||
|
||||
if (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) */
|
||||
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;
|
||||
int ret;
|
||||
|
||||
@ -1501,7 +1501,7 @@ out_err:
|
||||
return err;
|
||||
}
|
||||
|
||||
static struct file_system_type ovl_fs_type = {
|
||||
struct file_system_type ovl_fs_type = {
|
||||
.owner = THIS_MODULE,
|
||||
.name = "overlay",
|
||||
.init_fs_context = ovl_init_fs_context,
|
||||
|
@ -19,25 +19,25 @@
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
@ -63,7 +63,7 @@ int ovl_can_decode_fh(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;
|
||||
}
|
||||
@ -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 */
|
||||
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;
|
||||
}
|
||||
@ -79,7 +79,7 @@ bool ovl_index_all(struct super_block *sb)
|
||||
/* Verify lower origin on lookup. For now only enabled for NFS export */
|
||||
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;
|
||||
}
|
||||
@ -204,7 +204,7 @@ enum ovl_path_type ovl_path_type(struct dentry *dentry)
|
||||
|
||||
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->dentry = ovl_dentry_upper(dentry);
|
||||
|
Loading…
Reference in New Issue
Block a user