Skip to content

Commit

Permalink
quota: Rename vfs_load_quota_inode() to dquot_load_quota_inode()
Browse files Browse the repository at this point in the history
Rename vfs_load_quota_inode() to dquot_load_quota_inode() to be
consistent with naming of other functions used for enabling quota
accounting from filesystems. Also export the function and add some
sanity checks to assure filesystems are calling the function properly.

Signed-off-by: Jan Kara <[email protected]>
  • Loading branch information
jankara committed Nov 4, 2019
1 parent ae45f07 commit dc19432
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
19 changes: 13 additions & 6 deletions fs/quota/dquot.c
Original file line number Diff line number Diff line change
Expand Up @@ -2351,6 +2351,12 @@ int dquot_load_quota_sb(struct super_block *sb, int type, int format_id,
struct quota_info *dqopt = sb_dqopt(sb);
int error;

/* Just unsuspend quotas? */
BUG_ON(flags & DQUOT_SUSPENDED);
/* s_umount should be held in exclusive mode */
if (WARN_ON_ONCE(down_read_trylock(&sb->s_umount)))
up_read(&sb->s_umount);

if (!fmt)
return -ESRCH;
if (!sb->s_op->quota_write || !sb->s_op->quota_read ||
Expand Down Expand Up @@ -2417,10 +2423,10 @@ int dquot_load_quota_sb(struct super_block *sb, int type, int format_id,
EXPORT_SYMBOL(dquot_load_quota_sb);

/*
* Helper function to turn quotas on when we already have the inode of
* quota file and no quota information is loaded.
* More powerful function for turning on quotas on given quota inode allowing
* setting of individual quota flags
*/
static int vfs_load_quota_inode(struct inode *inode, int type, int format_id,
int dquot_load_quota_inode(struct inode *inode, int type, int format_id,
unsigned int flags)
{
int err;
Expand All @@ -2433,6 +2439,7 @@ static int vfs_load_quota_inode(struct inode *inode, int type, int format_id,
vfs_cleanup_quota_inode(inode->i_sb, type);
return err;
}
EXPORT_SYMBOL(dquot_load_quota_inode);

/* Reenable quotas on remount RW */
int dquot_resume(struct super_block *sb, int type)
Expand Down Expand Up @@ -2479,7 +2486,7 @@ int dquot_quota_on(struct super_block *sb, int type, int format_id,
if (path->dentry->d_sb != sb)
error = -EXDEV;
else
error = vfs_load_quota_inode(d_inode(path->dentry), type,
error = dquot_load_quota_inode(d_inode(path->dentry), type,
format_id, DQUOT_USAGE_ENABLED |
DQUOT_LIMITS_ENABLED);
return error;
Expand Down Expand Up @@ -2517,7 +2524,7 @@ int dquot_enable(struct inode *inode, int type, int format_id,
return 0;
}

return vfs_load_quota_inode(inode, type, format_id, flags);
return dquot_load_quota_inode(inode, type, format_id, flags);
}
EXPORT_SYMBOL(dquot_enable);

Expand All @@ -2542,7 +2549,7 @@ int dquot_quota_on_mount(struct super_block *sb, char *qf_name,

error = security_quota_on(dentry);
if (!error)
error = vfs_load_quota_inode(d_inode(dentry), type, format_id,
error = dquot_load_quota_inode(d_inode(dentry), type, format_id,
DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED);

out:
Expand Down
2 changes: 2 additions & 0 deletions include/linux/quotaops.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ int dquot_enable(struct inode *inode, int type, int format_id,
unsigned int flags);
int dquot_load_quota_sb(struct super_block *sb, int type, int format_id,
unsigned int flags);
int dquot_load_quota_inode(struct inode *inode, int type, int format_id,
unsigned int flags);
int dquot_quota_on(struct super_block *sb, int type, int format_id,
const struct path *path);
int dquot_quota_on_mount(struct super_block *sb, char *qf_name,
Expand Down

0 comments on commit dc19432

Please sign in to comment.