Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b54e9a0b authored by Bob Peterson's avatar Bob Peterson
Browse files

GFS2: Extract quota data from reservations structure (revert 5407e242)



This patch basically reverts the majority of patch 5407e242.
That patch eliminated the gfs2_qadata structure in favor of just
using the reservations structure. The problem with doing that is that
it increases the size of the reservations structure. That is not an
issue until it comes time to fold the reservations structure into the
inode in memory so we know it's always there. By separating out the
quota structure again, we aren't punishing the non-quota users by
making all the inodes bigger, requiring more slab space. This patch
creates a new slab area to allocate the quota stuff so it's managed
a little more sanely.

Signed-off-by: default avatarBob Peterson <rpeterso@redhat.com>
parent 39b0555f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -914,7 +914,7 @@ static int gfs2_write_end(struct file *file, struct address_space *mapping,
failed:
	gfs2_trans_end(sdp);
	gfs2_inplace_release(ip);
	if (ip->i_res->rs_qa_qd_num)
	if (ip->i_qadata && ip->i_qadata->qa_qd_num)
		gfs2_quota_unlock(ip);
	if (inode == sdp->sd_rindex) {
		gfs2_glock_dq(&m_ip->i_gh);
+1 −1
Original line number Diff line number Diff line
@@ -1297,7 +1297,7 @@ int gfs2_setattr_size(struct inode *inode, u64 newsize)

	inode_dio_wait(inode);

	ret = gfs2_rs_alloc(ip);
	ret = gfs2_rsqa_alloc(ip);
	if (ret)
		goto out;

+5 −5
Original line number Diff line number Diff line
@@ -401,7 +401,7 @@ static int gfs2_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
	if (ret)
		goto out;

	ret = gfs2_rs_alloc(ip);
	ret = gfs2_rsqa_alloc(ip);
	if (ret)
		goto out_write_access;

@@ -623,7 +623,7 @@ static int gfs2_release(struct inode *inode, struct file *file)
	if (!(file->f_mode & FMODE_WRITE))
		return 0;

	gfs2_rs_delete(ip, &inode->i_writecount);
	gfs2_rsqa_delete(ip, &inode->i_writecount);
	return 0;
}

@@ -703,7 +703,7 @@ static ssize_t gfs2_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
	struct gfs2_inode *ip = GFS2_I(file_inode(file));
	int ret;

	ret = gfs2_rs_alloc(ip);
	ret = gfs2_rsqa_alloc(ip);
	if (ret)
		return ret;

@@ -938,7 +938,7 @@ static long gfs2_fallocate(struct file *file, int mode, loff_t offset, loff_t le
	if (ret)
		goto out_unlock;

	ret = gfs2_rs_alloc(ip);
	ret = gfs2_rsqa_alloc(ip);
	if (ret)
		goto out_putw;

@@ -962,7 +962,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_rs_alloc(ip);
	error = gfs2_rsqa_alloc(ip);
	if (error)
		return (ssize_t)error;

+8 −5
Original line number Diff line number Diff line
@@ -270,6 +270,13 @@ struct gfs2_holder {
/* Number of quota types we support */
#define GFS2_MAXQUOTAS 2

struct gfs2_qadata { /* quota allocation data */
	/* Quota stuff */
	struct gfs2_quota_data *qa_qd[2 * GFS2_MAXQUOTAS];
	struct gfs2_holder qa_qd_ghs[2 * GFS2_MAXQUOTAS];
	unsigned int qa_qd_num;
};

/* Resource group multi-block reservation, in order of appearance:

   Step 1. Function prepares to write, allocates a mb, sets the size hint.
@@ -288,11 +295,6 @@ struct gfs2_blkreserv {
	struct gfs2_rbm rs_rbm;       /* Start of reservation */
	u32 rs_free;                  /* how many blocks are still free */
	u64 rs_inum;                  /* Inode number for reservation */

	/* ancillary quota stuff */
	struct gfs2_quota_data *rs_qa_qd[2 * GFS2_MAXQUOTAS];
	struct gfs2_holder rs_qa_qd_ghs[2 * GFS2_MAXQUOTAS];
	unsigned int rs_qa_qd_num;
};

/*
@@ -391,6 +393,7 @@ struct gfs2_inode {
	struct gfs2_glock *i_gl; /* Move into i_gh? */
	struct gfs2_holder i_iopen_gh;
	struct gfs2_holder i_gh; /* for prepare/commit_write only */
	struct gfs2_qadata *i_qadata; /* quota allocation data */
	struct gfs2_blkreserv *i_res; /* rgrp multi-block reservation */
	struct gfs2_rgrpd *i_rgd;
	u64 i_goal;	/* goal block for allocations */
+9 −9
Original line number Diff line number Diff line
@@ -601,7 +601,7 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
	if (!name->len || name->len > GFS2_FNAMESIZE)
		return -ENAMETOOLONG;

	error = gfs2_rs_alloc(dip);
	error = gfs2_rsqa_alloc(dip);
	if (error)
		return error;

@@ -653,7 +653,7 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
		goto fail_free_vfs_inode;

	ip = GFS2_I(inode);
	error = gfs2_rs_alloc(ip);
	error = gfs2_rsqa_alloc(ip);
	if (error)
		goto fail_free_acls;

@@ -781,7 +781,7 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
fail_free_inode:
	if (ip->i_gl)
		gfs2_glock_put(ip->i_gl);
	gfs2_rs_delete(ip, NULL);
	gfs2_rsqa_delete(ip, NULL);
fail_free_acls:
	if (default_acl)
		posix_acl_release(default_acl);
@@ -903,7 +903,7 @@ static int gfs2_link(struct dentry *old_dentry, struct inode *dir,
	if (S_ISDIR(inode->i_mode))
		return -EPERM;

	error = gfs2_rs_alloc(dip);
	error = gfs2_rsqa_alloc(dip);
	if (error)
		return error;

@@ -1376,7 +1376,7 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
	if (error)
		return error;

	error = gfs2_rs_alloc(ndip);
	error = gfs2_rsqa_alloc(ndip);
	if (error)
		return error;

@@ -1863,7 +1863,7 @@ static int setattr_chown(struct inode *inode, struct iattr *attr)
	if (error)
		return error;

	error = gfs2_rs_alloc(ip);
	error = gfs2_rsqa_alloc(ip);
	if (error)
		goto out;

@@ -1925,7 +1925,7 @@ static int gfs2_setattr(struct dentry *dentry, struct iattr *attr)
	struct gfs2_holder i_gh;
	int error;

	error = gfs2_rs_alloc(ip);
	error = gfs2_rsqa_alloc(ip);
	if (error)
		return error;

@@ -2007,7 +2007,7 @@ static int gfs2_setxattr(struct dentry *dentry, const char *name,
	gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &gh);
	ret = gfs2_glock_nq(&gh);
	if (ret == 0) {
		ret = gfs2_rs_alloc(ip);
		ret = gfs2_rsqa_alloc(ip);
		if (ret == 0)
			ret = generic_setxattr(dentry, name, data, size, flags);
		gfs2_glock_dq(&gh);
@@ -2048,7 +2048,7 @@ static int gfs2_removexattr(struct dentry *dentry, const char *name)
	gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &gh);
	ret = gfs2_glock_nq(&gh);
	if (ret == 0) {
		ret = gfs2_rs_alloc(ip);
		ret = gfs2_rsqa_alloc(ip);
		if (ret == 0)
			ret = generic_removexattr(dentry, name);
		gfs2_glock_dq(&gh);
Loading