gfs2: eliminate gfs2_rsqa_alloc in favor of gfs2_qa_alloc

Before this patch, multiple callers called gfs2_rsqa_alloc to force
the existence of a reservations structure and a quota data structure
if needed. However, now the reservations are handled separately, so
the quota data is only the quota data. So we eliminate the one in
favor of just calling gfs2_qa_alloc directly.

Signed-off-by: Bob Peterson <rpeterso@redhat.com>
This commit is contained in:
Bob Peterson 2020-03-06 10:18:44 -06:00
parent 969183bc68
commit d580712a37
8 changed files with 17 additions and 27 deletions

View File

@ -21,6 +21,7 @@
#include "glock.h"
#include "inode.h"
#include "meta_io.h"
#include "quota.h"
#include "rgrp.h"
#include "trans.h"
#include "util.h"
@ -116,7 +117,7 @@ int gfs2_set_acl(struct inode *inode, struct posix_acl *acl, int type)
if (acl && acl->a_count > GFS2_ACL_MAX_ENTRIES(GFS2_SB(inode)))
return -E2BIG;
ret = gfs2_rsqa_alloc(ip);
ret = gfs2_qa_alloc(ip);
if (ret)
return ret;

View File

@ -2183,7 +2183,7 @@ int gfs2_setattr_size(struct inode *inode, u64 newsize)
inode_dio_wait(inode);
ret = gfs2_rsqa_alloc(ip);
ret = gfs2_qa_alloc(ip);
if (ret)
goto out;

View File

@ -458,7 +458,7 @@ static vm_fault_t gfs2_page_mkwrite(struct vm_fault *vmf)
sb_start_pagefault(inode->i_sb);
ret = gfs2_rsqa_alloc(ip);
ret = gfs2_qa_alloc(ip);
if (ret)
goto out;
@ -849,7 +849,7 @@ static ssize_t gfs2_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
struct gfs2_inode *ip = GFS2_I(inode);
ssize_t ret;
ret = gfs2_rsqa_alloc(ip);
ret = gfs2_qa_alloc(ip);
if (ret)
return ret;
@ -1149,7 +1149,7 @@ static long gfs2_fallocate(struct file *file, int mode, loff_t offset, loff_t le
if (mode & FALLOC_FL_PUNCH_HOLE) {
ret = __gfs2_punch_hole(file, offset, len);
} else {
ret = gfs2_rsqa_alloc(ip);
ret = gfs2_qa_alloc(ip);
if (ret)
goto out_putw;
@ -1176,7 +1176,7 @@ static ssize_t gfs2_file_splice_write(struct pipe_inode_info *pipe,
int error;
struct gfs2_inode *ip = GFS2_I(out->f_mapping->host);
error = gfs2_rsqa_alloc(ip);
error = gfs2_qa_alloc(ip);
if (error)
return (ssize_t)error;

View File

@ -588,7 +588,7 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
if (!name->len || name->len > GFS2_FNAMESIZE)
return -ENAMETOOLONG;
error = gfs2_rsqa_alloc(dip);
error = gfs2_qa_alloc(dip);
if (error)
return error;
@ -641,7 +641,7 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
goto fail_gunlock;
ip = GFS2_I(inode);
error = gfs2_rsqa_alloc(ip);
error = gfs2_qa_alloc(ip);
if (error)
goto fail_free_acls;
@ -899,7 +899,7 @@ static int gfs2_link(struct dentry *old_dentry, struct inode *dir,
if (S_ISDIR(inode->i_mode))
return -EPERM;
error = gfs2_rsqa_alloc(dip);
error = gfs2_qa_alloc(dip);
if (error)
return error;
@ -1362,7 +1362,7 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
if (error)
return error;
error = gfs2_rsqa_alloc(ndip);
error = gfs2_qa_alloc(ndip);
if (error)
return error;
@ -1874,7 +1874,7 @@ static int setattr_chown(struct inode *inode, struct iattr *attr)
if (!(attr->ia_valid & ATTR_GID) || gid_eq(ogid, ngid))
ogid = ngid = NO_GID_QUOTA_CHANGE;
error = gfs2_rsqa_alloc(ip);
error = gfs2_qa_alloc(ip);
if (error)
goto out;
@ -1935,7 +1935,7 @@ static int gfs2_setattr(struct dentry *dentry, struct iattr *attr)
struct gfs2_holder i_gh;
int error;
error = gfs2_rsqa_alloc(ip);
error = gfs2_qa_alloc(ip);
if (error)
return error;

View File

@ -567,7 +567,7 @@ int gfs2_quota_hold(struct gfs2_inode *ip, kuid_t uid, kgid_t gid)
return 0;
if (ip->i_qadata == NULL) {
error = gfs2_rsqa_alloc(ip);
error = gfs2_qa_alloc(ip);
if (error)
return error;
}
@ -876,7 +876,7 @@ static int do_sync(unsigned int num_qd, struct gfs2_quota_data **qda)
unsigned int nalloc = 0, blocks;
int error;
error = gfs2_rsqa_alloc(ip);
error = gfs2_qa_alloc(ip);
if (error)
return error;
@ -1677,7 +1677,7 @@ static int gfs2_set_dqblk(struct super_block *sb, struct kqid qid,
if (error)
return error;
error = gfs2_rsqa_alloc(ip);
error = gfs2_qa_alloc(ip);
if (error)
goto out_put;

View File

@ -590,16 +590,6 @@ void gfs2_free_clones(struct gfs2_rgrpd *rgd)
}
}
/**
* gfs2_rsqa_alloc - make sure we have a reservation assigned to the inode
* plus a quota allocations data structure, if necessary
* @ip: the inode for this reservation
*/
int gfs2_rsqa_alloc(struct gfs2_inode *ip)
{
return gfs2_qa_alloc(ip);
}
static void dump_rs(struct seq_file *seq, const struct gfs2_blkreserv *rs,
const char *fs_id_buf)
{

View File

@ -44,7 +44,6 @@ extern void gfs2_inplace_release(struct gfs2_inode *ip);
extern int gfs2_alloc_blocks(struct gfs2_inode *ip, u64 *bn, unsigned int *n,
bool dinode, u64 *generation);
extern int gfs2_rsqa_alloc(struct gfs2_inode *ip);
extern void gfs2_rs_deltree(struct gfs2_blkreserv *rs);
extern void gfs2_rsqa_delete(struct gfs2_inode *ip, atomic_t *wcount);
extern void __gfs2_free_blocks(struct gfs2_inode *ip, struct gfs2_rgrpd *rgd,

View File

@ -1222,7 +1222,7 @@ static int gfs2_xattr_set(const struct xattr_handler *handler,
struct gfs2_holder gh;
int ret;
ret = gfs2_rsqa_alloc(ip);
ret = gfs2_qa_alloc(ip);
if (ret)
return ret;