* [PATCH 0/4] xfsprogs: Allow pquota and gquota to be used together
@ 2012-01-23 17:32 Chandra Seetharaman
2012-01-23 17:32 ` [PATCH 1/4] xfsprogs: Remove incore use of XFS_OQUOTA_ENFD and XFS_OQUOTA_CHKD Chandra Seetharaman
` (3 more replies)
0 siblings, 4 replies; 11+ messages in thread
From: Chandra Seetharaman @ 2012-01-23 17:32 UTC (permalink / raw)
To: xfs; +Cc: Chandra Seetharaman
Hello All,
These are the set of changes that are need to the user space code
to support pquota and gquota together.
Regards,
chandra
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 11+ messages in thread* [PATCH 1/4] xfsprogs: Remove incore use of XFS_OQUOTA_ENFD and XFS_OQUOTA_CHKD 2012-01-23 17:32 [PATCH 0/4] xfsprogs: Allow pquota and gquota to be used together Chandra Seetharaman @ 2012-01-23 17:32 ` Chandra Seetharaman 2012-05-03 20:04 ` Ben Myers 2012-01-23 17:32 ` [PATCH 2/4] xfsprogs: Add new field pquotaino to on disk superblock Chandra Seetharaman ` (2 subsequent siblings) 3 siblings, 1 reply; 11+ messages in thread From: Chandra Seetharaman @ 2012-01-23 17:32 UTC (permalink / raw) To: xfs; +Cc: Chandra Seetharaman >From ba28fc49821079a734f24af05671155f6b32b20c Mon Sep 17 00:00:00 2001 From: Chandra Seetharaman <sekharan@us.ibm.com> Date: Tue, 13 Dec 2011 15:55:34 -0600 Subject: [PATCH 1/4] Remove 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 yet. On-disk copy still uses XFS_OQUOTA_ENFD and XFS_OQUOTA_CHKD. Signed-off-by: Chandra Seetharaman <sekharan@us.ibm.com> --- db/check.c | 8 ++++---- include/xfs_quota.h | 47 +++++++++++++++++++++++++++++++++-------------- include/xfs_sb.h | 17 ++++++++++++++++- repair/versions.c | 18 ++++-------------- repair/xfs_repair.c | 4 ++-- 5 files changed, 59 insertions(+), 35 deletions(-) diff --git a/db/check.c b/db/check.c index e601e0a..f00fae7 100644 --- a/db/check.c +++ b/db/check.c @@ -2883,11 +2883,11 @@ process_inode( process_quota(IS_USER_QUOTA, id, blkmap); else if (id->ino == mp->m_sb.sb_gquotino && (mp->m_sb.sb_qflags & XFS_GQUOTA_ACCT) && - (mp->m_sb.sb_qflags & XFS_OQUOTA_CHKD)) + (mp->m_sb.sb_qflags & XFS_GQUOTA_CHKD)) process_quota(IS_GROUP_QUOTA, id, blkmap); else if (id->ino == mp->m_sb.sb_gquotino && (mp->m_sb.sb_qflags & XFS_PQUOTA_ACCT) && - (mp->m_sb.sb_qflags & XFS_OQUOTA_CHKD)) + (mp->m_sb.sb_qflags & XFS_PQUOTA_CHKD)) process_quota(IS_PROJECT_QUOTA, id, blkmap); } if (blkmap) @@ -3896,11 +3896,11 @@ quota_init(void) qgdo = mp->m_sb.sb_gquotino != 0 && mp->m_sb.sb_gquotino != NULLFSINO && (mp->m_sb.sb_qflags & XFS_GQUOTA_ACCT) && - (mp->m_sb.sb_qflags & XFS_OQUOTA_CHKD); + (mp->m_sb.sb_qflags & XFS_GQUOTA_CHKD); qpdo = mp->m_sb.sb_gquotino != 0 && mp->m_sb.sb_gquotino != NULLFSINO && (mp->m_sb.sb_qflags & XFS_PQUOTA_ACCT) && - (mp->m_sb.sb_qflags & XFS_OQUOTA_CHKD); + (mp->m_sb.sb_qflags & XFS_PQUOTA_CHKD); if (qudo) qudata = xcalloc(QDATA_HASH_SIZE, sizeof(qdata_t *)); if (qgdo) diff --git a/include/xfs_quota.h b/include/xfs_quota.h index 5d1f57d..aa583a3 100644 --- a/include/xfs_quota.h +++ b/include/xfs_quota.h @@ -154,19 +154,42 @@ 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 */ + +#define XFS_VALID_QFLAGS(sbp) (xfs_sb_version_hasnooquota(sbp) ? \ + (XFS_UQUOTA_ACCT|XFS_UQUOTA_ENFD|XFS_UQUOTA_CHKD| \ + XFS_GQUOTA_ACCT|XFS_GQUOTA_ENFD|XFS_GQUOTA_CHKD| \ + XFS_PQUOTA_ACCT|XFS_PQUOTA_ENFD|XFS_PQUOTA_CHKD) : \ + (XFS_UQUOTA_ACCT|XFS_UQUOTA_ENFD|XFS_UQUOTA_CHKD| \ + XFS_GQUOTA_ACCT|XFS_OQUOTA_ENFD|XFS_OQUOTA_CHKD| \ + XFS_PQUOTA_ACCT)) + +/* * 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_GQUOTA_ENFORCED(mp) ((mp)->m_qflags & XFS_GQUOTA_ENFD) +#define XFS_IS_PQUOTA_ENFORCED(mp) ((mp)->m_qflags & XFS_PQUOTA_ENFD) /* * Incore only flags for quotaoff - these bits get cleared when quota(s) @@ -184,8 +207,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) @@ -260,25 +281,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) /* * The structure kept inside the xfs_trans_t keep track of dquot changes diff --git a/include/xfs_sb.h b/include/xfs_sb.h index 5dcc2d7..69c6822 100644 --- a/include/xfs_sb.h +++ b/include/xfs_sb.h @@ -81,11 +81,13 @@ 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 /* sep prj quota inode */ #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 \ @@ -510,6 +512,19 @@ static inline void xfs_sb_version_addprojid32bit(xfs_sb_t *sbp) sbp->sb_bad_features2 |= XFS_SB_VERSION2_PROJID32BIT; } +static inline int xfs_sb_version_hasnooquota(xfs_sb_t *sbp) +{ + return xfs_sb_version_hasmorebits(sbp) && + (sbp->sb_features2 & XFS_SB_VERSION2_NO_OQUOTA); +} + +static inline void xfs_sb_version_addnooquota(xfs_sb_t *sbp) +{ + sbp->sb_versionnum |= XFS_SB_VERSION_MOREBITSBIT; + sbp->sb_features2 |= XFS_SB_VERSION2_PROJID32BIT; + sbp->sb_bad_features2 |= XFS_SB_VERSION2_NO_OQUOTA; +} + /* * end of superblock version macros */ diff --git a/repair/versions.c b/repair/versions.c index 957766a..e37eb10 100644 --- a/repair/versions.c +++ b/repair/versions.c @@ -61,26 +61,16 @@ update_sb_version(xfs_mount_t *mp) /* * protect against stray bits in the quota flag field */ - if (sb->sb_qflags & ~(XFS_UQUOTA_ACCT|XFS_UQUOTA_ENFD| - XFS_UQUOTA_CHKD|XFS_GQUOTA_ACCT| - XFS_OQUOTA_ENFD|XFS_OQUOTA_CHKD| - XFS_PQUOTA_ACCT)) { + if (sb->sb_qflags & ~XFS_VALID_QFLAGS(sb)) { /* * update the incore superblock, if we're in * no_modify mode, it'll never get flushed out * so this is ok. */ do_warn(_("bogus quota flags 0x%x set in superblock"), - sb->sb_qflags & ~(XFS_UQUOTA_ACCT| - XFS_UQUOTA_ENFD| - XFS_UQUOTA_CHKD|XFS_GQUOTA_ACCT| - XFS_OQUOTA_ENFD|XFS_OQUOTA_CHKD| - XFS_PQUOTA_ACCT)); + sb->sb_qflags & ~XFS_VALID_QFLAGS(sb)); - sb->sb_qflags &= (XFS_UQUOTA_ACCT|XFS_UQUOTA_ENFD| - XFS_UQUOTA_CHKD|XFS_GQUOTA_ACCT| - XFS_OQUOTA_ENFD|XFS_OQUOTA_CHKD| - XFS_PQUOTA_ACCT); + sb->sb_qflags &= XFS_VALID_QFLAGS(sb); if (!no_modify) do_warn(_(", bogus flags will be cleared\n")); diff --git a/repair/xfs_repair.c b/repair/xfs_repair.c index 69b7eab..0b82e8e 100644 --- a/repair/xfs_repair.c +++ b/repair/xfs_repair.c @@ -856,10 +856,10 @@ _("Warning: project quota information would be cleared.\n" dsb = XFS_BUF_TO_SBP(sbp); - if (be16_to_cpu(dsb->sb_qflags) & (XFS_UQUOTA_CHKD | XFS_OQUOTA_CHKD)) { + if (be16_to_cpu(dsb->sb_qflags) & (XFS_ALL_QUOTA_CHKD | XFS_OQUOTA_CHKD)) { do_warn(_("Note - quota info will be regenerated on next " "quota mount.\n")); - dsb->sb_qflags &= cpu_to_be16(~(XFS_UQUOTA_CHKD | + dsb->sb_qflags &= cpu_to_be16(~(XFS_ALL_QUOTA_CHKD | XFS_OQUOTA_CHKD)); } -- 1.7.1 _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 1/4] xfsprogs: Remove incore use of XFS_OQUOTA_ENFD and XFS_OQUOTA_CHKD 2012-01-23 17:32 ` [PATCH 1/4] xfsprogs: Remove incore use of XFS_OQUOTA_ENFD and XFS_OQUOTA_CHKD Chandra Seetharaman @ 2012-05-03 20:04 ` Ben Myers 2012-05-03 20:26 ` Chandra Seetharaman 0 siblings, 1 reply; 11+ messages in thread From: Ben Myers @ 2012-05-03 20:04 UTC (permalink / raw) To: Chandra Seetharaman; +Cc: xfs On Mon, Jan 23, 2012 at 11:32:49AM -0600, Chandra Seetharaman wrote: > >From ba28fc49821079a734f24af05671155f6b32b20c Mon Sep 17 00:00:00 2001 > From: Chandra Seetharaman <sekharan@us.ibm.com> > Date: Tue, 13 Dec 2011 15:55:34 -0600 > Subject: [PATCH 1/4] Remove 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 yet. On-disk are The > copy still uses XFS_OQUOTA_ENFD and XFS_OQUOTA_CHKD. > > Signed-off-by: Chandra Seetharaman <sekharan@us.ibm.com> > --- > db/check.c | 8 ++++---- > include/xfs_quota.h | 47 +++++++++++++++++++++++++++++++++-------------- > include/xfs_sb.h | 17 ++++++++++++++++- > repair/versions.c | 18 ++++-------------- > repair/xfs_repair.c | 4 ++-- > 5 files changed, 59 insertions(+), 35 deletions(-) > > diff --git a/db/check.c b/db/check.c > index e601e0a..f00fae7 100644 > --- a/db/check.c > +++ b/db/check.c > @@ -2883,11 +2883,11 @@ process_inode( > process_quota(IS_USER_QUOTA, id, blkmap); > else if (id->ino == mp->m_sb.sb_gquotino && > (mp->m_sb.sb_qflags & XFS_GQUOTA_ACCT) && > - (mp->m_sb.sb_qflags & XFS_OQUOTA_CHKD)) > + (mp->m_sb.sb_qflags & XFS_GQUOTA_CHKD)) > process_quota(IS_GROUP_QUOTA, id, blkmap); > else if (id->ino == mp->m_sb.sb_gquotino && > (mp->m_sb.sb_qflags & XFS_PQUOTA_ACCT) && > - (mp->m_sb.sb_qflags & XFS_OQUOTA_CHKD)) > + (mp->m_sb.sb_qflags & XFS_PQUOTA_CHKD)) > process_quota(IS_PROJECT_QUOTA, id, blkmap); > } > if (blkmap) > @@ -3896,11 +3896,11 @@ quota_init(void) > qgdo = mp->m_sb.sb_gquotino != 0 && > mp->m_sb.sb_gquotino != NULLFSINO && > (mp->m_sb.sb_qflags & XFS_GQUOTA_ACCT) && > - (mp->m_sb.sb_qflags & XFS_OQUOTA_CHKD); > + (mp->m_sb.sb_qflags & XFS_GQUOTA_CHKD); > qpdo = mp->m_sb.sb_gquotino != 0 && > mp->m_sb.sb_gquotino != NULLFSINO && > (mp->m_sb.sb_qflags & XFS_PQUOTA_ACCT) && > - (mp->m_sb.sb_qflags & XFS_OQUOTA_CHKD); > + (mp->m_sb.sb_qflags & XFS_PQUOTA_CHKD); > if (qudo) > qudata = xcalloc(QDATA_HASH_SIZE, sizeof(qdata_t *)); > if (qgdo) > diff --git a/include/xfs_quota.h b/include/xfs_quota.h > index 5d1f57d..aa583a3 100644 > --- a/include/xfs_quota.h > +++ b/include/xfs_quota.h > @@ -154,19 +154,42 @@ 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 */ > + > +#define XFS_VALID_QFLAGS(sbp) (xfs_sb_version_hasnooquota(sbp) ? \ > + (XFS_UQUOTA_ACCT|XFS_UQUOTA_ENFD|XFS_UQUOTA_CHKD| \ > + XFS_GQUOTA_ACCT|XFS_GQUOTA_ENFD|XFS_GQUOTA_CHKD| \ > + XFS_PQUOTA_ACCT|XFS_PQUOTA_ENFD|XFS_PQUOTA_CHKD) : \ > + (XFS_UQUOTA_ACCT|XFS_UQUOTA_ENFD|XFS_UQUOTA_CHKD| \ > + XFS_GQUOTA_ACCT|XFS_OQUOTA_ENFD|XFS_OQUOTA_CHKD| \ > + XFS_PQUOTA_ACCT)) > + > +/* > * 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_GQUOTA_ENFORCED(mp) ((mp)->m_qflags & XFS_GQUOTA_ENFD) > +#define XFS_IS_PQUOTA_ENFORCED(mp) ((mp)->m_qflags & XFS_PQUOTA_ENFD) > > /* > * Incore only flags for quotaoff - these bits get cleared when quota(s) > @@ -184,8 +207,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) > @@ -260,25 +281,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) > > /* > * The structure kept inside the xfs_trans_t keep track of dquot changes > diff --git a/include/xfs_sb.h b/include/xfs_sb.h > index 5dcc2d7..69c6822 100644 > --- a/include/xfs_sb.h > +++ b/include/xfs_sb.h > @@ -81,11 +81,13 @@ 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 /* sep prj quota inode */ > > #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 \ > @@ -510,6 +512,19 @@ static inline void xfs_sb_version_addprojid32bit(xfs_sb_t *sbp) > sbp->sb_bad_features2 |= XFS_SB_VERSION2_PROJID32BIT; > } > > +static inline int xfs_sb_version_hasnooquota(xfs_sb_t *sbp) IIRC, in the kernel you used xfs_sb_version_has_no_oquota. I think you should use the same name in xfsprogs. > +{ > + return xfs_sb_version_hasmorebits(sbp) && > + (sbp->sb_features2 & XFS_SB_VERSION2_NO_OQUOTA); > +} > + > +static inline void xfs_sb_version_addnooquota(xfs_sb_t *sbp) > +{ > + sbp->sb_versionnum |= XFS_SB_VERSION_MOREBITSBIT; > + sbp->sb_features2 |= XFS_SB_VERSION2_PROJID32BIT; I'm not sure about this. I don't think addnooquota necessarily implies a 32 bit project id. What say you? Else, the patch looks pretty good. -Ben _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/4] xfsprogs: Remove incore use of XFS_OQUOTA_ENFD and XFS_OQUOTA_CHKD 2012-05-03 20:04 ` Ben Myers @ 2012-05-03 20:26 ` Chandra Seetharaman 0 siblings, 0 replies; 11+ messages in thread From: Chandra Seetharaman @ 2012-05-03 20:26 UTC (permalink / raw) To: Ben Myers; +Cc: xfs On Thu, 2012-05-03 at 15:04 -0500, Ben Myers wrote: > On Mon, Jan 23, 2012 at 11:32:49AM -0600, Chandra Seetharaman wrote: > > >From ba28fc49821079a734f24af05671155f6b32b20c Mon Sep 17 00:00:00 2001 > > From: Chandra Seetharaman <sekharan@us.ibm.com> > > Date: Tue, 13 Dec 2011 15:55:34 -0600 > > Subject: [PATCH 1/4] Remove 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 yet. On-disk > are The > will fix > > copy still uses XFS_OQUOTA_ENFD and XFS_OQUOTA_CHKD. > < <snip> > > > > +static inline int xfs_sb_version_hasnooquota(xfs_sb_t *sbp) > > IIRC, in the kernel you used xfs_sb_version_has_no_oquota. I think you should > use the same name in xfsprogs. yes, will fix. > > > +{ > > + return xfs_sb_version_hasmorebits(sbp) && > > + (sbp->sb_features2 & XFS_SB_VERSION2_NO_OQUOTA); > > +} > > + > > +static inline void xfs_sb_version_addnooquota(xfs_sb_t *sbp) > > +{ > > + sbp->sb_versionnum |= XFS_SB_VERSION_MOREBITSBIT; > > + sbp->sb_features2 |= XFS_SB_VERSION2_PROJID32BIT; > > I'm not sure about this. I don't think addnooquota necessarily implies a 32 > bit project id. What say you? It is cut-n-paste issue, it should be XFS_SB_VERSION2_NO_OQUOTA will fix it. > > Else, the patch looks pretty good. > > -Ben > _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 2/4] xfsprogs: Add new field pquotaino to on disk superblock 2012-01-23 17:32 [PATCH 0/4] xfsprogs: Allow pquota and gquota to be used together Chandra Seetharaman 2012-01-23 17:32 ` [PATCH 1/4] xfsprogs: Remove incore use of XFS_OQUOTA_ENFD and XFS_OQUOTA_CHKD Chandra Seetharaman @ 2012-01-23 17:32 ` Chandra Seetharaman 2012-05-04 16:09 ` Ben Myers 2012-01-23 17:33 ` [PATCH 3/4] xfsprogs: Add qs_pquota to the fs_quota Chandra Seetharaman 2012-01-23 17:33 ` [PATCH 4/4] xfsprogs: Add support to mkfs to add pquotino by adding a new option Chandra Seetharaman 3 siblings, 1 reply; 11+ messages in thread From: Chandra Seetharaman @ 2012-01-23 17:32 UTC (permalink / raw) To: xfs; +Cc: Chandra Seetharaman >From e0df4087facfd89e59183f4b8003196396d1a6d3 Mon Sep 17 00:00:00 2001 From: Chandra Seetharaman <sekharan@us.ibm.com> Date: Tue, 13 Dec 2011 16:06:33 -0600 Subject: [PATCH 2/4] Add a new field sb_pquotino to the on-disk superblock data structure and add accompanying code. Signed-off-by: Chandra Seetharaman <sekharan@us.ibm.com> --- db/check.c | 12 +++++++----- db/dquot.c | 7 +++---- db/frag.c | 3 ++- db/inode.c | 3 ++- db/metadump.c | 5 ++++- db/sb.c | 1 + include/xfs_sb.h | 7 +++++-- libxfs/xfs_mount.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ repair/agheader.c | 13 +++++++++++++ repair/dinode.c | 9 +++++++++ repair/dir.c | 22 ++++++++++++++++++++++ repair/dir2.c | 5 +++++ repair/globals.h | 1 + repair/phase4.c | 29 ++++++++++++++++++++++------- repair/phase6.c | 9 +++++++++ repair/sb.c | 3 +++ repair/versions.c | 5 +++++ repair/xfs_repair.c | 2 +- 18 files changed, 165 insertions(+), 22 deletions(-) diff --git a/db/check.c b/db/check.c index f00fae7..f5b8b9f 100644 --- a/db/check.c +++ b/db/check.c @@ -1831,7 +1831,8 @@ init( if (mp->m_sb.sb_inoalignmt) sbversion |= XFS_SB_VERSION_ALIGNBIT; if ((mp->m_sb.sb_uquotino && mp->m_sb.sb_uquotino != NULLFSINO) || - (mp->m_sb.sb_gquotino && mp->m_sb.sb_gquotino != NULLFSINO)) + (mp->m_sb.sb_gquotino && mp->m_sb.sb_gquotino != NULLFSINO) || + (mp->m_sb.sb_pquotino && mp->m_sb.sb_pquotino != NULLFSINO)) sbversion |= XFS_SB_VERSION_QUOTABIT; quota_init(); return 1; @@ -2764,7 +2765,8 @@ process_inode( addlink_inode(id); } else if (id->ino == mp->m_sb.sb_uquotino || - id->ino == mp->m_sb.sb_gquotino) { + id->ino == mp->m_sb.sb_gquotino || + id->ino == mp->m_sb.sb_pquotino) { type = DBM_QUOTA; blkmap = blkmap_alloc(idic.di_nextents); addlink_inode(id); @@ -2885,7 +2887,7 @@ process_inode( (mp->m_sb.sb_qflags & XFS_GQUOTA_ACCT) && (mp->m_sb.sb_qflags & XFS_GQUOTA_CHKD)) process_quota(IS_GROUP_QUOTA, id, blkmap); - else if (id->ino == mp->m_sb.sb_gquotino && + else if (id->ino == mp->m_sb.sb_pquotino && (mp->m_sb.sb_qflags & XFS_PQUOTA_ACCT) && (mp->m_sb.sb_qflags & XFS_PQUOTA_CHKD)) process_quota(IS_PROJECT_QUOTA, id, blkmap); @@ -3897,8 +3899,8 @@ quota_init(void) mp->m_sb.sb_gquotino != NULLFSINO && (mp->m_sb.sb_qflags & XFS_GQUOTA_ACCT) && (mp->m_sb.sb_qflags & XFS_GQUOTA_CHKD); - qpdo = mp->m_sb.sb_gquotino != 0 && - mp->m_sb.sb_gquotino != NULLFSINO && + qpdo = mp->m_sb.sb_pquotino != 0 && + mp->m_sb.sb_pquotino != NULLFSINO && (mp->m_sb.sb_qflags & XFS_PQUOTA_ACCT) && (mp->m_sb.sb_qflags & XFS_PQUOTA_CHKD); if (qudo) diff --git a/db/dquot.c b/db/dquot.c index daa47a3..201d9a8 100644 --- a/db/dquot.c +++ b/db/dquot.c @@ -130,10 +130,9 @@ dquot_f( dbprintf(_("dquot command requires one %s id argument\n"), s); return 0; } - ino = (dogrp || doprj) ? mp->m_sb.sb_gquotino : mp->m_sb.sb_uquotino; - if (ino == 0 || ino == NULLFSINO || - (dogrp && (mp->m_sb.sb_qflags & XFS_PQUOTA_ACCT)) || - (doprj && (mp->m_sb.sb_qflags & XFS_GQUOTA_ACCT))) { + ino = doprj ? mp->m_sb.sb_pquotino : + dogrp ? mp->m_sb.sb_gquotino : mp->m_sb.sb_uquotino; + if (ino == 0 || ino == NULLFSINO) { dbprintf(_("no %s quota inode present\n"), s); return 0; } diff --git a/db/frag.c b/db/frag.c index 23ccfa5..2eb33d8 100644 --- a/db/frag.c +++ b/db/frag.c @@ -326,7 +326,8 @@ process_inode( skipd = 1; else if (!qflag && (ino == mp->m_sb.sb_uquotino || - ino == mp->m_sb.sb_gquotino)) + ino == mp->m_sb.sb_gquotino || + ino == mp->m_sb.sb_pquotino)) skipd = 1; else skipd = !fflag; diff --git a/db/inode.c b/db/inode.c index 036717f..ef8bdee 100644 --- a/db/inode.c +++ b/db/inode.c @@ -413,7 +413,8 @@ inode_next_type(void) else if (iocur_top->ino == mp->m_sb.sb_rsumino) return TYP_RTSUMMARY; else if (iocur_top->ino == mp->m_sb.sb_uquotino || - iocur_top->ino == mp->m_sb.sb_gquotino) + iocur_top->ino == mp->m_sb.sb_gquotino || + iocur_top->ino == mp->m_sb.sb_pquotino) return TYP_DQBLK; else return TYP_DATA; diff --git a/db/metadump.c b/db/metadump.c index c5ffddb..70aeb42 100644 --- a/db/metadump.c +++ b/db/metadump.c @@ -1940,7 +1940,10 @@ copy_sb_inodes(void) if (!copy_ino(mp->m_sb.sb_uquotino, TYP_DQBLK)) return 0; - return copy_ino(mp->m_sb.sb_gquotino, TYP_DQBLK); + if (!copy_ino(mp->m_sb.sb_gquotino, TYP_DQBLK)) + return 0; + + return copy_ino(mp->m_sb.sb_pquotino, TYP_DQBLK); } static int diff --git a/db/sb.c b/db/sb.c index 21f38c5..2bc96a9 100644 --- a/db/sb.c +++ b/db/sb.c @@ -109,6 +109,7 @@ const field_t sb_flds[] = { { "logsunit", FLDT_UINT32D, OI(OFF(logsunit)), C1, 0, TYP_NONE }, { "features2", FLDT_UINT32X, OI(OFF(features2)), C1, 0, TYP_NONE }, { "bad_features2", FLDT_UINT32X, OI(OFF(bad_features2)), C1, 0, TYP_NONE }, + { "pquotino", FLDT_INO, OI(OFF(pquotino)), C1, 0, TYP_INODE }, { NULL } }; diff --git a/include/xfs_sb.h b/include/xfs_sb.h index 69c6822..735c5eb 100644 --- a/include/xfs_sb.h +++ b/include/xfs_sb.h @@ -161,6 +161,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; @@ -231,6 +232,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; @@ -251,7 +253,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; @@ -277,6 +279,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 \ @@ -284,7 +287,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) /* diff --git a/libxfs/xfs_mount.c b/libxfs/xfs_mount.c index 32d2255..dd193ba 100644 --- a/libxfs/xfs_mount.c +++ b/libxfs/xfs_mount.c @@ -70,6 +70,7 @@ static const struct { { offsetof(xfs_sb_t, sb_logsunit), 0 }, { offsetof(xfs_sb_t, sb_features2), 0 }, { offsetof(xfs_sb_t, sb_bad_features2), 0 }, + { offsetof(xfs_sb_t, sb_pquotino), 0 }, { sizeof(xfs_sb_t), 0 } }; @@ -156,6 +157,23 @@ xfs_sb_from_disk( to->sb_logsunit = be32_to_cpu(from->sb_logsunit); to->sb_features2 = be32_to_cpu(from->sb_features2); to->sb_bad_features2 = be32_to_cpu(from->sb_bad_features2); + + if (xfs_sb_version_hasnooquota(to)) + to->sb_pquotino = be64_to_cpu(from->sb_pquotino); + else { + 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); + + if (to->sb_qflags & XFS_PQUOTA_ACCT) { + to->sb_pquotino = to->sb_gquotino; + to->sb_gquotino = 0; + } + } } /* @@ -174,11 +192,36 @@ xfs_sb_to_disk( xfs_sb_field_t f; int first; int size; + __be16 saved_qflags = 0; ASSERT(fields); if (!fields) return; + if (!xfs_sb_version_hasnooquota(from) && + (from->sb_qflags & (XFS_PQUOTA_ENFD | XFS_PQUOTA_CHKD | + XFS_GQUOTA_ENFD | XFS_GQUOTA_CHKD))) { + + if (from->sb_qflags & XFS_PQUOTA_ACCT) { + from->sb_gquotino = from->sb_pquotino; + from->sb_pquotino = 0; + } + /* + * 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; @@ -209,6 +252,14 @@ xfs_sb_to_disk( fields &= ~(1LL << f); } + /* Revert to the old saved values */ + if (saved_qflags) { + from->sb_qflags = saved_qflags; + if (from->sb_qflags & XFS_PQUOTA_ACCT) { + from->sb_pquotino = from->sb_gquotino; + from->sb_gquotino = 0; + } + } } /* diff --git a/repair/agheader.c b/repair/agheader.c index 6081b68..04474e3 100644 --- a/repair/agheader.c +++ b/repair/agheader.c @@ -331,6 +331,19 @@ secondary_sb_wack(xfs_mount_t *mp, xfs_buf_t *sbuf, xfs_sb_t *sb, rval |= XR_AG_SB_SEC; } + if (sb->sb_inprogress == 1 && sb->sb_pquotino) { + if (!no_modify) + sb->sb_pquotino = 0; + if (sb->sb_versionnum & XR_PART_SECSB_VNMASK || !do_bzero) { + rval |= XR_AG_SB; + do_warn( + _("non-null project quota inode field in superblock %d\n"), + i); + + } else + rval |= XR_AG_SB_SEC; + } + if (sb->sb_inprogress == 1 && sb->sb_qflags) { if (!no_modify) sb->sb_qflags = 0; diff --git a/repair/dinode.c b/repair/dinode.c index 9c5db99..533f287 100644 --- a/repair/dinode.c +++ b/repair/dinode.c @@ -1813,6 +1813,15 @@ process_check_sb_inodes( } return 0; } + if (lino == mp->m_sb.sb_pquotino) { + if (*type != XR_INO_DATA) { + do_warn(_("project quota inode %" PRIu64 " has bad type 0x%x\n"), + lino, dinode_fmt(dinoc)); + mp->m_sb.sb_pquotino = NULLFSINO; + return 1; + } + return 0; + } if (lino == mp->m_sb.sb_rsumino) { if (*type != XR_INO_RTSUM) { do_warn( diff --git a/repair/dir.c b/repair/dir.c index 5a58b94..892c86a 100644 --- a/repair/dir.c +++ b/repair/dir.c @@ -173,6 +173,11 @@ process_shortform_dir( _("entry in shortform dir %" PRIu64 " references group quota inode %" PRIu64 "\n"), ino, lino); junkit = 1; + } else if (lino == mp->m_sb.sb_pquotino) { + do_warn( + _("entry in shortform dir %" PRIu64 " references project quota inode %" PRIu64 "\n"), + ino, lino); + junkit = 1; } else if ((irec_p = find_inode_rec(mp, XFS_INO_TO_AGNO(mp, lino), XFS_INO_TO_AGINO(mp, lino))) != NULL) { @@ -1659,6 +1664,23 @@ _("entry #%d, bno %d in directory %" PRIu64 " references group quota inode %" PR _("\twould clear ino number in entry %d...\n"), i); } + } else if (lino == mp->m_sb.sb_pquotino) { + do_warn( +_("entry #%d, bno %d in directory %" PRIu64 " references project quota inode %" PRIu64 "\n"), + i, da_bno, ino, lino); + if (!no_modify) { + do_warn( + _("\tclearing ino number in entry %d...\n"), + i); + + lino = NULLFSINO; + xfs_dir_sf_put_dirino(&lino, &namest->inumber); + *buf_dirty = 1; + } else { + do_warn( + _("\twould clear ino number in entry %d...\n"), + i); + } } else if ((irec_p = find_inode_rec(mp, XFS_INO_TO_AGNO(mp, lino), XFS_INO_TO_AGINO(mp, lino))) != NULL) { diff --git a/repair/dir2.c b/repair/dir2.c index 7164f7f..a8a957b 100644 --- a/repair/dir2.c +++ b/repair/dir2.c @@ -932,6 +932,9 @@ process_sf_dir2( } else if (lino == mp->m_sb.sb_gquotino) { junkit = 1; junkreason = _("group quota"); + } else if (lino == mp->m_sb.sb_pquotino) { + junkit = 1; + junkreason = _("project quota"); } else if ((irec_p = find_inode_rec(mp, XFS_INO_TO_AGNO(mp, lino), XFS_INO_TO_AGINO(mp, lino))) != NULL) { @@ -1448,6 +1451,8 @@ process_dir2_data( clearreason = _("user quota"); } else if (ent_ino == mp->m_sb.sb_gquotino) { clearreason = _("group quota"); + } else if (ent_ino == mp->m_sb.sb_pquotino) { + clearreason = _("project quota"); } else { irec_p = find_inode_rec(mp, XFS_INO_TO_AGNO(mp, ent_ino), diff --git a/repair/globals.h b/repair/globals.h index 5fb8149..3d3b885 100644 --- a/repair/globals.h +++ b/repair/globals.h @@ -137,6 +137,7 @@ EXTERN int need_rsumino; EXTERN int lost_quotas; EXTERN int have_uquotino; EXTERN int have_gquotino; +EXTERN int have_pquotino; EXTERN int lost_uquotino; EXTERN int lost_gquotino; EXTERN int lost_pquotino; diff --git a/repair/phase4.c b/repair/phase4.c index 9f08486..392a864 100644 --- a/repair/phase4.c +++ b/repair/phase4.c @@ -72,12 +72,25 @@ quotino_check(xfs_mount_t *mp) if (irec == NULL || is_inode_free(irec, mp->m_sb.sb_gquotino - irec->ino_startnum)) { mp->m_sb.sb_gquotino = NULLFSINO; - if (mp->m_sb.sb_qflags & XFS_GQUOTA_ACCT) - lost_gquotino = 1; - else - lost_pquotino = 1; + lost_gquotino = 1; } else - lost_gquotino = lost_pquotino = 0; + lost_gquotino = 0; + } + + if (mp->m_sb.sb_pquotino != NULLFSINO && mp->m_sb.sb_pquotino != 0) { + if (verify_inum(mp, mp->m_sb.sb_pquotino)) + irec = NULL; + else + irec = find_inode_rec(mp, + XFS_INO_TO_AGNO(mp, mp->m_sb.sb_pquotino), + XFS_INO_TO_AGINO(mp, mp->m_sb.sb_pquotino)); + + if (irec == NULL || is_inode_free(irec, + mp->m_sb.sb_pquotino - irec->ino_startnum)) { + mp->m_sb.sb_pquotino = NULLFSINO; + lost_pquotino = 1; + } else + lost_pquotino = 0; } } @@ -105,11 +118,13 @@ quota_sb_check(xfs_mount_t *mp) if (fs_quotas && (mp->m_sb.sb_uquotino == NULLFSINO || mp->m_sb.sb_uquotino == 0) && - (mp->m_sb.sb_gquotino == NULLFSINO || mp->m_sb.sb_gquotino == 0)) { + (mp->m_sb.sb_gquotino == NULLFSINO || mp->m_sb.sb_gquotino == 0) && + (mp->m_sb.sb_pquotino == NULLFSINO || mp->m_sb.sb_pquotino == 0)) { lost_quotas = 1; fs_quotas = 0; } else if (!verify_inum(mp, mp->m_sb.sb_uquotino) && - !verify_inum(mp, mp->m_sb.sb_gquotino)) { + !verify_inum(mp, mp->m_sb.sb_gquotino) && + !verify_inum(mp, mp->m_sb.sb_pquotino)) { fs_quotas = 1; } } diff --git a/repair/phase6.c b/repair/phase6.c index 5b27cb4..17e0eb6 100644 --- a/repair/phase6.c +++ b/repair/phase6.c @@ -3564,6 +3564,15 @@ mark_standalone_inodes(xfs_mount_t *mp) - irec->ino_startnum; add_inode_reached(irec, offset); } + if (mp->m_sb.sb_pquotino + && mp->m_sb.sb_pquotino != NULLFSINO) { + irec = find_inode_rec(mp, XFS_INO_TO_AGNO(mp, + mp->m_sb.sb_pquotino), + XFS_INO_TO_AGINO(mp, mp->m_sb.sb_pquotino)); + offset = XFS_INO_TO_AGINO(mp, mp->m_sb.sb_pquotino) + - irec->ino_startnum; + add_inode_reached(irec, offset); + } } } diff --git a/repair/sb.c b/repair/sb.c index 004319f..c07a63d 100644 --- a/repair/sb.c +++ b/repair/sb.c @@ -40,6 +40,7 @@ copy_sb(xfs_sb_t *source, xfs_sb_t *dest) xfs_ino_t rsumino; xfs_ino_t uquotino; xfs_ino_t gquotino; + xfs_ino_t pquotino; __uint16_t versionnum; rootino = dest->sb_rootino; @@ -47,6 +48,7 @@ copy_sb(xfs_sb_t *source, xfs_sb_t *dest) rsumino = dest->sb_rsumino; uquotino = dest->sb_uquotino; gquotino = dest->sb_gquotino; + pquotino = dest->sb_pquotino; versionnum = dest->sb_versionnum; @@ -57,6 +59,7 @@ copy_sb(xfs_sb_t *source, xfs_sb_t *dest) dest->sb_rsumino = rsumino; dest->sb_uquotino = uquotino; dest->sb_gquotino = gquotino; + dest->sb_pquotino = pquotino; dest->sb_versionnum = versionnum; diff --git a/repair/versions.c b/repair/versions.c index e37eb10..991c05e 100644 --- a/repair/versions.c +++ b/repair/versions.c @@ -117,6 +117,7 @@ parse_sb_version(xfs_sb_t *sb) fs_has_extflgbit = 0; have_uquotino = 0; have_gquotino = 0; + have_pquotino = 0; issue_warning = 0; /* @@ -253,6 +254,10 @@ _("WARNING: you have disallowed quotas but this filesystem\n" if (sb->sb_gquotino != 0 && sb->sb_gquotino != NULLFSINO) have_gquotino = 1; + + if (sb->sb_pquotino != 0 && + sb->sb_pquotino != NULLFSINO) + have_pquotino = 1; } } diff --git a/repair/xfs_repair.c b/repair/xfs_repair.c index 0b82e8e..edc63ed 100644 --- a/repair/xfs_repair.c +++ b/repair/xfs_repair.c @@ -779,7 +779,7 @@ main(int argc, char **argv) _("Inode allocation btrees are too corrupted, skipping phases 6 and 7\n")); } - if (lost_quotas && !have_uquotino && !have_gquotino) { + if (lost_quotas && !have_uquotino && !have_gquotino && !have_pquotino) { if (!no_modify) { do_warn( _("Warning: no quota inodes were found. Quotas disabled.\n")); -- 1.7.1 _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 2/4] xfsprogs: Add new field pquotaino to on disk superblock 2012-01-23 17:32 ` [PATCH 2/4] xfsprogs: Add new field pquotaino to on disk superblock Chandra Seetharaman @ 2012-05-04 16:09 ` Ben Myers 0 siblings, 0 replies; 11+ messages in thread From: Ben Myers @ 2012-05-04 16:09 UTC (permalink / raw) To: Chandra Seetharaman; +Cc: xfs On Mon, Jan 23, 2012 at 11:32:58AM -0600, Chandra Seetharaman wrote: > >From e0df4087facfd89e59183f4b8003196396d1a6d3 Mon Sep 17 00:00:00 2001 > From: Chandra Seetharaman <sekharan@us.ibm.com> > Date: Tue, 13 Dec 2011 16:06:33 -0600 > Subject: [PATCH 2/4] Add a new field sb_pquotino to the on-disk superblock data structure > and add accompanying code. > > Signed-off-by: Chandra Seetharaman <sekharan@us.ibm.com> Looking pretty good. Again, if you could be more specific about what the patch does in your commit header it'd be helpful. ... > @@ -174,11 +192,36 @@ xfs_sb_to_disk( > xfs_sb_field_t f; > int first; > int size; > + __be16 saved_qflags = 0; > > ASSERT(fields); > if (!fields) > return; > > + if (!xfs_sb_version_hasnooquota(from) && > + (from->sb_qflags & (XFS_PQUOTA_ENFD | XFS_PQUOTA_CHKD | > + XFS_GQUOTA_ENFD | XFS_GQUOTA_CHKD))) { > + > + if (from->sb_qflags & XFS_PQUOTA_ACCT) { > + from->sb_gquotino = from->sb_pquotino; > + from->sb_pquotino = 0; > + } > + /* > + * 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; > @@ -209,6 +252,14 @@ xfs_sb_to_disk( > > fields &= ~(1LL << f); > } > + /* Revert to the old saved values */ > + if (saved_qflags) { > + from->sb_qflags = saved_qflags; > + if (from->sb_qflags & XFS_PQUOTA_ACCT) { > + from->sb_pquotino = from->sb_gquotino; > + from->sb_gquotino = 0; > + } > + } > } > I'd really prefer not modifying 'from' temporarily. If possible use a temporary variable and do the conversion manually for qflags as you have done in the kernel. _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 3/4] xfsprogs: Add qs_pquota to the fs_quota 2012-01-23 17:32 [PATCH 0/4] xfsprogs: Allow pquota and gquota to be used together Chandra Seetharaman 2012-01-23 17:32 ` [PATCH 1/4] xfsprogs: Remove incore use of XFS_OQUOTA_ENFD and XFS_OQUOTA_CHKD Chandra Seetharaman 2012-01-23 17:32 ` [PATCH 2/4] xfsprogs: Add new field pquotaino to on disk superblock Chandra Seetharaman @ 2012-01-23 17:33 ` Chandra Seetharaman 2012-05-04 16:32 ` Ben Myers 2012-01-23 17:33 ` [PATCH 4/4] xfsprogs: Add support to mkfs to add pquotino by adding a new option Chandra Seetharaman 3 siblings, 1 reply; 11+ messages in thread From: Chandra Seetharaman @ 2012-01-23 17:33 UTC (permalink / raw) To: xfs; +Cc: Chandra Seetharaman >From 9de21fc22372c3ba65a38e259aa023a74d1cae36 Mon Sep 17 00:00:00 2001 From: Chandra Seetharaman <sekharan@us.ibm.com> Date: Tue, 13 Dec 2011 16:08:19 -0600 Subject: [PATCH 3/4] Add a new field qs_pquota to the data structure fs_quota_stat and also define a new version for the same. Inform the kernel that the data structure is newer one and on return from kernel check the version and act accordingly. Signed-off-by: Chandra Seetharaman <sekharan@us.ibm.com> --- include/xqm.h | 2 ++ quota/state.c | 6 +++++- 2 files changed, 7 insertions(+), 1 deletions(-) diff --git a/include/xqm.h b/include/xqm.h index 47f58a0..24e1ea0 100644 --- a/include/xqm.h +++ b/include/xqm.h @@ -124,6 +124,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'. @@ -146,6 +147,7 @@ typedef struct fs_quota_stat { __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; #endif /* __XQM_H__ */ diff --git a/quota/state.c b/quota/state.c index 42bffc0..678699f 100644 --- a/quota/state.c +++ b/quota/state.c @@ -152,6 +152,8 @@ state_quotafile_mount( fs_quota_stat_t s; char *dev = mount->fs_name; + bzero(&s, sizeof(struct fs_quota_stat)); + s.qs_version = FS_QSTAT_VERSION_2; if (xfsquotactl(XFS_GETQSTAT, dev, type, 0, (void *)&s) < 0) { if (flags & VERBOSE_FLAG) fprintf(fp, _("%s quota are not enabled on %s\n"), @@ -168,7 +170,9 @@ state_quotafile_mount( s.qs_flags & XFS_QUOTA_GDQ_ACCT, s.qs_flags & XFS_QUOTA_GDQ_ENFD); if (type & XFS_PROJ_QUOTA) - state_qfilestat(fp, mount, XFS_PROJ_QUOTA, &s.qs_gquota, + state_qfilestat(fp, mount, XFS_PROJ_QUOTA, + (s.qs_version >= FS_QSTAT_VERSION_2) ? + &s.qs_pquota : &s.qs_gquota, s.qs_flags & XFS_QUOTA_PDQ_ACCT, s.qs_flags & XFS_QUOTA_PDQ_ENFD); -- 1.7.1 _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 3/4] xfsprogs: Add qs_pquota to the fs_quota 2012-01-23 17:33 ` [PATCH 3/4] xfsprogs: Add qs_pquota to the fs_quota Chandra Seetharaman @ 2012-05-04 16:32 ` Ben Myers 0 siblings, 0 replies; 11+ messages in thread From: Ben Myers @ 2012-05-04 16:32 UTC (permalink / raw) To: Chandra Seetharaman; +Cc: xfs On Mon, Jan 23, 2012 at 11:33:04AM -0600, Chandra Seetharaman wrote: > >From 9de21fc22372c3ba65a38e259aa023a74d1cae36 Mon Sep 17 00:00:00 2001 > From: Chandra Seetharaman <sekharan@us.ibm.com> > Date: Tue, 13 Dec 2011 16:08:19 -0600 > Subject: [PATCH 3/4] Add a new field qs_pquota to the data structure fs_quota_stat and also > define a new version for the same. > > Inform the kernel that the data structure is newer one and on return > from kernel check the version and act accordingly. > > Signed-off-by: Chandra Seetharaman <sekharan@us.ibm.com> > --- > include/xqm.h | 2 ++ > quota/state.c | 6 +++++- > 2 files changed, 7 insertions(+), 1 deletions(-) > > diff --git a/include/xqm.h b/include/xqm.h > index 47f58a0..24e1ea0 100644 > --- a/include/xqm.h > +++ b/include/xqm.h > @@ -124,6 +124,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'. > @@ -146,6 +147,7 @@ typedef struct fs_quota_stat { > __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; Yep, same stuff you did for the kernel. > #endif /* __XQM_H__ */ > diff --git a/quota/state.c b/quota/state.c > index 42bffc0..678699f 100644 > --- a/quota/state.c > +++ b/quota/state.c > @@ -152,6 +152,8 @@ state_quotafile_mount( > fs_quota_stat_t s; > char *dev = mount->fs_name; > > + bzero(&s, sizeof(struct fs_quota_stat)); > + s.qs_version = FS_QSTAT_VERSION_2; > if (xfsquotactl(XFS_GETQSTAT, dev, type, 0, (void *)&s) < 0) { > if (flags & VERBOSE_FLAG) > fprintf(fp, _("%s quota are not enabled on %s\n"), > @@ -168,7 +170,9 @@ state_quotafile_mount( > s.qs_flags & XFS_QUOTA_GDQ_ACCT, > s.qs_flags & XFS_QUOTA_GDQ_ENFD); > if (type & XFS_PROJ_QUOTA) > - state_qfilestat(fp, mount, XFS_PROJ_QUOTA, &s.qs_gquota, > + state_qfilestat(fp, mount, XFS_PROJ_QUOTA, > + (s.qs_version >= FS_QSTAT_VERSION_2) ? > + &s.qs_pquota : &s.qs_gquota, > s.qs_flags & XFS_QUOTA_PDQ_ACCT, > s.qs_flags & XFS_QUOTA_PDQ_ENFD); Ah, nice. Older kernels which do not have VERSION_2 overwrite qs_version. You'll do the right thing either way. Looks good. Reviewed-by: Ben Myers <bpm@sgi.com> _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 4/4] xfsprogs: Add support to mkfs to add pquotino by adding a new option. 2012-01-23 17:32 [PATCH 0/4] xfsprogs: Allow pquota and gquota to be used together Chandra Seetharaman ` (2 preceding siblings ...) 2012-01-23 17:33 ` [PATCH 3/4] xfsprogs: Add qs_pquota to the fs_quota Chandra Seetharaman @ 2012-01-23 17:33 ` Chandra Seetharaman 2012-05-04 16:47 ` Ben Myers 3 siblings, 1 reply; 11+ messages in thread From: Chandra Seetharaman @ 2012-01-23 17:33 UTC (permalink / raw) To: xfs; +Cc: Chandra Seetharaman >From 77152735d6bc893b3a724d7a6ff4bb747fb23aec Mon Sep 17 00:00:00 2001 From: Chandra Seetharaman <sekharan@us.ibm.com> Date: Tue, 13 Dec 2011 16:10:07 -0600 Subject: [PATCH 4/4] Add support to mkfs to have a separate inode field for project quota. Signed-off-by: Chandra Seetharaman <sekharan@us.ibm.com> --- mkfs/xfs_mkfs.c | 22 +++++++++++++++++----- mkfs/xfs_mkfs.h | 3 ++- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c index f527f3d..872a304 100644 --- a/mkfs/xfs_mkfs.c +++ b/mkfs/xfs_mkfs.c @@ -90,6 +90,8 @@ char *dopts[] = { "projinherit", #define D_EXTSZINHERIT 14 "extszinherit", +#define D_NO_OQUOTA 15 + "seppquota", NULL }; @@ -922,6 +924,7 @@ main( libxfs_init_t xi; struct fs_topology ft; int lazy_sb_counters; + int seppquota; progname = basename(argv[0]); setlocale(LC_ALL, ""); @@ -930,6 +933,7 @@ main( attrversion = 2; projid32bit = 0; + seppquota = 1; blflag = bsflag = slflag = ssflag = lslflag = lssflag = 0; blocklog = blocksize = 0; sectorlog = lsectorlog = XFS_MIN_SECTORSIZE_LOG; @@ -1178,6 +1182,14 @@ main( fsx.fsx_xflags |= \ XFS_DIFLAG_EXTSZINHERIT; break; + case D_NO_OQUOTA: + if (!value) + value = "0"; + c = atoi(value); + if (c < 0 || c > 1) + illegal(value, "d seppquota"); + seppquota = c; + break; default: unknown('d', value); } @@ -2278,7 +2290,7 @@ an AG size that is one stripe unit smaller, for example %llu.\n"), if (!qflag || Nflag) { printf(_( "meta-data=%-22s isize=%-6d agcount=%lld, agsize=%lld blks\n" - " =%-22s sectsz=%-5u attr=%u, projid32bit=%u\n" + " =%-22s sectsz=%-5u attr=%u, projid32bit=%u, seppquota=%d\n" "data =%-22s bsize=%-6u blocks=%llu, imaxpct=%u\n" " =%-22s sunit=%-6u swidth=%u blks\n" "naming =version %-14u bsize=%-6u ascii-ci=%d\n" @@ -2286,7 +2298,7 @@ an AG size that is one stripe unit smaller, for example %llu.\n"), " =%-22s sectsz=%-5u sunit=%d blks, lazy-count=%d\n" "realtime =%-22s extsz=%-6d blocks=%lld, rtextents=%lld\n"), dfile, isize, (long long)agcount, (long long)agsize, - "", sectorsize, attrversion, projid32bit, + "", sectorsize, attrversion, projid32bit, seppquota, "", blocksize, (long long)dblocks, imaxpct, "", dsunit, dswidth, dirversion, dirblocksize, nci, @@ -2330,7 +2342,7 @@ an AG size that is one stripe unit smaller, for example %llu.\n"), sbp->sb_fdblocks = dblocks - agcount * XFS_PREALLOC_BLOCKS(mp) - (loginternal ? logblocks : 0); sbp->sb_frextents = 0; /* will do a free later */ - sbp->sb_uquotino = sbp->sb_gquotino = 0; + sbp->sb_uquotino = sbp->sb_gquotino = sbp->sb_pquotino = 0; sbp->sb_qflags = 0; sbp->sb_unit = dsunit; sbp->sb_width = dswidth; @@ -2353,7 +2365,7 @@ an AG size that is one stripe unit smaller, for example %llu.\n"), sbp->sb_logsectsize = 0; } sbp->sb_features2 = XFS_SB_VERSION2_MKFS(lazy_sb_counters, - attrversion == 2, projid32bit == 1, 0); + attrversion == 2, projid32bit == 1, 0, seppquota); sbp->sb_versionnum = XFS_SB_VERSION_MKFS(iaflag, dsunit != 0, logversion == 2, attrversion == 1, (sectorsize != BBSIZE || @@ -2821,7 +2833,7 @@ usage( void ) /* blocksize */ [-b log=n|size=num]\n\ /* data subvol */ [-d agcount=n,agsize=n,file,name=xxx,size=num,\n\ (sunit=value,swidth=value|su=num,sw=num),\n\ - sectlog=n|sectsize=num\n\ + sectlog=n|sectsize=num,seppquota=0|1\n\ /* inode size */ [-i log=n|perblock=n|size=num,maxpct=n,attr=0|1|2,\n\ projid32bit=0|1]\n\ /* log subvol */ [-l agnum=n,internal,size=num,logdev=xxx,version=n\n\ diff --git a/mkfs/xfs_mkfs.h b/mkfs/xfs_mkfs.h index f25a7f3..d597bb3 100644 --- a/mkfs/xfs_mkfs.h +++ b/mkfs/xfs_mkfs.h @@ -36,11 +36,12 @@ XFS_DFL_SB_VERSION_BITS | \ 0 ) : XFS_SB_VERSION_1 ) -#define XFS_SB_VERSION2_MKFS(lazycount, attr2, projid32bit, parent) (\ +#define XFS_SB_VERSION2_MKFS(lazycount, attr2, projid32bit, parent, seppquota) (\ ((lazycount) ? XFS_SB_VERSION2_LAZYSBCOUNTBIT : 0) | \ ((attr2) ? XFS_SB_VERSION2_ATTR2BIT : 0) | \ ((projid32bit) ? XFS_SB_VERSION2_PROJID32BIT : 0) | \ ((parent) ? XFS_SB_VERSION2_PARENTBIT : 0) | \ + ((seppquota) ? XFS_SB_VERSION2_NO_OQUOTA : 0) | \ 0 ) #define XFS_DFL_BLOCKSIZE_LOG 12 /* 4096 byte blocks */ -- 1.7.1 _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 4/4] xfsprogs: Add support to mkfs to add pquotino by adding a new option. 2012-01-23 17:33 ` [PATCH 4/4] xfsprogs: Add support to mkfs to add pquotino by adding a new option Chandra Seetharaman @ 2012-05-04 16:47 ` Ben Myers 0 siblings, 0 replies; 11+ messages in thread From: Ben Myers @ 2012-05-04 16:47 UTC (permalink / raw) To: Chandra Seetharaman; +Cc: xfs On Mon, Jan 23, 2012 at 11:33:10AM -0600, Chandra Seetharaman wrote: > >From 77152735d6bc893b3a724d7a6ff4bb747fb23aec Mon Sep 17 00:00:00 2001 > From: Chandra Seetharaman <sekharan@us.ibm.com> > Date: Tue, 13 Dec 2011 16:10:07 -0600 > Subject: [PATCH 4/4] Add support to mkfs to have a separate inode field for project quota. > > Signed-off-by: Chandra Seetharaman <sekharan@us.ibm.com> > --- > mkfs/xfs_mkfs.c | 22 +++++++++++++++++----- > mkfs/xfs_mkfs.h | 3 ++- > 2 files changed, 19 insertions(+), 6 deletions(-) > > diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c > index f527f3d..872a304 100644 > --- a/mkfs/xfs_mkfs.c > +++ b/mkfs/xfs_mkfs.c > @@ -90,6 +90,8 @@ char *dopts[] = { > "projinherit", > #define D_EXTSZINHERIT 14 > "extszinherit", > +#define D_NO_OQUOTA 15 > + "seppquota", > NULL > }; > > @@ -922,6 +924,7 @@ main( > libxfs_init_t xi; > struct fs_topology ft; > int lazy_sb_counters; > + int seppquota; > > progname = basename(argv[0]); > setlocale(LC_ALL, ""); > @@ -930,6 +933,7 @@ main( > > attrversion = 2; > projid32bit = 0; > + seppquota = 1; > blflag = bsflag = slflag = ssflag = lslflag = lssflag = 0; > blocklog = blocksize = 0; > sectorlog = lsectorlog = XFS_MIN_SECTORSIZE_LOG; > @@ -1178,6 +1182,14 @@ main( > fsx.fsx_xflags |= \ > XFS_DIFLAG_EXTSZINHERIT; > break; > + case D_NO_OQUOTA: > + if (!value) > + value = "0"; I recommend that in if seppquota is passed without a value it should default to 1. A value of 0 is more apropriate if it had been named 'noseppquota'. Other than that this looks good. Reviewed-by: Ben Myers <bpm@sgi.com> _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 0/4] xfsprogs: Allow pquota and gquota to be used together @ 2012-07-20 23:03 Chandra Seetharaman 2012-07-20 23:03 ` [PATCH 1/4] xfsprogs: Remove incore use of XFS_OQUOTA_ENFD and XFS_OQUOTA_CHKD Chandra Seetharaman 0 siblings, 1 reply; 11+ messages in thread From: Chandra Seetharaman @ 2012-07-20 23:03 UTC (permalink / raw) To: xfs; +Cc: Chandra Seetharaman Hello All, These are the set of changes that are need to the user space code to support pquota and gquota together. Regards, chandra _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 1/4] xfsprogs: Remove incore use of XFS_OQUOTA_ENFD and XFS_OQUOTA_CHKD 2012-07-20 23:03 [PATCH 0/4] xfsprogs: Allow pquota and gquota to be used together Chandra Seetharaman @ 2012-07-20 23:03 ` Chandra Seetharaman 0 siblings, 0 replies; 11+ messages in thread From: Chandra Seetharaman @ 2012-07-20 23:03 UTC (permalink / raw) To: xfs; +Cc: Chandra Seetharaman Remove 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 yet. On-disk copy still uses XFS_OQUOTA_ENFD and XFS_OQUOTA_CHKD. Signed-off-by: Chandra Seetharaman <sekharan@us.ibm.com> --- db/check.c | 8 ++++---- include/xfs_quota.h | 47 +++++++++++++++++++++++++++++++++-------------- include/xfs_sb.h | 17 ++++++++++++++++- repair/versions.c | 18 ++++-------------- repair/xfs_repair.c | 4 ++-- 5 files changed, 59 insertions(+), 35 deletions(-) diff --git a/db/check.c b/db/check.c index e601e0a..f00fae7 100644 --- a/db/check.c +++ b/db/check.c @@ -2883,11 +2883,11 @@ process_inode( process_quota(IS_USER_QUOTA, id, blkmap); else if (id->ino == mp->m_sb.sb_gquotino && (mp->m_sb.sb_qflags & XFS_GQUOTA_ACCT) && - (mp->m_sb.sb_qflags & XFS_OQUOTA_CHKD)) + (mp->m_sb.sb_qflags & XFS_GQUOTA_CHKD)) process_quota(IS_GROUP_QUOTA, id, blkmap); else if (id->ino == mp->m_sb.sb_gquotino && (mp->m_sb.sb_qflags & XFS_PQUOTA_ACCT) && - (mp->m_sb.sb_qflags & XFS_OQUOTA_CHKD)) + (mp->m_sb.sb_qflags & XFS_PQUOTA_CHKD)) process_quota(IS_PROJECT_QUOTA, id, blkmap); } if (blkmap) @@ -3896,11 +3896,11 @@ quota_init(void) qgdo = mp->m_sb.sb_gquotino != 0 && mp->m_sb.sb_gquotino != NULLFSINO && (mp->m_sb.sb_qflags & XFS_GQUOTA_ACCT) && - (mp->m_sb.sb_qflags & XFS_OQUOTA_CHKD); + (mp->m_sb.sb_qflags & XFS_GQUOTA_CHKD); qpdo = mp->m_sb.sb_gquotino != 0 && mp->m_sb.sb_gquotino != NULLFSINO && (mp->m_sb.sb_qflags & XFS_PQUOTA_ACCT) && - (mp->m_sb.sb_qflags & XFS_OQUOTA_CHKD); + (mp->m_sb.sb_qflags & XFS_PQUOTA_CHKD); if (qudo) qudata = xcalloc(QDATA_HASH_SIZE, sizeof(qdata_t *)); if (qgdo) diff --git a/include/xfs_quota.h b/include/xfs_quota.h index 5d1f57d..aa583a3 100644 --- a/include/xfs_quota.h +++ b/include/xfs_quota.h @@ -154,19 +154,42 @@ 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 */ + +#define XFS_VALID_QFLAGS(sbp) (xfs_sb_version_hasnooquota(sbp) ? \ + (XFS_UQUOTA_ACCT|XFS_UQUOTA_ENFD|XFS_UQUOTA_CHKD| \ + XFS_GQUOTA_ACCT|XFS_GQUOTA_ENFD|XFS_GQUOTA_CHKD| \ + XFS_PQUOTA_ACCT|XFS_PQUOTA_ENFD|XFS_PQUOTA_CHKD) : \ + (XFS_UQUOTA_ACCT|XFS_UQUOTA_ENFD|XFS_UQUOTA_CHKD| \ + XFS_GQUOTA_ACCT|XFS_OQUOTA_ENFD|XFS_OQUOTA_CHKD| \ + XFS_PQUOTA_ACCT)) + +/* * 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_GQUOTA_ENFORCED(mp) ((mp)->m_qflags & XFS_GQUOTA_ENFD) +#define XFS_IS_PQUOTA_ENFORCED(mp) ((mp)->m_qflags & XFS_PQUOTA_ENFD) /* * Incore only flags for quotaoff - these bits get cleared when quota(s) @@ -184,8 +207,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) @@ -260,25 +281,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) /* * The structure kept inside the xfs_trans_t keep track of dquot changes diff --git a/include/xfs_sb.h b/include/xfs_sb.h index 5dcc2d7..69c6822 100644 --- a/include/xfs_sb.h +++ b/include/xfs_sb.h @@ -81,11 +81,13 @@ 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 /* sep prj quota inode */ #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 \ @@ -510,6 +512,19 @@ static inline void xfs_sb_version_addprojid32bit(xfs_sb_t *sbp) sbp->sb_bad_features2 |= XFS_SB_VERSION2_PROJID32BIT; } +static inline int xfs_sb_version_hasnooquota(xfs_sb_t *sbp) +{ + return xfs_sb_version_hasmorebits(sbp) && + (sbp->sb_features2 & XFS_SB_VERSION2_NO_OQUOTA); +} + +static inline void xfs_sb_version_addnooquota(xfs_sb_t *sbp) +{ + sbp->sb_versionnum |= XFS_SB_VERSION_MOREBITSBIT; + sbp->sb_features2 |= XFS_SB_VERSION2_PROJID32BIT; + sbp->sb_bad_features2 |= XFS_SB_VERSION2_NO_OQUOTA; +} + /* * end of superblock version macros */ diff --git a/repair/versions.c b/repair/versions.c index 957766a..e37eb10 100644 --- a/repair/versions.c +++ b/repair/versions.c @@ -61,26 +61,16 @@ update_sb_version(xfs_mount_t *mp) /* * protect against stray bits in the quota flag field */ - if (sb->sb_qflags & ~(XFS_UQUOTA_ACCT|XFS_UQUOTA_ENFD| - XFS_UQUOTA_CHKD|XFS_GQUOTA_ACCT| - XFS_OQUOTA_ENFD|XFS_OQUOTA_CHKD| - XFS_PQUOTA_ACCT)) { + if (sb->sb_qflags & ~XFS_VALID_QFLAGS(sb)) { /* * update the incore superblock, if we're in * no_modify mode, it'll never get flushed out * so this is ok. */ do_warn(_("bogus quota flags 0x%x set in superblock"), - sb->sb_qflags & ~(XFS_UQUOTA_ACCT| - XFS_UQUOTA_ENFD| - XFS_UQUOTA_CHKD|XFS_GQUOTA_ACCT| - XFS_OQUOTA_ENFD|XFS_OQUOTA_CHKD| - XFS_PQUOTA_ACCT)); + sb->sb_qflags & ~XFS_VALID_QFLAGS(sb)); - sb->sb_qflags &= (XFS_UQUOTA_ACCT|XFS_UQUOTA_ENFD| - XFS_UQUOTA_CHKD|XFS_GQUOTA_ACCT| - XFS_OQUOTA_ENFD|XFS_OQUOTA_CHKD| - XFS_PQUOTA_ACCT); + sb->sb_qflags &= XFS_VALID_QFLAGS(sb); if (!no_modify) do_warn(_(", bogus flags will be cleared\n")); diff --git a/repair/xfs_repair.c b/repair/xfs_repair.c index 69b7eab..0b82e8e 100644 --- a/repair/xfs_repair.c +++ b/repair/xfs_repair.c @@ -856,10 +856,10 @@ _("Warning: project quota information would be cleared.\n" dsb = XFS_BUF_TO_SBP(sbp); - if (be16_to_cpu(dsb->sb_qflags) & (XFS_UQUOTA_CHKD | XFS_OQUOTA_CHKD)) { + if (be16_to_cpu(dsb->sb_qflags) & (XFS_ALL_QUOTA_CHKD | XFS_OQUOTA_CHKD)) { do_warn(_("Note - quota info will be regenerated on next " "quota mount.\n")); - dsb->sb_qflags &= cpu_to_be16(~(XFS_UQUOTA_CHKD | + dsb->sb_qflags &= cpu_to_be16(~(XFS_ALL_QUOTA_CHKD | XFS_OQUOTA_CHKD)); } -- 1.7.1 _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs ^ permalink raw reply related [flat|nested] 11+ messages in thread
end of thread, other threads:[~2012-07-20 23:04 UTC | newest] Thread overview: 11+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2012-01-23 17:32 [PATCH 0/4] xfsprogs: Allow pquota and gquota to be used together Chandra Seetharaman 2012-01-23 17:32 ` [PATCH 1/4] xfsprogs: Remove incore use of XFS_OQUOTA_ENFD and XFS_OQUOTA_CHKD Chandra Seetharaman 2012-05-03 20:04 ` Ben Myers 2012-05-03 20:26 ` Chandra Seetharaman 2012-01-23 17:32 ` [PATCH 2/4] xfsprogs: Add new field pquotaino to on disk superblock Chandra Seetharaman 2012-05-04 16:09 ` Ben Myers 2012-01-23 17:33 ` [PATCH 3/4] xfsprogs: Add qs_pquota to the fs_quota Chandra Seetharaman 2012-05-04 16:32 ` Ben Myers 2012-01-23 17:33 ` [PATCH 4/4] xfsprogs: Add support to mkfs to add pquotino by adding a new option Chandra Seetharaman 2012-05-04 16:47 ` Ben Myers -- strict thread matches above, loose matches on Subject: below -- 2012-07-20 23:03 [PATCH 0/4] xfsprogs: Allow pquota and gquota to be used together Chandra Seetharaman 2012-07-20 23:03 ` [PATCH 1/4] xfsprogs: Remove incore use of XFS_OQUOTA_ENFD and XFS_OQUOTA_CHKD Chandra Seetharaman
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox