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

Commit 92f8ff73 authored by Chandra Seetharaman's avatar Chandra Seetharaman Committed by Ben Myers
Browse files

xfs: Add pquota fields where gquota is used.



Add project quota changes to all the places where group quota field
is used:
   * add separate project quota members into various structures
   * split project quota and group quotas so that instead of overriding
     the group quota members incore, the new project quota members are
     used instead
   * get rid of usage of the OQUOTA flag incore, in favor of separate
     group and project quota flags.
   * add a project dquot argument to various functions.

Not using the pquotino field from superblock yet.

Signed-off-by: default avatarChandra Seetharaman <sekharan@us.ibm.com>
Reviewed-by: default avatarBen Myers <bpm@sgi.com>
Signed-off-by: default avatarBen Myers <bpm@sgi.com>
parent 42c49d7f
Loading
Loading
Loading
Loading
+12 −3
Original line number Original line Diff line number Diff line
@@ -936,6 +936,7 @@ xfs_qm_dqput_final(
{
{
	struct xfs_quotainfo	*qi = dqp->q_mount->m_quotainfo;
	struct xfs_quotainfo	*qi = dqp->q_mount->m_quotainfo;
	struct xfs_dquot	*gdqp;
	struct xfs_dquot	*gdqp;
	struct xfs_dquot	*pdqp;


	trace_xfs_dqput_free(dqp);
	trace_xfs_dqput_free(dqp);


@@ -949,21 +950,29 @@ xfs_qm_dqput_final(


	/*
	/*
	 * If we just added a udquot to the freelist, then we want to release
	 * If we just added a udquot to the freelist, then we want to release
	 * the gdquot reference that it (probably) has. Otherwise it'll keep
	 * the gdquot/pdquot reference that it (probably) has. Otherwise it'll
	 * the gdquot from getting reclaimed.
	 * keep the gdquot/pdquot from getting reclaimed.
	 */
	 */
	gdqp = dqp->q_gdquot;
	gdqp = dqp->q_gdquot;
	if (gdqp) {
	if (gdqp) {
		xfs_dqlock(gdqp);
		xfs_dqlock(gdqp);
		dqp->q_gdquot = NULL;
		dqp->q_gdquot = NULL;
	}
	}

	pdqp = dqp->q_pdquot;
	if (pdqp) {
		xfs_dqlock(pdqp);
		dqp->q_pdquot = NULL;
	}
	xfs_dqunlock(dqp);
	xfs_dqunlock(dqp);


	/*
	/*
	 * If we had a group quota hint, release it now.
	 * If we had a group/project quota hint, release it now.
	 */
	 */
	if (gdqp)
	if (gdqp)
		xfs_qm_dqput(gdqp);
		xfs_qm_dqput(gdqp);
	if (pdqp)
		xfs_qm_dqput(pdqp);
}
}


/*
/*
+5 −2
Original line number Original line Diff line number Diff line
@@ -53,6 +53,7 @@ typedef struct xfs_dquot {
	xfs_fileoff_t	 q_fileoffset;	/* offset in quotas file */
	xfs_fileoff_t	 q_fileoffset;	/* offset in quotas file */


	struct xfs_dquot*q_gdquot;	/* group dquot, hint only */
	struct xfs_dquot*q_gdquot;	/* group dquot, hint only */
	struct xfs_dquot*q_pdquot;	/* project dquot, hint only */
	xfs_disk_dquot_t q_core;	/* actual usage & quotas */
	xfs_disk_dquot_t q_core;	/* actual usage & quotas */
	xfs_dq_logitem_t q_logitem;	/* dquot log item */
	xfs_dq_logitem_t q_logitem;	/* dquot log item */
	xfs_qcnt_t	 q_res_bcount;	/* total regular nblks used+reserved */
	xfs_qcnt_t	 q_res_bcount;	/* total regular nblks used+reserved */
@@ -118,8 +119,9 @@ static inline int xfs_this_quota_on(struct xfs_mount *mp, int type)
	case XFS_DQ_USER:
	case XFS_DQ_USER:
		return XFS_IS_UQUOTA_ON(mp);
		return XFS_IS_UQUOTA_ON(mp);
	case XFS_DQ_GROUP:
	case XFS_DQ_GROUP:
		return XFS_IS_GQUOTA_ON(mp);
	case XFS_DQ_PROJ:
	case XFS_DQ_PROJ:
		return XFS_IS_OQUOTA_ON(mp);
		return XFS_IS_PQUOTA_ON(mp);
	default:
	default:
		return 0;
		return 0;
	}
	}
@@ -131,8 +133,9 @@ static inline xfs_dquot_t *xfs_inode_dquot(struct xfs_inode *ip, int type)
	case XFS_DQ_USER:
	case XFS_DQ_USER:
		return ip->i_udquot;
		return ip->i_udquot;
	case XFS_DQ_GROUP:
	case XFS_DQ_GROUP:
	case XFS_DQ_PROJ:
		return ip->i_gdquot;
		return ip->i_gdquot;
	case XFS_DQ_PROJ:
		return ip->i_pdquot;
	default:
	default:
		return NULL;
		return NULL;
	}
	}
+1 −0
Original line number Original line Diff line number Diff line
@@ -337,6 +337,7 @@ xfs_iget_cache_miss(
		iflags |= XFS_IDONTCACHE;
		iflags |= XFS_IDONTCACHE;
	ip->i_udquot = NULL;
	ip->i_udquot = NULL;
	ip->i_gdquot = NULL;
	ip->i_gdquot = NULL;
	ip->i_pdquot = NULL;
	xfs_iflags_set(ip, iflags);
	xfs_iflags_set(ip, iflags);


	/* insert the new inode */
	/* insert the new inode */
+1 −0
Original line number Original line Diff line number Diff line
@@ -250,6 +250,7 @@ typedef struct xfs_inode {
	struct xfs_mount	*i_mount;	/* fs mount struct ptr */
	struct xfs_mount	*i_mount;	/* fs mount struct ptr */
	struct xfs_dquot	*i_udquot;	/* user dquot */
	struct xfs_dquot	*i_udquot;	/* user dquot */
	struct xfs_dquot	*i_gdquot;	/* group dquot */
	struct xfs_dquot	*i_gdquot;	/* group dquot */
	struct xfs_dquot	*i_pdquot;	/* project dquot */


	/* Inode location stuff */
	/* Inode location stuff */
	xfs_ino_t		i_ino;		/* inode number (agno/agino)*/
	xfs_ino_t		i_ino;		/* inode number (agno/agino)*/
+7 −7
Original line number Original line Diff line number Diff line
@@ -928,7 +928,7 @@ xfs_ioctl_setattr(
	struct xfs_trans	*tp;
	struct xfs_trans	*tp;
	unsigned int		lock_flags = 0;
	unsigned int		lock_flags = 0;
	struct xfs_dquot	*udqp = NULL;
	struct xfs_dquot	*udqp = NULL;
	struct xfs_dquot	*gdqp = NULL;
	struct xfs_dquot	*pdqp = NULL;
	struct xfs_dquot	*olddquot = NULL;
	struct xfs_dquot	*olddquot = NULL;
	int			code;
	int			code;


@@ -957,7 +957,7 @@ xfs_ioctl_setattr(
	if (XFS_IS_QUOTA_ON(mp) && (mask & FSX_PROJID)) {
	if (XFS_IS_QUOTA_ON(mp) && (mask & FSX_PROJID)) {
		code = xfs_qm_vop_dqalloc(ip, ip->i_d.di_uid,
		code = xfs_qm_vop_dqalloc(ip, ip->i_d.di_uid,
					 ip->i_d.di_gid, fa->fsx_projid,
					 ip->i_d.di_gid, fa->fsx_projid,
					 XFS_QMOPT_PQUOTA, &udqp, &gdqp);
					 XFS_QMOPT_PQUOTA, &udqp, NULL, &pdqp);
		if (code)
		if (code)
			return code;
			return code;
	}
	}
@@ -994,8 +994,8 @@ xfs_ioctl_setattr(
		    XFS_IS_PQUOTA_ON(mp) &&
		    XFS_IS_PQUOTA_ON(mp) &&
		    xfs_get_projid(ip) != fa->fsx_projid) {
		    xfs_get_projid(ip) != fa->fsx_projid) {
			ASSERT(tp);
			ASSERT(tp);
			code = xfs_qm_vop_chown_reserve(tp, ip, udqp, gdqp,
			code = xfs_qm_vop_chown_reserve(tp, ip, udqp, NULL,
						capable(CAP_FOWNER) ?
						pdqp, capable(CAP_FOWNER) ?
						XFS_QMOPT_FORCE_RES : 0);
						XFS_QMOPT_FORCE_RES : 0);
			if (code)	/* out of quota */
			if (code)	/* out of quota */
				goto error_return;
				goto error_return;
@@ -1113,7 +1113,7 @@ xfs_ioctl_setattr(
		if (xfs_get_projid(ip) != fa->fsx_projid) {
		if (xfs_get_projid(ip) != fa->fsx_projid) {
			if (XFS_IS_QUOTA_RUNNING(mp) && XFS_IS_PQUOTA_ON(mp)) {
			if (XFS_IS_QUOTA_RUNNING(mp) && XFS_IS_PQUOTA_ON(mp)) {
				olddquot = xfs_qm_vop_chown(tp, ip,
				olddquot = xfs_qm_vop_chown(tp, ip,
							&ip->i_gdquot, gdqp);
							&ip->i_pdquot, pdqp);
			}
			}
			xfs_set_projid(ip, fa->fsx_projid);
			xfs_set_projid(ip, fa->fsx_projid);


@@ -1160,13 +1160,13 @@ xfs_ioctl_setattr(
	 */
	 */
	xfs_qm_dqrele(olddquot);
	xfs_qm_dqrele(olddquot);
	xfs_qm_dqrele(udqp);
	xfs_qm_dqrele(udqp);
	xfs_qm_dqrele(gdqp);
	xfs_qm_dqrele(pdqp);


	return code;
	return code;


 error_return:
 error_return:
	xfs_qm_dqrele(udqp);
	xfs_qm_dqrele(udqp);
	xfs_qm_dqrele(gdqp);
	xfs_qm_dqrele(pdqp);
	xfs_trans_cancel(tp, 0);
	xfs_trans_cancel(tp, 0);
	if (lock_flags)
	if (lock_flags)
		xfs_iunlock(ip, lock_flags);
		xfs_iunlock(ip, lock_flags);
Loading