xfs: Allow pquota and gquota to be used together
Subsystems (2)
v2 cover xfs: Allow pquota and gquota to be used together
Hello All,
This is the version 2 of the changes to allow pquota and gquota to be used together.
Previous version of the posting can be found at
http://article.gmane.org/gmane.comp.file-systems.xfs.general/41284
Changes from the previous version:
- Created a new prep patch to accomodate some generic changes that ease the later patches.
- Created a new patch to add a new field qs_pquota to fs_quota_stat with appropriate versioning changes
- Changed the logic to allow XFS_OQUOTA.* flags to be allowed only in the older versions.
- Changed couple of places where PQUOTA checking was on the else if construct so as to allow both GQUOTA and PQUOTA in those places.
- Fixed comments in xfs_quota.h to reflect the current changes.
- Changed the name of the macro XFS_SB_VERSION2_SEPER_PQUOTA to XFS_SB_VERSION2_NO_OQUOTA
- got rid of the macros XFS_MOUNT_QUOTA_SET1 and XFS_MOUNT_QUOTA_SET2
- added a new inline function xfs_inode_dquot(ip, type) to simplify the error path in xfs_qm_dqget()
- got rid of the macro XFS_IS_THIS_QUOTA_OFF
- added comment to explain why sb_qflags is saved and restored in xfs_sb_to_disk()
Thanks & Regards,
chandra
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
RFC PATCH v2 1/5 xfs: Prep work for supporting both pquota and gquota.
Define few macros, inline functions, and change interface in preparation for allowing pquota and gquota to be used together.
--- fs/xfs/xfs_dquot.c | 37 +++++++++++-------------------------- fs/xfs/xfs_dquot.h | 15 ++++++++++++--- fs/xfs/xfs_log_recover.c | 2 +- fs/xfs/xfs_mount.c | 6 ++++-- fs/xfs/xfs_mount.h | 2 +- fs/xfs/xfs_qm.c | 2 +- fs/xfs/xfs_quota.h | 2 ++ fs/xfs/xfs_super.c | 7 +++---- 8 files changed, 35 insertions(+), 38 deletions(-)
fs/xfs/xfs_dquot.c +11 -26
@@ -372,7 +372,7 @@ xfs_qm_dqalloc(* Return if this type of quotas is turned off while we didn't * have an inode lock */ -if (XFS_IS_THIS_QUOTA_OFF (dqp)) { +if (!XFS_IS_TYPE_QUOTA_ON (dqp->q_mount, dqp->dq_flags)) {xfs_iunlock (quotip,XFS_ILOCK_EXCL );return (ESRCH ); }
@@ -474,7 +474,7 @@ xfs_qm_dqtobp( dqp->q_fileoffset = (xfs_fileoff_t )id / mp->m_quotainfo->qi_dqperchunk;xfs_ilock (quotip,XFS_ILOCK_SHARED ); -if (XFS_IS_THIS_QUOTA_OFF (dqp)) { +if (!XFS_IS_TYPE_QUOTA_ON (dqp->q_mount, dqp->dq_flags)) {/* * Return if this type of quotas is turned off while we * didn't have the quota inode lock.
@@ -808,7 +808,7 @@ xfs_qm_dqget(uint flags,/* DQALLOC, DQSUSER, DQREPAIR, DOWARN */ xfs_dquot_t **O_dqpp) /* OUT : locked incore dquot */ { - xfs_dquot_t *dqp; + xfs_dquot_t *dqp, *dqp1;xfs_dqhash_t *h;uint version;int error;
@@ -839,10 +839,7 @@ xfs_qm_dqget( type == XFS_DQ_GROUP);if (ip) {ASSERT (xfs_isilocked (ip,XFS_ILOCK_EXCL )); -if (type ==XFS_DQ_USER ) -ASSERT (ip->i_udquot ==NULL ); -else -ASSERT (ip->i_gdquot ==NULL ); +ASSERT (xfs_inode_dquot (ip, type) ==NULL ); }#endif mutex_lock (&h->qh_lock);
@@ -921,30 +918,18 @@ xfs_qm_dqget(* A dquot could be attached to this inode by now, since * we had dropped the ilock. */ -if (type ==XFS_DQ_USER ) { -if (!XFS_IS_UQUOTA_ON (mp)) { -/* inode stays locked on return */ -xfs_qm_dqdestroy (dqp); -return XFS_ERROR (ESRCH ); - } -if (ip->i_udquot) { +if (XFS_IS_TYPE_QUOTA_ON (mp, type)) { + dqp1 =xfs_inode_dquot (ip, type); +if (dqp1) {xfs_qm_dqdestroy (dqp); - dqp = ip->i_udquot; + dqp = dqp1;xfs_dqlock (dqp); goto dqret; } }else { -if (!XFS_IS_OQUOTA_ON (mp)) { -/* inode stays locked on return */ -xfs_qm_dqdestroy (dqp); -return XFS_ERROR (ESRCH ); - } -if (ip->i_gdquot) { -xfs_qm_dqdestroy (dqp); - dqp = ip->i_gdquot; -xfs_dqlock (dqp); - goto dqret; - } +/* inode stays locked on return */ +xfs_qm_dqdestroy (dqp); +return XFS_ERROR (ESRCH ); } }
fs/xfs/xfs_dquot.h +12 -3
@@ -102,6 +102,14 @@ static inline void xfs_dqfunlock(xfs_dquot_t *dqp)complete (&dqp->q_flush); } +static inline xfs_dquot_t *xfs_inode_dquot (xfs_inode_t *ip,int type) +{ +if (type ==XFS_DQ_USER ) +return ip->i_udquot; +else +return ip->i_gdquot; +} +#define XFS_DQ_IS_LOCKED (dqp) (mutex_is_locked(&((dqp)->q_qlock)))#define XFS_DQ_IS_DIRTY (dqp) ((dqp)->dq_flags & XFS_DQ_DIRTY)#define XFS_QM_ISUDQ (dqp) ((dqp)->dq_flags & XFS_DQ_USER)
@@ -112,9 +120,10 @@ static inline void xfs_dqfunlock(xfs_dquot_t *dqp) XFS_DQ_TO_QINF(dqp)->qi_uquotaip : \ XFS_DQ_TO_QINF(dqp)->qi_gquotaip) -#define XFS_IS_THIS_QUOTA_OFF (d) (! (XFS_QM_ISUDQ(d) ? \ - (XFS_IS_UQUOTA_ON((d)->q_mount)) : \ - (XFS_IS_OQUOTA_ON((d)->q_mount)))) +#define XFS_IS_TYPE_QUOTA_ON (mp, type) \ + ((XFS_IS_UQUOTA_ON(mp) && (type) == XFS_DQ_USER) || \ + (XFS_IS_OQUOTA_ON(mp) && (type) == XFS_DQ_PROJ) || \ + (XFS_IS_OQUOTA_ON(mp) && (type) == XFS_DQ_GROUP))extern void xfs_qm_dqdestroy (xfs_dquot_t *);extern int xfs_qm_dqflush (xfs_dquot_t *,uint );
fs/xfs/xfs_log_recover.c +1 -1
@@ -3695,7 +3695,7 @@ xlog_do_recover(/* Convert superblock from on-disk format */ sbp = &log->l_mp->m_sb; -xfs_sb_from_disk (sbp,XFS_BUF_TO_SBP (bp)); +xfs_sb_from_disk (log->l_mp,XFS_BUF_TO_SBP (bp));ASSERT (sbp->sb_magicnum ==XFS_SB_MAGIC );ASSERT (xfs_sb_good_version (sbp));xfs_buf_relse (bp);
fs/xfs/xfs_mount.c +4 -2
@@ -553,9 +553,11 @@ out_unwind:void xfs_sb_from_disk ( -xfs_sb_t *to, +xfs_mount_t *mp,xfs_dsb_t *from) { +xfs_sb_t *to = &mp->m_sb; + to->sb_magicnum =be32_to_cpu (from->sb_magicnum); to->sb_blocksize =be32_to_cpu (from->sb_blocksize); to->sb_dblocks =be64_to_cpu (from->sb_dblocks);
@@ -693,7 +695,7 @@ reread:* Initialize the mount structure from the superblock. * But first do some basic consistency checking. */ -xfs_sb_from_disk (&mp->m_sb,XFS_BUF_TO_SBP (bp)); +xfs_sb_from_disk (mp,XFS_BUF_TO_SBP (bp)); error =xfs_mount_validate_sb (mp, &(mp->m_sb), flags);if (error) {if (loud)
fs/xfs/xfs_mount.h +1 -1
@@ -396,7 +396,7 @@ extern void xfs_set_low_space_thresholds(struct xfs_mount *);extern void xfs_mod_sb (struct xfs_trans *,__int64_t );extern int xfs_initialize_perag (struct xfs_mount *,xfs_agnumber_t ,xfs_agnumber_t *); -extern void xfs_sb_from_disk (struct xfs_sb *,struct xfs_dsb *); +extern void xfs_sb_from_disk (struct xfs_mount *,struct xfs_dsb *);extern void xfs_sb_to_disk (struct xfs_dsb *,struct xfs_sb *,__int64_t );#endif /* __XFS_MOUNT_H__ */
fs/xfs/xfs_qm.c +1 -1
@@ -1688,7 +1688,7 @@ xfs_qm_quotacheck(* quotachecked status, since we won't be doing accounting for * that type anymore. */ - mp->m_qflags &= ~(XFS_OQUOTA_CHKD |XFS_UQUOTA_CHKD ); + mp->m_qflags &= ~XFS_ALL_QUOTA_CHKD ; mp->m_qflags |= flags; error_return:
fs/xfs/xfs_quota.h +2 -0
@@ -176,6 +176,8 @@ typedef struct xfs_qoff_logformat {#define XFS_UQUOTA_ACTIVE 0x0100/* uquotas are being turned off */ #define XFS_PQUOTA_ACTIVE 0x0200/* pquotas are being turned off */ #define XFS_GQUOTA_ACTIVE 0x0400/* gquotas are being turned off */ +#define XFS_ALL_QUOTA_ACTIVE \ + (XFS_UQUOTA_ACTIVE | XFS_PQUOTA_ACTIVE | XFS_GQUOTA_ACTIVE)/* * Checking XFS_IS_*QUOTA_ON() while holding any inode lock guarantees
fs/xfs/xfs_super.c +3 -4
@@ -325,10 +325,9 @@ xfs_parseargs( }else if (!strcmp (this_char,MNTOPT_FILESTREAM )) { mp->m_flags |=XFS_MOUNT_FILESTREAMS ; }else if (!strcmp (this_char,MNTOPT_NOQUOTA )) { - mp->m_qflags &= ~(XFS_UQUOTA_ACCT |XFS_UQUOTA_ACTIVE | -XFS_GQUOTA_ACCT |XFS_GQUOTA_ACTIVE | -XFS_PQUOTA_ACCT |XFS_PQUOTA_ACTIVE | -XFS_UQUOTA_ENFD |XFS_OQUOTA_ENFD ); + mp->m_qflags &= ~XFS_ALL_QUOTA_ACCT ; + mp->m_qflags &= ~XFS_ALL_QUOTA_ENFD ; + mp->m_qflags &= ~XFS_ALL_QUOTA_ACTIVE ; }else if (!strcmp (this_char,MNTOPT_QUOTA ) || !strcmp (this_char,MNTOPT_UQUOTA ) || !strcmp (this_char,MNTOPT_USRQUOTA )) {
Signature · 6 lines
1.7.1 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
RFC PATCH v2 3/5 xfs: Add pquota fields where gquota is used.
In reply to Chandra SeetharamanAdd project quota changes to all the places where group quota field is used. by use of macros.
No externally visible changed and no superblock changes, yet.
--- fs/xfs/xfs_dquot.h | 13 ++- fs/xfs/xfs_iget.c | 2 +- fs/xfs/xfs_inode.h | 1 + fs/xfs/xfs_ioctl.c | 12 +- fs/xfs/xfs_iops.c | 4 +- fs/xfs/xfs_qm.c | 269 +++++++++++++++++++++++++++++++--------------- fs/xfs/xfs_qm.h | 4 +- fs/xfs/xfs_qm_bhv.c | 2 +- fs/xfs/xfs_qm_syscalls.c | 19 +++- fs/xfs/xfs_quota.h | 38 ++++--- fs/xfs/xfs_sb.h | 1 + fs/xfs/xfs_super.c | 5 +- fs/xfs/xfs_trans_dquot.c | 68 +++++++++--- fs/xfs/xfs_vnodeops.c | 23 +++-- 14 files changed, 310 insertions(+), 151 deletions(-)
fs/xfs/xfs_dquot.h +9 -4
@@ -59,6 +59,7 @@ typedef struct xfs_dquot {xfs_fileoff_t q_fileoffset;/* offset in quotas file */ 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_dq_logitem_t q_logitem;/* dquot log item */ xfs_qcnt_t q_res_bcount;/* total regular nblks used+reserved */
@@ -106,8 +107,10 @@ static inline xfs_dquot_t *xfs_inode_dquot(xfs_inode_t *ip, int type) {if (type ==XFS_DQ_USER )return ip->i_udquot; -else +else if (type ==XFS_DQ_GROUP )return ip->i_gdquot; +else +return ip->i_pdquot; }#define XFS_DQ_IS_LOCKED (dqp) (mutex_is_locked(&((dqp)->q_qlock)))
@@ -118,12 +121,14 @@ static inline xfs_dquot_t *xfs_inode_dquot(xfs_inode_t *ip, int type)#define XFS_DQ_TO_QINF (dqp) ((dqp)->q_mount->m_quotainfo)#define XFS_DQ_TO_QIP (dqp) (XFS_QM_ISUDQ(dqp) ? \ XFS_DQ_TO_QINF(dqp)->qi_uquotaip : \ - XFS_DQ_TO_QINF(dqp)->qi_gquotaip) + ((XFS_QM_ISGDQ(dqp) ? \ + XFS_DQ_TO_QINF(dqp)->qi_gquotaip :\ + XFS_DQ_TO_QINF(dqp)->qi_pquotaip)))#define XFS_IS_TYPE_QUOTA_ON (mp, type) \ ((XFS_IS_UQUOTA_ON(mp) && (type) == XFS_DQ_USER) || \ - (XFS_IS_OQUOTA_ON(mp) && (type) == XFS_DQ_PROJ) || \ - (XFS_IS_OQUOTA_ON(mp) && (type) == XFS_DQ_GROUP)) + (XFS_IS_PQUOTA_ON(mp) && (type) == XFS_DQ_PROJ) || \ + (XFS_IS_GQUOTA_ON(mp) && (type) == XFS_DQ_GROUP))extern void xfs_qm_dqdestroy (xfs_dquot_t *);extern int xfs_qm_dqflush (xfs_dquot_t *,uint );
fs/xfs/xfs_iget.c +1 -1
@@ -365,7 +365,7 @@ xfs_iget_cache_miss( }/* These values _must_ be set before releasing the radix tree lock! */ - ip->i_udquot = ip->i_gdquot =NULL ; + ip->i_udquot = ip->i_gdquot = ip->i_pdquot =NULL ;xfs_iflags_set (ip,XFS_INEW );spin_unlock (&pag->pag_ici_lock);
fs/xfs/xfs_inode.h +1 -0
@@ -231,6 +231,7 @@ typedef struct xfs_inode {struct xfs_mount *i_mount;/* fs mount struct ptr */ struct xfs_dquot *i_udquot;/* user dquot */ struct xfs_dquot *i_gdquot;/* group dquot */ +struct xfs_dquot *i_pdquot;/* project dquot */ /* Inode location stuff */ xfs_ino_t i_ino;/* inode number (agno/agino)*/
fs/xfs/xfs_ioctl.c +6 -6
@@ -907,7 +907,7 @@ xfs_ioctl_setattr(struct xfs_trans *tp;unsigned int lock_flags =0 ;struct xfs_dquot *udqp =NULL ; -struct xfs_dquot *gdqp =NULL ; +struct xfs_dquot *pdqp =NULL ;struct xfs_dquot *olddquot =NULL ;int code;
@@ -936,7 +936,7 @@ xfs_ioctl_setattr(if (XFS_IS_QUOTA_ON (mp) && (mask &FSX_PROJID )) { code =xfs_qm_vop_dqalloc (ip, ip->i_d.di_uid, ip->i_d.di_gid, fa->fsx_projid, -XFS_QMOPT_PQUOTA , &udqp, &gdqp); +XFS_QMOPT_PQUOTA , &udqp,NULL , &pdqp);if (code)return code; }
@@ -973,7 +973,7 @@ xfs_ioctl_setattr( XFS_IS_PQUOTA_ON(mp) && xfs_get_projid(ip) != fa->fsx_projid) {ASSERT (tp); - code =xfs_qm_vop_chown_reserve (tp, ip, udqp, gdqp, + code =xfs_qm_vop_chown_reserve (tp, ip, udqp,NULL , pdqp,capable (CAP_FOWNER ) ?XFS_QMOPT_FORCE_RES :0 );if (code)/* out of quota */
@@ -1092,7 +1092,7 @@ xfs_ioctl_setattr(if (xfs_get_projid (ip) != fa->fsx_projid) {if (XFS_IS_QUOTA_RUNNING (mp) &&XFS_IS_PQUOTA_ON (mp)) { olddquot =xfs_qm_vop_chown (tp, ip, - &ip->i_gdquot, gdqp); + &ip->i_pdquot, pdqp); }xfs_set_projid (ip, fa->fsx_projid);
@@ -1139,13 +1139,13 @@ xfs_ioctl_setattr(*/ xfs_qm_dqrele (olddquot);xfs_qm_dqrele (udqp); -xfs_qm_dqrele (gdqp); +xfs_qm_dqrele (pdqp);return code; error_return:xfs_qm_dqrele (udqp); -xfs_qm_dqrele (gdqp); +xfs_qm_dqrele (pdqp);xfs_trans_cancel (tp,0 );if (lock_flags)xfs_iunlock (ip, lock_flags);
fs/xfs/xfs_iops.c +2 -2
@@ -568,7 +568,7 @@ xfs_setattr_nonsize(ASSERT (udqp ==NULL );ASSERT (gdqp ==NULL ); error =xfs_qm_vop_dqalloc (ip, uid, gid,xfs_get_projid (ip), - qflags, &udqp, &gdqp); + qflags, &udqp, &gdqp,NULL );if (error)return error; }
@@ -603,7 +603,7 @@ xfs_setattr_nonsize( ((XFS_IS_UQUOTA_ON(mp) && iuid != uid) || (XFS_IS_GQUOTA_ON(mp) && igid != gid))) {ASSERT (tp); - error =xfs_qm_vop_chown_reserve (tp, ip, udqp, gdqp, + error =xfs_qm_vop_chown_reserve (tp, ip, udqp, gdqp,NULL ,capable (CAP_FOWNER ) ?XFS_QMOPT_FORCE_RES :0 );if (error)/* out of quota */
fs/xfs/xfs_qm.c +180 -89
514 lines not on this page · raw message
fs/xfs/xfs_qm.h +2 -2
@@ -92,6 +92,7 @@ typedef struct xfs_qm { typedef struct xfs_quotainfo { xfs_inode_t *qi_uquotaip; /* user quota inode */ xfs_inode_t *qi_gquotaip; /* group quota inode */ + xfs_inode_t *qi_pquotaip; /* project quota inode */ struct list_head qi_dqlist; /* all dquots in filesys */ struct mutex qi_dqlist_lock; int qi_dquots;
@@ -116,8 +117,6 @@ typedef struct xfs_quotainfo {extern void xfs_trans_mod_dquot (xfs_trans_t *,xfs_dquot_t *,uint ,long ); -extern int xfs_trans_reserve_quota_bydquots (xfs_trans_t *,xfs_mount_t *, -xfs_dquot_t *,xfs_dquot_t *,long ,long ,uint );extern void xfs_trans_dqjoin (xfs_trans_t *,xfs_dquot_t *);extern void xfs_trans_log_dquot (xfs_trans_t *,xfs_dquot_t *);
@@ -130,6 +129,7 @@ extern void xfs_trans_log_dquot(xfs_trans_t *, xfs_dquot_t *);typedef struct xfs_dquot_acct {xfs_dqtrx_t dqa_usrdquots[XFS_QM_TRANS_MAXDQS ];xfs_dqtrx_t dqa_grpdquots[XFS_QM_TRANS_MAXDQS ]; +xfs_dqtrx_t dqa_prjdquots[XFS_QM_TRANS_MAXDQS ]; }xfs_dquot_acct_t ;/*
fs/xfs/xfs_qm_bhv.c +1 -1
@@ -117,7 +117,7 @@ xfs_qm_newmount( (pquotaondisk && !XFS_IS_PQUOTA_ON(mp)) || (!pquotaondisk && XFS_IS_PQUOTA_ON(mp)) || (gquotaondisk && !XFS_IS_GQUOTA_ON(mp)) || - (!gquotaondisk && XFS_IS_OQUOTA_ON(mp))) && + (!gquotaondisk && XFS_IS_GQUOTA_ON(mp))) && xfs_dev_is_read_only(mp, "changing quota state")) { xfs_warn(mp, "please mount with%s%s%s%s.", (!quotaondisk ? "out quota" : ""),
fs/xfs/xfs_qm_syscalls.c +15 -4
@@ -122,7 +122,8 @@ xfs_qm_scall_quotaoff( dqtype |=XFS_QMOPT_GQUOTA ; flags |= (XFS_GQUOTA_CHKD |XFS_GQUOTA_ENFD ); inactivate_flags |=XFS_GQUOTA_ACTIVE ; - }else if (flags &XFS_PQUOTA_ACCT ) { + } +if (flags &XFS_PQUOTA_ACCT ) { dqtype |=XFS_QMOPT_PQUOTA ; flags |= (XFS_PQUOTA_CHKD |XFS_PQUOTA_ENFD ); inactivate_flags |=XFS_PQUOTA_ACTIVE ;
@@ -222,10 +223,14 @@ xfs_qm_scall_quotaoff(IRELE (q->qi_uquotaip); q->qi_uquotaip =NULL ; } -if ((dqtype & (XFS_QMOPT_GQUOTA |XFS_QMOPT_PQUOTA )) && q->qi_gquotaip) { +if ((dqtype &XFS_QMOPT_GQUOTA ) && q->qi_gquotaip) {IRELE (q->qi_gquotaip); q->qi_gquotaip =NULL ; } +if ((dqtype &XFS_QMOPT_PQUOTA ) && q->qi_pquotaip) { +IRELE (q->qi_pquotaip); + q->qi_pquotaip =NULL ; + } out_unlock:mutex_unlock (&q->qi_quotaofflock);
@@ -872,9 +877,11 @@ xfs_dqrele_inode( {/* skip quota inodes */ if (ip == ip->i_mount->m_quotainfo->qi_uquotaip || - ip == ip->i_mount->m_quotainfo->qi_gquotaip) { + ip == ip->i_mount->m_quotainfo->qi_gquotaip || + ip == ip->i_mount->m_quotainfo->qi_pquotaip) {ASSERT (ip->i_udquot ==NULL );ASSERT (ip->i_gdquot ==NULL ); +ASSERT (ip->i_pdquot ==NULL );return 0 ; }
@@ -883,10 +890,14 @@ xfs_dqrele_inode(xfs_qm_dqrele (ip->i_udquot); ip->i_udquot =NULL ; } -if (flags & (XFS_PQUOTA_ACCT |XFS_GQUOTA_ACCT ) && ip->i_gdquot) { +if ((flags &XFS_GQUOTA_ACCT ) && ip->i_gdquot) {xfs_qm_dqrele (ip->i_gdquot); ip->i_gdquot =NULL ; } +if ((flags &XFS_PQUOTA_ACCT ) && ip->i_pdquot) { +xfs_qm_dqrele (ip->i_pdquot); + ip->i_pdquot =NULL ; + }xfs_iunlock (ip,XFS_ILOCK_EXCL );return 0 ; }
fs/xfs/xfs_quota.h +21 -17
@@ -188,9 +188,9 @@ typedef struct xfs_qoff_logformat {* are in the process of getting turned off. These flags are in m_qflags but * never in sb_qflags. */ -#define XFS_UQUOTA_ACTIVE 0x0100/* uquotas are being turned off */ -#define XFS_PQUOTA_ACTIVE 0x0200/* pquotas are being turned off */ -#define XFS_GQUOTA_ACTIVE 0x0400/* gquotas are being turned off */ +#define XFS_UQUOTA_ACTIVE 0x1000/* uquotas are being turned off */ +#define XFS_PQUOTA_ACTIVE 0x2000/* pquotas are being turned off */ +#define XFS_GQUOTA_ACTIVE 0x4000/* gquotas are being turned off */ #define XFS_ALL_QUOTA_ACTIVE \ (XFS_UQUOTA_ACTIVE | XFS_PQUOTA_ACTIVE | XFS_GQUOTA_ACTIVE)
@@ -201,8 +201,6 @@ typedef struct xfs_qoff_logformat {#define XFS_IS_QUOTA_ON (mp) ((mp)->m_qflags & (XFS_UQUOTA_ACTIVE | \ XFS_GQUOTA_ACTIVE | \ XFS_PQUOTA_ACTIVE)) -#define XFS_IS_OQUOTA_ON (mp) ((mp)->m_qflags & (XFS_GQUOTA_ACTIVE | \ - XFS_PQUOTA_ACTIVE))#define XFS_IS_UQUOTA_ON (mp) ((mp)->m_qflags & XFS_UQUOTA_ACTIVE)#define XFS_IS_GQUOTA_ON (mp) ((mp)->m_qflags & XFS_GQUOTA_ACTIVE)#define XFS_IS_PQUOTA_ON (mp) ((mp)->m_qflags & XFS_PQUOTA_ACTIVE)
@@ -270,8 +268,10 @@ typedef struct xfs_qoff_logformat {*/ #define XFS_NOT_DQATTACHED (mp, ip) ((XFS_IS_UQUOTA_ON(mp) &&\ (ip)->i_udquot == NULL) || \ - (XFS_IS_OQUOTA_ON(mp) && \ - (ip)->i_gdquot == NULL)) + (XFS_IS_GQUOTA_ON(mp) && \ + (ip)->i_gdquot == NULL) || \ + (XFS_IS_PQUOTA_ON(mp) && \ + (ip)->i_pdquot == NULL))#define XFS_QM_NEED_QUOTACHECK (mp) \ ((XFS_IS_UQUOTA_ON(mp) && \
@@ -326,17 +326,18 @@ extern int xfs_trans_reserve_quota_nblks(struct xfs_trans *, struct xfs_inode *, long, long, uint);extern int xfs_trans_reserve_quota_bydquots (struct xfs_trans *,struct xfs_mount *,struct xfs_dquot *, -struct xfs_dquot *,long ,long ,uint ); +struct xfs_dquot *,struct xfs_dquot *,long ,long ,uint );extern int xfs_qm_vop_dqalloc (struct xfs_inode *,uid_t ,gid_t ,prid_t ,uint , -struct xfs_dquot **,struct xfs_dquot **); +struct xfs_dquot **,struct xfs_dquot **,struct xfs_dquot **);extern void xfs_qm_vop_create_dqattach (struct xfs_trans *,struct xfs_inode *, -struct xfs_dquot *,struct xfs_dquot *); +struct xfs_dquot *,struct xfs_dquot *,struct xfs_dquot *);extern int xfs_qm_vop_rename_dqattach (struct xfs_inode **);extern struct xfs_dquot *xfs_qm_vop_chown (struct xfs_trans *,struct xfs_inode *,struct xfs_dquot **,struct xfs_dquot *);extern int xfs_qm_vop_chown_reserve (struct xfs_trans *,struct xfs_inode *, -struct xfs_dquot *,struct xfs_dquot *,uint ); +struct xfs_dquot *,struct xfs_dquot *, +struct xfs_dquot *,uint );extern int xfs_qm_dqattach (struct xfs_inode *,uint );extern int xfs_qm_dqattach_locked (struct xfs_inode *,uint );extern void xfs_qm_dqdetach (struct xfs_inode *);
@@ -351,10 +352,12 @@ extern void xfs_qm_unmount_quotas(struct xfs_mount *);#else static inline int xfs_qm_vop_dqalloc (struct xfs_inode *ip,uid_t uid,gid_t gid,prid_t prid, -uint flags,struct xfs_dquot **udqp,struct xfs_dquot **gdqp) +uint flags,struct xfs_dquot **udqp,struct xfs_dquot **gdqp, +xfs_dquot **pdqp) { *udqp =NULL ; *gdqp =NULL ; + *pdqp =NULL ;return 0 ; }#define xfs_trans_dup_dqinfo (tp, tp2)
@@ -369,14 +372,15 @@ static inline int xfs_trans_reserve_quota_nblks(struct xfs_trans *tp, }static inline int xfs_trans_reserve_quota_bydquots (struct xfs_trans *tp,struct xfs_mount *mp,struct xfs_dquot *udqp, -struct xfs_dquot *gdqp,long nblks,long nions,uint flags) +struct xfs_dquot *gdqp,struct xfs_dquot *pdqp, +long nblks,long nions,uint flags) {return 0 ; } -#define xfs_qm_vop_create_dqattach (tp, ip, u, g) +#define xfs_qm_vop_create_dqattach (tp, ip, u, g, p)#define xfs_qm_vop_rename_dqattach (it) (0)#define xfs_qm_vop_chown (tp, ip, old, new) (NULL) -#define xfs_qm_vop_chown_reserve (tp, ip, u, g, fl) (0) +#define xfs_qm_vop_chown_reserve (tp, ip, u, g, p, fl) (0)#define xfs_qm_dqattach (ip, fl) (0)#define xfs_qm_dqattach_locked (ip, fl) (0)#define xfs_qm_dqdetach (ip)
@@ -394,8 +398,8 @@ static inline int xfs_qm_sync(struct xfs_mount *mp, int flags)#define xfs_trans_unreserve_quota_nblks (tp, ip, nblks, ninos, flags) \ xfs_trans_reserve_quota_nblks(tp, ip, -(nblks), -(ninos), flags) -#define xfs_trans_reserve_quota (tp, mp, ud, gd, nb, ni, f) \ - xfs_trans_reserve_quota_bydquots(tp, mp, ud, gd, nb, ni, \ +#define xfs_trans_reserve_quota (tp, mp, ud, gd, pd, nb, ni, f) \ + xfs_trans_reserve_quota_bydquots(tp, mp, ud, gd, pd, nb, ni, \ f | XFS_QMOPT_RES_REGBLKS) extern int xfs_qm_dqcheck(struct xfs_mount *, xfs_disk_dquot_t *,
fs/xfs/xfs_sb.h +1 -0
@@ -140,6 +140,7 @@ typedef struct xfs_sb {*/ xfs_ino_t sb_uquotino;/* user quota inode */ xfs_ino_t sb_gquotino;/* group quota inode */ +#define sb_pquotino sb_gquotino__uint16_t sb_qflags;/* quota flags */ __uint8_t sb_flags;/* misc. flags */ __uint8_t sb_shared_vn;/* shared version number */
fs/xfs/xfs_super.c +2 -3
@@ -548,14 +548,13 @@ xfs_showargs(else if (mp->m_qflags &XFS_UQUOTA_ACCT )seq_puts (m,"," MNTOPT_UQUOTANOENF ); -/* Either project or group quotas can be active, not both */ -if (mp->m_qflags &XFS_PQUOTA_ACCT ) {if (mp->m_qflags &XFS_PQUOTA_ENFD )seq_puts (m,"," MNTOPT_PRJQUOTA );else seq_puts (m,"," MNTOPT_PQUOTANOENF ); - }else if (mp->m_qflags &XFS_GQUOTA_ACCT ) { + } +if (mp->m_qflags &XFS_GQUOTA_ACCT ) {if (mp->m_qflags &XFS_GQUOTA_ENFD )seq_puts (m,"," MNTOPT_GRPQUOTA );else
fs/xfs/xfs_trans_dquot.c +54 -14
143 lines not on this page · raw message
fs/xfs/xfs_vnodeops.c +15 -8
@@ -833,6 +833,7 @@ xfs_create(prid_t prid;struct xfs_dquot *udqp =NULL ;struct xfs_dquot *gdqp =NULL ; +struct xfs_dquot *pdqp =NULL ;uint resblks;uint log_res;uint log_count;
@@ -851,7 +852,7 @@ xfs_create(* Make sure that we have allocated dquot(s) on disk. */ error =xfs_qm_vop_dqalloc (dp,current_fsuid (),current_fsgid (), prid, -XFS_QMOPT_QUOTALL |XFS_QMOPT_INHERIT , &udqp, &gdqp); +XFS_QMOPT_QUOTALL |XFS_QMOPT_INHERIT , &udqp, &gdqp, &pdqp);if (error)return error;
@@ -911,7 +912,8 @@ xfs_create(/* * Reserve disk quota and the inode. */ - error =xfs_trans_reserve_quota (tp, mp, udqp, gdqp, resblks,1 ,0 ); + error =xfs_trans_reserve_quota (tp, mp, udqp, gdqp, + pdqp, resblks,1 ,0 );if (error) goto out_trans_cancel;
@@ -975,7 +977,7 @@ xfs_create(* These ids of the inode couldn't have changed since the new * inode has been locked ever since it was created. */ -xfs_qm_vop_create_dqattach (tp, ip, udqp, gdqp); +xfs_qm_vop_create_dqattach (tp, ip, udqp, gdqp, pdqp); error =xfs_bmap_finish (&tp, &free_list, &committed);if (error)
@@ -987,6 +989,7 @@ xfs_create(xfs_qm_dqrele (udqp);xfs_qm_dqrele (gdqp); +xfs_qm_dqrele (pdqp); *ipp = ip;return 0 ;
@@ -1008,6 +1011,7 @@ xfs_create(xfs_qm_dqrele (udqp);xfs_qm_dqrele (gdqp); +xfs_qm_dqrele (pdqp);if (unlock_dp_on_error)xfs_iunlock (dp,XFS_ILOCK_EXCL );
@@ -1498,7 +1502,7 @@ xfs_symlink(int n;xfs_buf_t *bp;prid_t prid; -struct xfs_dquot *udqp, *gdqp; +struct xfs_dquot *udqp, *gdqp, *pdqp;uint resblks; *ipp =NULL ;
@@ -1528,7 +1532,7 @@ xfs_symlink(* Make sure that we have allocated dquot(s) on disk. */ error =xfs_qm_vop_dqalloc (dp,current_fsuid (),current_fsgid (), prid, -XFS_QMOPT_QUOTALL |XFS_QMOPT_INHERIT , &udqp, &gdqp); +XFS_QMOPT_QUOTALL |XFS_QMOPT_INHERIT , &udqp, &gdqp, &pdqp);if (error) goto std_return;
@@ -1569,7 +1573,8 @@ xfs_symlink(/* * Reserve disk quota : blocks and inode. */ - error =xfs_trans_reserve_quota (tp, mp, udqp, gdqp, resblks,1 ,0 ); + error =xfs_trans_reserve_quota (tp, mp, udqp, gdqp, + pdqp, resblks,1 ,0 );if (error) goto error_return;
@@ -1607,7 +1612,7 @@ xfs_symlink(/* * Also attach the dquot(s) to it, if applicable. */ -xfs_qm_vop_create_dqattach (tp, ip, udqp, gdqp); +xfs_qm_vop_create_dqattach (tp, ip, udqp, gdqp, pdqp);if (resblks) resblks -=XFS_IALLOC_SPACE_RES (mp);
@@ -1691,6 +1696,7 @@ xfs_symlink( error =xfs_trans_commit (tp,XFS_TRANS_RELEASE_LOG_RES );xfs_qm_dqrele (udqp);xfs_qm_dqrele (gdqp); +xfs_qm_dqrele (pdqp); *ipp = ip;return 0 ;
@@ -1704,6 +1710,7 @@ xfs_symlink(xfs_trans_cancel (tp, cancel_flags);xfs_qm_dqrele (udqp);xfs_qm_dqrele (gdqp); +xfs_qm_dqrele (pdqp);if (unlock_dp_on_error)xfs_iunlock (dp,XFS_ILOCK_EXCL );
@@ -2170,7 +2177,7 @@ xfs_free_file_space( }xfs_ilock (ip,XFS_ILOCK_EXCL ); error =xfs_trans_reserve_quota (tp, mp, - ip->i_udquot, ip->i_gdquot, + ip->i_udquot, ip->i_gdquot, ip->i_pdquot, resblks,0 ,XFS_QMOPT_RES_REGBLKS );if (error) goto error1;
Signature · 6 lines
1.7.1 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
RFC PATCH v2 2/5 xfs: Remove incore use of XFS_OQUOTA_ENFD and XFS_OQUOTA_CHKD
In reply to Chandra SeetharamanRemove incore use of XFS_OQUOTA_ENFD and XFS_OQUOTA_CHKD. Instead, start using XFS_GQUOTA_.* XFS_PQUOTA_.* counterparts.
No changes is made to the on-disk version of the superblock yey. On-disk copy still uses XFS_OQUOTA_ENFD and XFS_OQUOTA_CHKD.
--- fs/xfs/xfs_mount.c | 30 ++++++++++++++++++++++++++++++ fs/xfs/xfs_qm.c | 9 ++++++--- fs/xfs/xfs_qm_syscalls.c | 26 ++++++++++++++------------ fs/xfs/xfs_quota.h | 36 +++++++++++++++++++++++++----------- fs/xfs/xfs_quotaops.c | 6 ++++-- fs/xfs/xfs_super.c | 16 ++++++++-------- fs/xfs/xfs_trans_dquot.c | 4 ++-- 7 files changed, 89 insertions(+), 38 deletions(-)
fs/xfs/xfs_mount.c +30 -0
@@ -593,6 +593,20 @@ xfs_sb_from_disk( to->sb_uquotino =be64_to_cpu (from->sb_uquotino); to->sb_gquotino =be64_to_cpu (from->sb_gquotino); to->sb_qflags =be16_to_cpu (from->sb_qflags); +if ((to->sb_qflags & (XFS_OQUOTA_ENFD |XFS_OQUOTA_CHKD )) && + (to->sb_qflags & (XFS_PQUOTA_ENFD |XFS_GQUOTA_ENFD | +XFS_PQUOTA_CHKD |XFS_GQUOTA_CHKD ))) { +xfs_notice (mp,"Super block has XFS_OQUOTA bits along with " +"XFS_PQUOTA and/or XFS_GQUOTA bits. Fixing it.\n" ); + } +if (to->sb_qflags &XFS_OQUOTA_ENFD ) + to->sb_qflags |= (to->sb_qflags &XFS_PQUOTA_ACCT ) ? +XFS_PQUOTA_ENFD :XFS_GQUOTA_ENFD ; +if (to->sb_qflags &XFS_OQUOTA_CHKD ) + to->sb_qflags |= (to->sb_qflags &XFS_PQUOTA_ACCT ) ? +XFS_PQUOTA_CHKD :XFS_GQUOTA_CHKD ; + to->sb_qflags &= ~(XFS_OQUOTA_ENFD |XFS_OQUOTA_CHKD ); + to->sb_flags = from->sb_flags; to->sb_shared_vn = from->sb_shared_vn; to->sb_inoalignmt =be32_to_cpu (from->sb_inoalignmt);
@@ -622,11 +636,26 @@ xfs_sb_to_disk(xfs_sb_field_t f;int first;int size; +__be16 saved_qflags;ASSERT (fields);if (!fields)return ; +/* +* in-core version of qflags do not have XFS_OQUOTA.*, whereas the +* on-disk version does. So, save the in-core sb_qflags and restore +* it after we modify and copy it to the buffer to be copied to +* disk. +*/ + saved_qflags = from->sb_qflags; + +if (from->sb_qflags & (XFS_PQUOTA_ENFD |XFS_GQUOTA_ENFD )) + from->sb_qflags |=XFS_OQUOTA_ENFD ; +if (from->sb_qflags & (XFS_PQUOTA_CHKD |XFS_GQUOTA_CHKD )) + from->sb_qflags |=XFS_OQUOTA_CHKD ; + from->sb_qflags &= ~(XFS_PQUOTA_ENFD |XFS_PQUOTA_CHKD | +XFS_GQUOTA_ENFD |XFS_GQUOTA_CHKD );while (fields) { f = (xfs_sb_field_t )xfs_lowbit64 ((__uint64_t )fields); first = xfs_sb_info[f].offset;
@@ -657,6 +686,7 @@ xfs_sb_to_disk( fields &= ~(1LL << f); } + from->sb_qflags = saved_qflags; }/*
fs/xfs/xfs_qm.c +6 -3
@@ -343,8 +343,10 @@ xfs_qm_mount_quotas(*/ if (!XFS_IS_UQUOTA_ON (mp)) mp->m_qflags &= ~XFS_UQUOTA_CHKD ; -if (!(XFS_IS_GQUOTA_ON (mp) ||XFS_IS_PQUOTA_ON (mp))) - mp->m_qflags &= ~XFS_OQUOTA_CHKD ; +if (!XFS_IS_GQUOTA_ON (mp)) + mp->m_qflags &= ~XFS_GQUOTA_CHKD ; +if (!XFS_IS_PQUOTA_ON (mp)) + mp->m_qflags &= ~XFS_PQUOTA_CHKD ; write_changes:/*
@@ -1638,7 +1640,8 @@ xfs_qm_quotacheck( XFS_QMOPT_GQUOTA : XFS_QMOPT_PQUOTA);if (error) goto error_return; - flags |=XFS_OQUOTA_CHKD ; + flags |=XFS_IS_GQUOTA_ON (mp) ? +XFS_GQUOTA_CHKD :XFS_PQUOTA_CHKD ; } do {
fs/xfs/xfs_qm_syscalls.c +14 -12
@@ -120,11 +120,11 @@ xfs_qm_scall_quotaoff( }if (flags &XFS_GQUOTA_ACCT ) { dqtype |=XFS_QMOPT_GQUOTA ; - flags |= (XFS_OQUOTA_CHKD |XFS_OQUOTA_ENFD ); + flags |= (XFS_GQUOTA_CHKD |XFS_GQUOTA_ENFD ); inactivate_flags |=XFS_GQUOTA_ACTIVE ; }else if (flags &XFS_PQUOTA_ACCT ) { dqtype |=XFS_QMOPT_PQUOTA ; - flags |= (XFS_OQUOTA_CHKD |XFS_OQUOTA_ENFD ); + flags |= (XFS_PQUOTA_CHKD |XFS_PQUOTA_ENFD ); inactivate_flags |=XFS_PQUOTA_ACTIVE ; }
@@ -343,9 +343,11 @@ xfs_qm_scall_quotaon( || ((flags & XFS_PQUOTA_ACCT) == 0 && (mp->m_sb.sb_qflags & XFS_PQUOTA_ACCT) == 0 && - (flags & XFS_GQUOTA_ACCT) == 0 && + (flags & XFS_PQUOTA_ENFD)) + || + ((flags & XFS_GQUOTA_ACCT) == 0 && (mp->m_sb.sb_qflags & XFS_GQUOTA_ACCT) == 0 && - (flags & XFS_OQUOTA_ENFD))) { + (flags & XFS_GQUOTA_ENFD))) {xfs_debug (mp,"%s: Can't enforce without acct, flags=%x sbflags=%x\n" , __func__, flags, mp->m_sb.sb_qflags);
@@ -795,8 +797,8 @@ xfs_qm_export_dquot(* so return zeroes in that case. */ if ((!XFS_IS_UQUOTA_ENFORCED (mp) && src->d_flags ==XFS_DQ_USER ) || - (!XFS_IS_OQUOTA_ENFORCED (mp) && - (src->d_flags & (XFS_DQ_PROJ |XFS_DQ_GROUP )))) { + (!XFS_IS_PQUOTA_ENFORCED (mp) && src->d_flags ==XFS_DQ_PROJ ) || + (!XFS_IS_GQUOTA_ENFORCED (mp) && src->d_flags ==XFS_DQ_GROUP )) { dst->d_btimer =0 ; dst->d_itimer =0 ; dst->d_rtbtimer =0 ;
@@ -804,8 +806,8 @@ xfs_qm_export_dquot(#ifdef DEBUG if (((XFS_IS_UQUOTA_ENFORCED (mp) && dst->d_flags ==FS_USER_QUOTA ) || - (XFS_IS_OQUOTA_ENFORCED (mp) && - (dst->d_flags & (FS_PROJ_QUOTA |FS_GROUP_QUOTA )))) && + (XFS_IS_PQUOTA_ENFORCED (mp) && dst->d_flags ==FS_PROJ_QUOTA ) || + (XFS_IS_GQUOTA_ENFORCED (mp) && dst->d_flags ==FS_GROUP_QUOTA )) && dst->d_id !=0 ) {if (((int ) dst->d_bcount >= (int ) dst->d_blk_softlimit) && (dst->d_blk_softlimit >0 )) {
@@ -854,10 +856,10 @@ xfs_qm_export_flags( uflags |=FS_QUOTA_GDQ_ACCT ;if (flags &XFS_UQUOTA_ENFD ) uflags |=FS_QUOTA_UDQ_ENFD ; -if (flags & (XFS_OQUOTA_ENFD )) { - uflags |= (flags &XFS_GQUOTA_ACCT ) ? -FS_QUOTA_GDQ_ENFD :FS_QUOTA_PDQ_ENFD ; - } +if (flags &XFS_PQUOTA_ENFD ) + uflags |=FS_QUOTA_PDQ_ENFD ; +if (flags &XFS_GQUOTA_ENFD ) + uflags |=FS_QUOTA_GDQ_ENFD ;return (uflags); }
fs/xfs/xfs_quota.h +25 -11
@@ -154,19 +154,34 @@ typedef struct xfs_qoff_logformat {#define XFS_GQUOTA_ACCT 0x0040/* group quota accounting ON */ /* +* Start differentiating group quota and project quota in-core +* using distinct flags, instead of using the combined OQUOTA flags. +* +* Conversion to and from the combined OQUOTA flag (if necessary) +* is done only in xfs_sb_{to,from}_disk() +*/ +#define XFS_GQUOTA_ENFD 0x0080/* group quota limits enforced */ +#define XFS_GQUOTA_CHKD 0x0100/* quotacheck run on group quotas */ +#define XFS_PQUOTA_ENFD 0x0200/* project quota limits enforced */ +#define XFS_PQUOTA_CHKD 0x0400/* quotacheck run on project quotas */ + +/* * Quota Accounting/Enforcement flags */ #define XFS_ALL_QUOTA_ACCT \ (XFS_UQUOTA_ACCT | XFS_GQUOTA_ACCT | XFS_PQUOTA_ACCT) -#define XFS_ALL_QUOTA_ENFD (XFS_UQUOTA_ENFD | XFS_OQUOTA_ENFD) -#define XFS_ALL_QUOTA_CHKD (XFS_UQUOTA_CHKD | XFS_OQUOTA_CHKD) +#define XFS_ALL_QUOTA_ENFD \ + (XFS_UQUOTA_ENFD | XFS_GQUOTA_ENFD | XFS_PQUOTA_ENFD) +#define XFS_ALL_QUOTA_CHKD \ + (XFS_UQUOTA_CHKD | XFS_GQUOTA_CHKD | XFS_PQUOTA_CHKD)#define XFS_IS_QUOTA_RUNNING (mp) ((mp)->m_qflags & XFS_ALL_QUOTA_ACCT)#define XFS_IS_UQUOTA_RUNNING (mp) ((mp)->m_qflags & XFS_UQUOTA_ACCT)#define XFS_IS_PQUOTA_RUNNING (mp) ((mp)->m_qflags & XFS_PQUOTA_ACCT)#define XFS_IS_GQUOTA_RUNNING (mp) ((mp)->m_qflags & XFS_GQUOTA_ACCT)#define XFS_IS_UQUOTA_ENFORCED (mp) ((mp)->m_qflags & XFS_UQUOTA_ENFD) -#define XFS_IS_OQUOTA_ENFORCED (mp) ((mp)->m_qflags & XFS_OQUOTA_ENFD) +#define XFS_IS_PQUOTA_ENFORCED (mp) ((mp)->m_qflags & XFS_PQUOTA_ENFD) +#define XFS_IS_GQUOTA_ENFORCED (mp) ((mp)->m_qflags & XFS_GQUOTA_ENFD)/* * Incore only flags for quotaoff - these bits get cleared when quota(s)
@@ -262,24 +277,23 @@ typedef struct xfs_qoff_logformat { ((XFS_IS_UQUOTA_ON (mp) && \ (mp->m_sb.sb_qflags &XFS_UQUOTA_CHKD ) ==0 ) || \ (XFS_IS_GQUOTA_ON (mp) && \ - ((mp->m_sb.sb_qflags &XFS_OQUOTA_CHKD ) ==0 || \ - (mp->m_sb.sb_qflags &XFS_PQUOTA_ACCT ))) || \ + (mp->m_sb.sb_qflags &XFS_GQUOTA_CHKD ) ==0 ) || \ (XFS_IS_PQUOTA_ON (mp) && \ - ((mp->m_sb.sb_qflags &XFS_OQUOTA_CHKD ) ==0 || \ - (mp->m_sb.sb_qflags & XFS_GQUOTA_ACCT)))) + (mp->m_sb.sb_qflags & XFS_PQUOTA_CHKD) == 0))#define XFS_MOUNT_QUOTA_SET1 (XFS_UQUOTA_ACCT|XFS_UQUOTA_ENFD|\ XFS_UQUOTA_CHKD|XFS_PQUOTA_ACCT|\ - XFS_OQUOTA_ENFD|XFS_OQUOTA_CHKD) + XFS_PQUOTA_ENFD|XFS_PQUOTA_CHKD)#define XFS_MOUNT_QUOTA_SET2 (XFS_UQUOTA_ACCT|XFS_UQUOTA_ENFD|\ XFS_UQUOTA_CHKD|XFS_GQUOTA_ACCT|\ - XFS_OQUOTA_ENFD|XFS_OQUOTA_CHKD) + XFS_GQUOTA_ENFD|XFS_GQUOTA_CHKD)#define XFS_MOUNT_QUOTA_ALL (XFS_UQUOTA_ACCT|XFS_UQUOTA_ENFD|\ XFS_UQUOTA_CHKD|XFS_PQUOTA_ACCT|\ - XFS_OQUOTA_ENFD|XFS_OQUOTA_CHKD|\ - XFS_GQUOTA_ACCT) + XFS_PQUOTA_ENFD|XFS_PQUOTA_CHKD|\ + XFS_GQUOTA_ACCT|XFS_GQUOTA_ENFD|\ + XFS_GQUOTA_CHKD)/*
fs/xfs/xfs_quotaops.c +4 -2
@@ -76,8 +76,10 @@ xfs_fs_set_xstate( flags |=XFS_GQUOTA_ACCT ;if (uflags &FS_QUOTA_UDQ_ENFD ) flags |=XFS_UQUOTA_ENFD ; -if (uflags & (FS_QUOTA_PDQ_ENFD |FS_QUOTA_GDQ_ENFD )) - flags |=XFS_OQUOTA_ENFD ; +if (uflags &FS_QUOTA_PDQ_ENFD ) + flags |=XFS_PQUOTA_ENFD ; +if (uflags &FS_QUOTA_GDQ_ENFD ) + flags |=XFS_GQUOTA_ENFD ;switch (op) {case Q_XQUOTAON :
fs/xfs/xfs_super.c +8 -8
@@ -340,17 +340,17 @@ xfs_parseargs( }else if (!strcmp (this_char,MNTOPT_PQUOTA ) || !strcmp (this_char,MNTOPT_PRJQUOTA )) { mp->m_qflags |= (XFS_PQUOTA_ACCT |XFS_PQUOTA_ACTIVE | -XFS_OQUOTA_ENFD ); +XFS_PQUOTA_ENFD ); }else if (!strcmp (this_char,MNTOPT_PQUOTANOENF )) { mp->m_qflags |= (XFS_PQUOTA_ACCT |XFS_PQUOTA_ACTIVE ); - mp->m_qflags &= ~XFS_OQUOTA_ENFD ; + mp->m_qflags &= ~XFS_PQUOTA_ENFD ; }else if (!strcmp (this_char,MNTOPT_GQUOTA ) || !strcmp (this_char,MNTOPT_GRPQUOTA )) { mp->m_qflags |= (XFS_GQUOTA_ACCT |XFS_GQUOTA_ACTIVE | -XFS_OQUOTA_ENFD ); +XFS_GQUOTA_ENFD ); }else if (!strcmp (this_char,MNTOPT_GQUOTANOENF )) { mp->m_qflags |= (XFS_GQUOTA_ACCT |XFS_GQUOTA_ACTIVE ); - mp->m_qflags &= ~XFS_OQUOTA_ENFD ; + mp->m_qflags &= ~XFS_GQUOTA_ENFD ; }else if (!strcmp (this_char,MNTOPT_DELAYLOG )) { mp->m_flags |=XFS_MOUNT_DELAYLOG ; }else if (!strcmp (this_char,MNTOPT_NODELAYLOG )) {
@@ -551,12 +551,12 @@ xfs_showargs(/* Either project or group quotas can be active, not both */ if (mp->m_qflags &XFS_PQUOTA_ACCT ) { -if (mp->m_qflags &XFS_OQUOTA_ENFD ) +if (mp->m_qflags &XFS_PQUOTA_ENFD )seq_puts (m,"," MNTOPT_PRJQUOTA );else seq_puts (m,"," MNTOPT_PQUOTANOENF ); }else if (mp->m_qflags &XFS_GQUOTA_ACCT ) { -if (mp->m_qflags &XFS_OQUOTA_ENFD ) +if (mp->m_qflags &XFS_GQUOTA_ENFD )seq_puts (m,"," MNTOPT_GRPQUOTA );else seq_puts (m,"," MNTOPT_GQUOTANOENF );
@@ -1103,8 +1103,8 @@ xfs_fs_statfs(spin_unlock (&mp->m_sb_lock);if ((ip->i_d.di_flags &XFS_DIFLAG_PROJINHERIT ) || - ((mp->m_qflags & (XFS_PQUOTA_ACCT |XFS_OQUOTA_ENFD ))) == - (XFS_PQUOTA_ACCT |XFS_OQUOTA_ENFD )) + ((mp->m_qflags & (XFS_PQUOTA_ACCT |XFS_PQUOTA_ENFD ))) == + (XFS_PQUOTA_ACCT |XFS_PQUOTA_ENFD ))xfs_qm_statvfs (ip, statp);return 0 ; }
fs/xfs/xfs_trans_dquot.c +2 -2
@@ -640,8 +640,8 @@ xfs_trans_dqresv(if ((flags &XFS_QMOPT_FORCE_RES ) ==0 && dqp->q_core.d_id && ((XFS_IS_UQUOTA_ENFORCED (dqp->q_mount) &&XFS_QM_ISUDQ (dqp)) || - (XFS_IS_OQUOTA_ENFORCED (dqp->q_mount) && - (XFS_QM_ISPDQ (dqp) ||XFS_QM_ISGDQ (dqp))))) { + (XFS_IS_PQUOTA_ENFORCED (dqp->q_mount) &&XFS_QM_ISPDQ (dqp)) || + (XFS_IS_GQUOTA_ENFORCED (dqp->q_mount) &&XFS_QM_ISGDQ (dqp)))) {if (nblks >0 ) {/* * dquot is locked already. See if we'd go over the
Signature · 6 lines
1.7.1 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
RFC PATCH v2 5/5 xfs: Add a new field to fs_quota_stat to get pquota information
In reply to Chandra SeetharamanAdd a new field to fs_quota_stat and define a new version for the bigger size.
--- fs/quota/quota.c | 6 +++++- fs/xfs/xfs_qm_syscalls.c | 26 +++++++++++++------------- include/linux/dqblk_xfs.h | 28 +++++++++++++++++++++++++++- 3 files changed, 45 insertions(+), 15 deletions(-)
fs/quota/quota.c +5 -1
@@ -204,8 +204,12 @@ static int quota_getxstate(struct super_block *sb, void __user *addr)if (!sb->s_qcop->get_xstate)return -ENOSYS ; +if (copy_from_user (&fqs, addr,1 ))/* just get the version */ +return -EFAULT ; +if (!valid_qstat_version (fqs.qs_version)) + fqs.qs_version =FS_QSTAT_VERSION ; ret = sb->s_qcop->get_xstate (sb, &fqs); -if (!ret &©_to_user (addr, &fqs,sizeof (fqs))) +if (!ret &©_to_user (addr, &fqs,qstatsize (fqs.qs_version)))return -EFAULT ;return ret; }
fs/xfs/xfs_qm_syscalls.c +13 -13
@@ -425,7 +425,6 @@ xfs_qm_scall_getqstat( tempuqip = tempgqip = temppqip =B_FALSE ;memset (out,0 ,sizeof (fs_quota_stat_t)); - out->qs_version =FS_QSTAT_VERSION ;if (!xfs_sb_version_hasquota (&mp->m_sb)) { out->qs_uquota.qfs_ino =NULLFSINO ; out->qs_gquota.qfs_ino =NULLFSINO ;
@@ -438,8 +437,6 @@ xfs_qm_scall_getqstat( out->qs_pad =0 ; out->qs_uquota.qfs_ino = mp->m_sb.sb_uquotino; out->qs_gquota.qfs_ino = mp->m_sb.sb_gquotino; -if (&out->qs_gquota != &out->qs_pquota) - out->qs_pquota.qfs_ino = mp->m_sb.sb_pquotino;if (q) { uip = q->qi_uquotaip;
@@ -456,11 +453,6 @@ xfs_qm_scall_getqstat( 0, 0, &gip) == 0) tempgqip =B_TRUE ; } -if (!pip && mp->m_sb.sb_pquotino !=NULLFSINO ) { -if (xfs_iget (mp,NULL , mp->m_sb.sb_pquotino, -0 ,0 , &pip) ==0 ) - temppqip =B_TRUE ; - }if (uip) { out->qs_uquota.qfs_nblks = uip->i_d.di_nblocks; out->qs_uquota.qfs_nextents = uip->i_d.di_nextents;
@@ -473,11 +465,19 @@ xfs_qm_scall_getqstat(if (tempgqip)IRELE (gip); } -if (pip) { - out->qs_pquota.qfs_nblks = pip->i_d.di_nblocks; - out->qs_pquota.qfs_nextents = pip->i_d.di_nextents; -if (temppqip) -IRELE (pip); +if (out->qs_version >=FS_QSTAT_VERSION_2 ) { + out->qs_pquota.qfs_ino = mp->m_sb.sb_pquotino; +if (!pip && mp->m_sb.sb_pquotino !=NULLFSINO ) { +if (xfs_iget (mp,NULL , mp->m_sb.sb_pquotino, +0 ,0 , &pip) ==0 ) + temppqip =B_TRUE ; + } +if (pip) { + out->qs_pquota.qfs_nblks = pip->i_d.di_nblocks; + out->qs_pquota.qfs_nextents = pip->i_d.di_nextents; +if (temppqip) +IRELE (pip); + } }if (q) { out->qs_incoredqs = q->qi_dquots;
include/linux/dqblk_xfs.h +27 -1
@@ -18,6 +18,7 @@#define _LINUX_DQBLK_XFS_H#include <linux/types.h> +#include <linux/stddef.h> /* * Disk quota - quotactl(2) commands for the XFS Quota Manager (XQM).
@@ -139,6 +140,7 @@ typedef struct fs_disk_quota {* incore. */ #define FS_QSTAT_VERSION 1/* fs_quota_stat.qs_version */ +#define FS_QSTAT_VERSION_2 2/* new field qs_pquota */ /* * Some basic information about 'quota files'.
@@ -155,13 +157,37 @@ typedef struct fs_quota_stat {__s8 qs_pad;/* unused */ fs_qfilestat_t qs_uquota;/* user quota storage information */ fs_qfilestat_t qs_gquota;/* group quota storage information */ -#define qs_pquota qs_gquota__u32 qs_incoredqs;/* number of dquots incore */ __s32 qs_btimelimit;/* limit for blks timer */ __s32 qs_itimelimit;/* limit for inodes timer */ __s32 qs_rtbtimelimit;/* limit for rt blks timer */ __u16 qs_bwarnlimit;/* limit for num warnings */ __u16 qs_iwarnlimit;/* limit for num warnings */ + fs_qfilestat_t qs_pquota; /* project quota storage information */ } fs_quota_stat_t; +#define FS_QSTAT_V1_SIZE (offsetof(fs_quota_stat_t, qs_pquota)) +#define FS_QSTAT_V2_SIZE (FS_QSTAT_V1_SIZE + sizeof (fs_qfilestat_t)) + +static inline int valid_qstat_version (int version) +{ +switch (version) { +case FS_QSTAT_VERSION : +case FS_QSTAT_VERSION_2 : +return 1 ; +default : +return 0 ; + } +} +static inline int qstatsize (int version) +{ +switch (version) { +case FS_QSTAT_VERSION_2 : +return FS_QSTAT_V2_SIZE ; +case FS_QSTAT_VERSION : +default : +return FS_QSTAT_V1_SIZE ; + } +} +#endif /* _LINUX_DQBLK_XFS_H */
Signature · 6 lines
1.7.1 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
RFC PATCH v2 4/5 xfs: Add pquotaino to on-disk super block
In reply to Chandra SeetharamanAdd a new field to the superblock to add support for seperate pquota with a specific version.
No change made yet to gather both project and group quota with quotactl.
--- fs/xfs/xfs_itable.c | 3 +- fs/xfs/xfs_mount.c | 101 ++++++++++++++++++++++++++++++++------------ fs/xfs/xfs_qm.c | 18 +++++--- fs/xfs/xfs_qm_syscalls.c | 30 ++++++++++--- fs/xfs/xfs_quota.h | 8 ---- fs/xfs/xfs_sb.h | 20 +++++++-- fs/xfs/xfs_super.c | 15 ++++--- fs/xfs/xfs_trans_dquot.c | 4 +- include/linux/dqblk_xfs.h | 1 + 9 files changed, 139 insertions(+), 61 deletions(-)
fs/xfs/xfs_itable.c +2 -1
@@ -43,7 +43,8 @@ xfs_internal_inum( {return (ino == mp->m_sb.sb_rbmino || ino == mp->m_sb.sb_rsumino || (xfs_sb_version_hasquota (&mp->m_sb) && - (ino == mp->m_sb.sb_uquotino || ino == mp->m_sb.sb_gquotino))); + (ino == mp->m_sb.sb_uquotino || ino == mp->m_sb.sb_gquotino || + ino == mp->m_sb.sb_pquotino))); }/*
fs/xfs/xfs_mount.c +73 -28
150 lines not on this page · raw message
fs/xfs/xfs_qm.c +12 -6
@@ -777,7 +777,8 @@ xfs_qm_dqattach_locked( !XFS_IS_QUOTA_ON (mp) || !XFS_NOT_DQATTACHED (mp, ip) || ip->i_ino == mp->m_sb.sb_uquotino || - ip->i_ino == mp->m_sb.sb_gquotino) + ip->i_ino == mp->m_sb.sb_gquotino || + ip->i_ino == mp->m_sb.sb_pquotino) return 0;ASSERT (xfs_isilocked (ip,XFS_ILOCK_EXCL ));
@@ -897,6 +898,7 @@ xfs_qm_dqdetach(ASSERT (ip->i_ino != ip->i_mount->m_sb.sb_uquotino);ASSERT (ip->i_ino != ip->i_mount->m_sb.sb_gquotino); +ASSERT (ip->i_ino != ip->i_mount->m_sb.sb_pquotino);if (ip->i_udquot) {xfs_qm_dqrele (ip->i_udquot); ip->i_udquot =NULL ;
@@ -1232,19 +1234,22 @@ xfs_qm_qino_alloc(ASSERT ((sbfields & (XFS_SB_VERSIONNUM |XFS_SB_UQUOTINO |XFS_SB_GQUOTINO |XFS_SB_QFLAGS )) == (XFS_SB_VERSIONNUM |XFS_SB_UQUOTINO | -XFS_SB_GQUOTINO |XFS_SB_QFLAGS )); +XFS_SB_GQUOTINO |XFS_SB_PQUOTINO |XFS_SB_QFLAGS ));xfs_sb_version_addquota (&mp->m_sb); mp->m_sb.sb_uquotino =NULLFSINO ; mp->m_sb.sb_gquotino =NULLFSINO ; + mp->m_sb.sb_pquotino =NULLFSINO ;/* qflags will get updated _after_ quotacheck */ mp->m_sb.sb_qflags =0 ; }if (flags &XFS_QMOPT_UQUOTA ) mp->m_sb.sb_uquotino = (*ip)->i_ino; -else +else if (flags &XFS_QMOPT_GQUOTA ) mp->m_sb.sb_gquotino = (*ip)->i_ino; +else + mp->m_sb.sb_pquotino = (*ip)->i_ino;spin_unlock (&mp->m_sb_lock);xfs_mod_sb (tp, sbfields);
@@ -1551,7 +1556,8 @@ xfs_qm_dqusage_adjust(* rootino must have its resources accounted for, not so with the quota * inodes. */ -if (ino == mp->m_sb.sb_uquotino || ino == mp->m_sb.sb_gquotino) { +if (ino == mp->m_sb.sb_uquotino || ino == mp->m_sb.sb_gquotino || + ino == mp->m_sb.sb_pquotino) { *res =BULKSTAT_RV_NOTHING ;return XFS_ERROR (EINVAL ); }
@@ -1810,7 +1816,7 @@ xfs_qm_init_quotainos( }else { flags |=XFS_QMOPT_SBVERSION ; sbflags |= (XFS_SB_VERSIONNUM |XFS_SB_UQUOTINO | -XFS_SB_GQUOTINO |XFS_SB_QFLAGS ); +XFS_SB_GQUOTINO |XFS_SB_PQUOTINO |XFS_SB_QFLAGS ); }/*
@@ -1840,7 +1846,7 @@ xfs_qm_init_quotainos( }if (XFS_IS_PQUOTA_ON (mp) && pip ==NULL ) { error =xfs_qm_qino_alloc (mp, &pip, - sbflags |XFS_SB_GQUOTINO , + sbflags |XFS_SB_PQUOTINO , flags |XFS_QMOPT_PQUOTA );if (error) {if (uip)
fs/xfs/xfs_qm_syscalls.c +23 -7
@@ -209,8 +209,7 @@ xfs_qm_scall_quotaoff(/* * If quotas is completely disabled, close shop. */ -if (((flags &XFS_MOUNT_QUOTA_ALL ) ==XFS_MOUNT_QUOTA_SET1 ) || - ((flags &XFS_MOUNT_QUOTA_ALL ) ==XFS_MOUNT_QUOTA_SET2 )) { +if ((flags &XFS_MOUNT_QUOTA_ALL ) ==XFS_MOUNT_QUOTA_ALL ) {mutex_unlock (&q->qi_quotaofflock);xfs_qm_destroy_quotainfo (mp);return (0 );
@@ -300,8 +299,10 @@ xfs_qm_scall_trunc_qfiles(if (flags &XFS_DQ_USER ) error =xfs_qm_scall_trunc_qfile (mp, mp->m_sb.sb_uquotino); -if (flags & (XFS_DQ_GROUP |XFS_DQ_PROJ )) +if (flags &XFS_DQ_GROUP ) error2 =xfs_qm_scall_trunc_qfile (mp, mp->m_sb.sb_gquotino); +if (flags &XFS_DQ_PROJ ) + error2 =xfs_qm_scall_trunc_qfile (mp, mp->m_sb.sb_pquotino);return error ? error : error2; }
@@ -417,17 +418,18 @@ xfs_qm_scall_getqstat( struct fs_quota_stat *out) {struct xfs_quotainfo *q = mp->m_quotainfo; -struct xfs_inode *uip, *gip; -boolean_t tempuqip, tempgqip; +struct xfs_inode *uip, *gip, *pip; +boolean_t tempuqip, tempgqip, temppqip; - uip = gip =NULL ; - tempuqip = tempgqip =B_FALSE ; + uip = gip = pip =NULL ; + tempuqip = tempgqip = temppqip =B_FALSE ;memset (out,0 ,sizeof (fs_quota_stat_t)); out->qs_version =FS_QSTAT_VERSION ;if (!xfs_sb_version_hasquota (&mp->m_sb)) { out->qs_uquota.qfs_ino =NULLFSINO ; out->qs_gquota.qfs_ino =NULLFSINO ; + out->qs_pquota.qfs_ino =NULLFSINO ;return (0 ); } out->qs_flags = (__uint16_t) xfs_qm_export_flags(mp->m_qflags &
@@ -436,10 +438,13 @@ xfs_qm_scall_getqstat( out->qs_pad =0 ; out->qs_uquota.qfs_ino = mp->m_sb.sb_uquotino; out->qs_gquota.qfs_ino = mp->m_sb.sb_gquotino; +if (&out->qs_gquota != &out->qs_pquota) + out->qs_pquota.qfs_ino = mp->m_sb.sb_pquotino;if (q) { uip = q->qi_uquotaip; gip = q->qi_gquotaip; + pip = q->qi_pquotaip; }if (!uip && mp->m_sb.sb_uquotino !=NULLFSINO ) { if (xfs_iget(mp, NULL, mp->m_sb.sb_uquotino,
@@ -451,6 +456,11 @@ xfs_qm_scall_getqstat( 0, 0, &gip) == 0) tempgqip =B_TRUE ; } +if (!pip && mp->m_sb.sb_pquotino !=NULLFSINO ) { +if (xfs_iget (mp,NULL , mp->m_sb.sb_pquotino, +0 ,0 , &pip) ==0 ) + temppqip =B_TRUE ; + }if (uip) { out->qs_uquota.qfs_nblks = uip->i_d.di_nblocks; out->qs_uquota.qfs_nextents = uip->i_d.di_nextents;
@@ -463,6 +473,12 @@ xfs_qm_scall_getqstat(if (tempgqip)IRELE (gip); } +if (pip) { + out->qs_pquota.qfs_nblks = pip->i_d.di_nblocks; + out->qs_pquota.qfs_nextents = pip->i_d.di_nextents; +if (temppqip) +IRELE (pip); + }if (q) { out->qs_incoredqs = q->qi_dquots; out->qs_btimelimit = q->qi_btimelimit;
fs/xfs/xfs_quota.h +0 -8
@@ -281,14 +281,6 @@ typedef struct xfs_qoff_logformat { (XFS_IS_PQUOTA_ON(mp) && \ (mp->m_sb.sb_qflags & XFS_PQUOTA_CHKD) == 0)) -#define XFS_MOUNT_QUOTA_SET1 (XFS_UQUOTA_ACCT|XFS_UQUOTA_ENFD|\ - XFS_UQUOTA_CHKD|XFS_PQUOTA_ACCT|\ - XFS_PQUOTA_ENFD|XFS_PQUOTA_CHKD) - -#define XFS_MOUNT_QUOTA_SET2 (XFS_UQUOTA_ACCT|XFS_UQUOTA_ENFD|\ - XFS_UQUOTA_CHKD|XFS_GQUOTA_ACCT|\ - XFS_GQUOTA_ENFD|XFS_GQUOTA_CHKD) -#define XFS_MOUNT_QUOTA_ALL (XFS_UQUOTA_ACCT|XFS_UQUOTA_ENFD|\ XFS_UQUOTA_CHKD|XFS_PQUOTA_ACCT|\ XFS_PQUOTA_ENFD|XFS_PQUOTA_CHKD|\
fs/xfs/xfs_sb.h +16 -4
@@ -81,11 +81,15 @@ struct xfs_mount;#define XFS_SB_VERSION2_ATTR2BIT 0x00000008/* Inline attr rework */ #define XFS_SB_VERSION2_PARENTBIT 0x00000010/* parent pointers */ #define XFS_SB_VERSION2_PROJID32BIT 0x00000080/* 32 bit project id */ +#define XFS_SB_VERSION2_NO_OQUOTA 0x00000100/* No OQUOTA and * +* separate project * +* quota field */ #define XFS_SB_VERSION2_OKREALFBITS \ (XFS_SB_VERSION2_LAZYSBCOUNTBIT | \ XFS_SB_VERSION2_ATTR2BIT | \ - XFS_SB_VERSION2_PROJID32BIT) + XFS_SB_VERSION2_PROJID32BIT | \ + XFS_SB_VERSION2_NO_OQUOTA)#define XFS_SB_VERSION2_OKSASHFBITS \ (0)#define XFS_SB_VERSION2_OKREALBITS \
@@ -140,7 +144,6 @@ typedef struct xfs_sb {*/ xfs_ino_t sb_uquotino;/* user quota inode */ xfs_ino_t sb_gquotino;/* group quota inode */ -#define sb_pquotino sb_gquotino__uint16_t sb_qflags;/* quota flags */ __uint8_t sb_flags;/* misc. flags */ __uint8_t sb_shared_vn;/* shared version number */
@@ -160,6 +163,7 @@ typedef struct xfs_sb {* it for anything else. */ __uint32_t sb_bad_features2; +xfs_ino_t sb_pquotino;/* project quota inode */ /* must be padded to 64 bit alignment */ } xfs_sb_t;
@@ -230,6 +234,7 @@ typedef struct xfs_dsb {* it for anything else. */ __be32 sb_bad_features2; +__be64 sb_pquotino;/* project quota inode */ /* must be padded to 64 bit alignment */ } xfs_dsb_t;
@@ -250,7 +255,7 @@ typedef enum {XFS_SBS_GQUOTINO ,XFS_SBS_QFLAGS ,XFS_SBS_FLAGS ,XFS_SBS_SHARED_VN ,XFS_SBS_INOALIGNMT ,XFS_SBS_UNIT ,XFS_SBS_WIDTH ,XFS_SBS_DIRBLKLOG ,XFS_SBS_LOGSECTLOG ,XFS_SBS_LOGSECTSIZE ,XFS_SBS_LOGSUNIT , -XFS_SBS_FEATURES2 ,XFS_SBS_BAD_FEATURES2 , +XFS_SBS_FEATURES2 ,XFS_SBS_BAD_FEATURES2 ,XFS_SBS_PQUOTINO , XFS_SBS_FIELDCOUNT } xfs_sb_field_t;
@@ -276,6 +281,7 @@ typedef enum {#define XFS_SB_FDBLOCKS XFS_SB_MVAL(FDBLOCKS)#define XFS_SB_FEATURES2 XFS_SB_MVAL(FEATURES2)#define XFS_SB_BAD_FEATURES2 XFS_SB_MVAL(BAD_FEATURES2) +#define XFS_SB_PQUOTINO XFS_SB_MVAL(PQUOTINO)#define XFS_SB_NUM_BITS ((int)XFS_SBS_FIELDCOUNT)#define XFS_SB_ALL_BITS ((1LL << XFS_SB_NUM_BITS) - 1)#define XFS_SB_MOD_BITS \
@@ -283,7 +289,7 @@ typedef enum {XFS_SB_VERSIONNUM |XFS_SB_UQUOTINO |XFS_SB_GQUOTINO | \XFS_SB_QFLAGS |XFS_SB_SHARED_VN |XFS_SB_UNIT |XFS_SB_WIDTH | \XFS_SB_ICOUNT |XFS_SB_IFREE |XFS_SB_FDBLOCKS |XFS_SB_FEATURES2 | \ - XFS_SB_BAD_FEATURES2) + XFS_SB_BAD_FEATURES2 | XFS_SB_PQUOTINO)/*
@@ -504,6 +510,12 @@ static inline int xfs_sb_version_hasprojid32bit(xfs_sb_t *sbp) (sbp->sb_features2 &XFS_SB_VERSION2_PROJID32BIT ); } +static inline int xfs_sb_version_has_no_oquota (xfs_sb_t *sbp) +{ +return xfs_sb_version_hasmorebits (sbp) && + (sbp->sb_features2 &XFS_SB_VERSION2_NO_OQUOTA ); +} +/* * end of superblock version macros */
fs/xfs/xfs_super.c +9 -6
@@ -408,12 +408,6 @@ xfs_parseargs( }#endif -if ((mp->m_qflags & (XFS_GQUOTA_ACCT |XFS_GQUOTA_ACTIVE )) && - (mp->m_qflags & (XFS_PQUOTA_ACCT |XFS_PQUOTA_ACTIVE ))) { -xfs_warn (mp,"cannot mount with both project and group quota" ); -return EINVAL ; - } -if ((dsunit && !dswidth) || (!dsunit && dswidth)) {xfs_warn (mp,"sunit and swidth must be specified together" );return EINVAL ;
@@ -1359,6 +1353,15 @@ xfs_fs_fill_super(if (error) goto out_destroy_counters; +if ((mp->m_qflags & (XFS_GQUOTA_ACCT |XFS_GQUOTA_ACTIVE )) && + (mp->m_qflags & (XFS_PQUOTA_ACCT |XFS_PQUOTA_ACTIVE )) && + !xfs_sb_version_has_no_oquota (&mp->m_sb)) { +xfs_warn (mp,"Super block does not support " +"project and group quota together" ); + error =EINVAL ; + goto out_free_sb; + } + error =xfs_finish_flags (mp);if (error) goto out_free_sb;
fs/xfs/xfs_trans_dquot.c +3 -1
@@ -165,7 +165,8 @@ xfs_trans_mod_dquot_byino(if (!XFS_IS_QUOTA_RUNNING (mp) || !XFS_IS_QUOTA_ON (mp) || ip->i_ino == mp->m_sb.sb_uquotino || - ip->i_ino == mp->m_sb.sb_gquotino) + ip->i_ino == mp->m_sb.sb_gquotino || + ip->i_ino == mp->m_sb.sb_pquotino)return ;if (tp->t_dqinfo ==NULL )
@@ -858,6 +859,7 @@ xfs_trans_reserve_quota_nblks(ASSERT (ip->i_ino != mp->m_sb.sb_uquotino);ASSERT (ip->i_ino != mp->m_sb.sb_gquotino); +ASSERT (ip->i_ino != mp->m_sb.sb_pquotino);ASSERT (xfs_isilocked (ip,XFS_ILOCK_EXCL )); ASSERT((flags & ~(XFS_QMOPT_FORCE_RES | XFS_QMOPT_ENOSPC)) ==
include/linux/dqblk_xfs.h +1 -0
@@ -155,6 +155,7 @@ typedef struct fs_quota_stat {__s8 qs_pad;/* unused */ fs_qfilestat_t qs_uquota;/* user quota storage information */ fs_qfilestat_t qs_gquota;/* group quota storage information */ +#define qs_pquota qs_gquota__u32 qs_incoredqs;/* number of dquots incore */ __s32 qs_btimelimit;/* limit for blks timer */ __s32 qs_itimelimit;/* limit for inodes timer */
Signature · 6 lines
1.7.1 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [RFC v2 PATCH 1/5] xfs: Prep work for supporting both pquota and gquota.
In reply to Chandra SeetharamanQuoted 2 lines · Chandra Seetharaman
Define few macros, inline functions, and change interface in preparation for allowing pquota and gquota to be used together.
Looks good, but I'd really prefer to split this up further:
- one patch for adding xfs_inode_dquot
- one patch for adding XFS_IS_TYPE_QUOTA_ON
(which I'd rather make an inline and call xfs_this_quota_on)
- one for passing the mount structure to xfs_sb_from_disk
- one for the quota flags changes.
All of these also should have a good changelog, most importantly the flag changes. If you can repost just these changes relatively soon please do so, as I have a huge series for the quota code that should go into the 3.2 tree which I need to rebase anyway, and I'd like to do it on top of your changes.
fs/xfs/xfs_mount.c out_unwind: · line 560
Quoted 6 lines
fs/xfs/xfs_mount.c +3
-1- xfs_sb_t *to, + xfs_mount_t *mp, xfs_dsb_t *from) { +xfs_sb_t *to = &mp->m_sb; +
For code you touch please always use the struct versions instead of the typedefs for lines you change anyway or add.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [RFC v2 PATCH 1/5] xfs: Prep work for supporting both pquota and gquota.
Sure.
Will submit this as a separate set, so that it can go in faster.
Chandra
Quoted 28 lines · Christoph Hellwig
Quoted 2 lines · Chandra Seetharaman
Define few macros, inline functions, and change interface in preparation for allowing pquota and gquota to be used together.
Looks good, but I'd really prefer to split this up further:
- one patch for adding
xfs_inode_dquot
- one patch for addingXFS_IS_TYPE_QUOTA_ON
(which I'd rather make an inline and callxfs_this_quota_on)
- one for passing the mount structure toxfs_sb_from_disk
- one for the quota flags changes.All of these also should have a good changelog, most importantly the flag changes. If you can repost just these changes relatively soon please do so, as I have a huge series for the quota code that should go into the 3.2 tree which I need to rebase anyway, and I'd like to do it on top of your changes.
fs/xfs/xfs_mount.c out_unwind: · line 560
Quoted 6 lines
fs/xfs/xfs_mount.c +3
-1- xfs_sb_t *to, + xfs_mount_t *mp, xfs_dsb_t *from) { +xfs_sb_t *to = &mp->m_sb; +For code you touch please always use the struct versions instead of the typedefs for lines you change anyway or add.
Quoted 5 lines
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs