From d580712a37272182cb63002878f3bb7bcebbb8bd Mon Sep 17 00:00:00 2001 From: Bob Peterson Date: Fri, 6 Mar 2020 10:18:44 -0600 Subject: 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 --- fs/gfs2/acl.c | 3 ++- fs/gfs2/bmap.c | 2 +- fs/gfs2/file.c | 8 ++++---- fs/gfs2/inode.c | 12 ++++++------ fs/gfs2/quota.c | 6 +++--- fs/gfs2/rgrp.c | 10 ---------- fs/gfs2/rgrp.h | 1 - fs/gfs2/xattr.c | 2 +- 8 files changed, 17 insertions(+), 27 deletions(-) diff --git a/fs/gfs2/acl.c b/fs/gfs2/acl.c index 09e6be8aa036..cb09b85c5b10 100644 --- a/fs/gfs2/acl.c +++ b/fs/gfs2/acl.c @@ -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; diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c index 2fe4457e1d01..4b9dbab50faf 100644 --- a/fs/gfs2/bmap.c +++ b/fs/gfs2/bmap.c @@ -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; diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c index cb26be6f4351..54b0708e6d35 100644 --- a/fs/gfs2/file.c +++ b/fs/gfs2/file.c @@ -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; diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c index b5d04f3a247e..710f1c644f87 100644 --- a/fs/gfs2/inode.c +++ b/fs/gfs2/inode.c @@ -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; diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c index 8290f60f9877..cbe45e8eb2e0 100644 --- a/fs/gfs2/quota.c +++ b/fs/gfs2/quota.c @@ -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; diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c index 2ee2f7d48bc1..3e3696da5bcb 100644 --- a/fs/gfs2/rgrp.c +++ b/fs/gfs2/rgrp.c @@ -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) { diff --git a/fs/gfs2/rgrp.h b/fs/gfs2/rgrp.h index a584f3096418..92cebb785996 100644 --- a/fs/gfs2/rgrp.h +++ b/fs/gfs2/rgrp.h @@ -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, diff --git a/fs/gfs2/xattr.c b/fs/gfs2/xattr.c index bbe593d16bea..c4fbb96e001f 100644 --- a/fs/gfs2/xattr.c +++ b/fs/gfs2/xattr.c @@ -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; -- cgit v1.2.3