From: Chandra Seetharaman <sekharan@us.ibm.com>
To: Dave Chinner <david@fromorbit.com>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH v9 2/6] xfs: Remove incore use of XFS_OQUOTA_ENFD and XFS_OQUOTA_CHKD
Date: Mon, 24 Jun 2013 17:25:24 -0500 [thread overview]
Message-ID: <1372112724.22504.77.camel@chandra-dt.ibm.com> (raw)
In-Reply-To: <20130624055921.GM29376@dastard>
On Mon, 2013-06-24 at 15:59 +1000, Dave Chinner wrote:
> On Sun, Jun 23, 2013 at 09:48:23PM -0500, Chandra Seetharaman wrote:
> > Remove all incore use of XFS_OQUOTA_ENFD and XFS_OQUOTA_CHKD. Instead,
> > start using XFS_GQUOTA_.* XFS_PQUOTA_.* counterparts for GQUOTA and
> > PQUOTA respectively.
> >
> > On-disk copy still uses XFS_OQUOTA_ENFD and XFS_OQUOTA_CHKD.
> >
> > Read and write of the superblock does the conversion from *OQUOTA*
> > to *[PG]QUOTA*.
> >
> > Signed-off-by: Chandra Seetharaman <sekharan@us.ibm.com>
> > ---
> > fs/xfs/xfs_mount.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
> > fs/xfs/xfs_qm.c | 9 ++++++---
> > fs/xfs/xfs_qm_syscalls.c | 39 +++++++++++++++++++++------------------
> > fs/xfs/xfs_quota.h | 42 ++++++++++++++++++++++++++++--------------
> > fs/xfs/xfs_quotaops.c | 6 ++++--
> > fs/xfs/xfs_super.c | 16 ++++++++--------
> > fs/xfs/xfs_trans_dquot.c | 4 ++--
> > 7 files changed, 115 insertions(+), 47 deletions(-)
> >
> > diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
> > index 6a19434..e2e14cb 100644
> > --- a/fs/xfs/xfs_mount.c
> > +++ b/fs/xfs/xfs_mount.c
> > @@ -336,6 +336,14 @@ xfs_mount_validate_sb(
> > return XFS_ERROR(EWRONGFS);
> > }
> >
> > + if ((sbp->sb_qflags & (XFS_OQUOTA_ENFD | XFS_OQUOTA_CHKD)) &&
> > + (sbp->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.\n");
> > + return XFS_ERROR(EFSCORRUPTED);
> > + }
> > +
> > /*
> > * Version 5 superblock feature mask validation. Reject combinations the
> > * kernel cannot support up front before checking anything else. For
> > @@ -622,6 +630,35 @@ xfs_sb_from_disk(
> > to->sb_lsn = be64_to_cpu(from->sb_lsn);
> > }
> >
> > +static inline void
> > +xfs_handle_quota_to_disk(
> > + xfs_dsb_t *to,
> > + xfs_sb_t *from,
> > + __int64_t *fields)
>
> An "XFS handle" has meaning in the namespace (i.e. an XFS filehandle
> as used in xfs_ioctl.c and defined in xfs_fs.h, so this is not a
> good name.
>
> Realistically, xfs_sb_qflags_to_disk() is more appropriate for it's
> function....
I agree with your "handle" comment.
As you can see in patch 4/6, PQUOTINO logic is also added to this
function. Can you suggest a name inclusive of that ?
>
> > @@ -643,6 +680,7 @@ xfs_sb_to_disk(
> > if (!fields)
> > return;
> >
> > + xfs_handle_quota_to_disk(to, from, &fields);
> > while (fields) {
> > f = (xfs_sb_field_t)xfs_lowbit64((__uint64_t)fields);
> > first = xfs_sb_info[f].offset;
> > @@ -835,6 +873,14 @@ reread:
> > */
> > xfs_sb_from_disk(&mp->m_sb, XFS_BUF_TO_SBP(bp));
> >
> > + if (sbp->sb_qflags & XFS_OQUOTA_ENFD)
> > + sbp->sb_qflags |= (sbp->sb_qflags & XFS_PQUOTA_ACCT) ?
> > + XFS_PQUOTA_ENFD : XFS_GQUOTA_ENFD;
> > + if (sbp->sb_qflags & XFS_OQUOTA_CHKD)
> > + sbp->sb_qflags |= (sbp->sb_qflags & XFS_PQUOTA_ACCT) ?
> > + XFS_PQUOTA_CHKD : XFS_GQUOTA_CHKD;
> > + sbp->sb_qflags &= ~(XFS_OQUOTA_ENFD | XFS_OQUOTA_CHKD);
>
> and that as xfs_sb_qflags_from_disk()....
ok, will do.
>
> > +
> > /*
> > * We must be able to do sector-sized and sector-aligned IO.
> > */
> > diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c
> > index f5f9925..de7ecbd 100644
> > --- a/fs/xfs/xfs_qm.c
> > +++ b/fs/xfs/xfs_qm.c
> > @@ -299,8 +299,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;
>
> Order is user, group, project in the processing....
>
> > diff --git a/fs/xfs/xfs_qm_syscalls.c b/fs/xfs/xfs_qm_syscalls.c
> > index b03b2ab..5e51227 100644
> > --- a/fs/xfs/xfs_qm_syscalls.c
> > +++ b/fs/xfs/xfs_qm_syscalls.c
> > @@ -117,11 +117,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;
> > }
>
> Again, u/g/p order...
>
> >
> > @@ -335,14 +335,14 @@ xfs_qm_scall_quotaon(
> > * quota acct on ondisk without m_qflags' knowing.
> > */
> > if (((flags & XFS_UQUOTA_ACCT) == 0 &&
> > - (mp->m_sb.sb_qflags & XFS_UQUOTA_ACCT) == 0 &&
> > - (flags & XFS_UQUOTA_ENFD))
> > - ||
> > + (mp->m_sb.sb_qflags & XFS_UQUOTA_ACCT) == 0 &&
> > + (flags & XFS_UQUOTA_ENFD)) ||
> > ((flags & XFS_PQUOTA_ACCT) == 0 &&
> > - (mp->m_sb.sb_qflags & XFS_PQUOTA_ACCT) == 0 &&
> > - (flags & XFS_GQUOTA_ACCT) == 0 &&
> > - (mp->m_sb.sb_qflags & XFS_GQUOTA_ACCT) == 0 &&
> > - (flags & XFS_OQUOTA_ENFD))) {
> > + (mp->m_sb.sb_qflags & XFS_PQUOTA_ACCT) == 0 &&
> > + (flags & XFS_PQUOTA_ENFD)) ||
> > + ((flags & XFS_GQUOTA_ACCT) == 0 &&
> > + (mp->m_sb.sb_qflags & XFS_GQUOTA_ACCT) == 0 &&
> > + (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);
>
> And now u/p/g order. That's a little confusing - let's try to keep
> the ordering the same throughout the code...
Sure, will do
>
> > @@ -776,9 +776,12 @@ xfs_qm_scall_getquota(
> > * gets turned off. No need to confuse the user level code,
> > * so return zeroes in that case.
> > */
> > - if ((!XFS_IS_UQUOTA_ENFORCED(mp) && dqp->q_core.d_flags == XFS_DQ_USER) ||
> > - (!XFS_IS_OQUOTA_ENFORCED(mp) &&
> > - (dqp->q_core.d_flags & (XFS_DQ_PROJ | XFS_DQ_GROUP)))) {
> > + if ((!XFS_IS_UQUOTA_ENFORCED(mp) &&
> > + dqp->q_core.d_flags == XFS_DQ_USER) ||
> > + (!XFS_IS_PQUOTA_ENFORCED(mp) &&
> > + dqp->q_core.d_flags == XFS_DQ_PROJ) ||
> > + (!XFS_IS_GQUOTA_ENFORCED(mp) &&
> > + dqp->q_core.d_flags == XFS_DQ_GROUP)) {
> > dst->d_btimer = 0;
> > dst->d_itimer = 0;
> > dst->d_rtbtimer = 0;
>
> Same here - it's u/p/g order rather than u/g/p. Can you fix up all
> the other cases so they are all in the same u/g/p order?
>
> > diff --git a/fs/xfs/xfs_quota.h b/fs/xfs/xfs_quota.h
> > index c38068f..0596860 100644
> > --- a/fs/xfs/xfs_quota.h
> > +++ b/fs/xfs/xfs_quota.h
> > @@ -161,28 +161,43 @@ typedef struct xfs_qoff_logformat {
> > #define XFS_GQUOTA_ACCT 0x0040 /* group quota accounting ON */
> >
> > /*
> > + * Start differentiating group quota and project quota 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_readsb() and xfs_sb_to_disk()
>
> Try to describe the meaning of the flags, not the process you are
> using to change the code. Hence I think, only the second paragraph
> is needed here. Also, based on my comments above, conversion is
> done in xfs_sb_qflags_to_disk() and xfs_sb_qflags_from_disk()....
Sure. will do.
>
> Cheers,
>
> Dave.
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2013-06-24 22:25 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-24 2:48 [PATCH v9 0/6] Allow pquota and gquota to be used together Chandra Seetharaman
2013-06-24 2:48 ` [PATCH v9 1/6] xfs: Move code around and remove typedefs Chandra Seetharaman
2013-06-24 5:31 ` Dave Chinner
2013-06-24 22:21 ` Chandra Seetharaman
2013-06-24 21:36 ` Ben Myers
2013-06-24 23:23 ` Chandra Seetharaman
2013-06-24 2:48 ` [PATCH v9 2/6] xfs: Remove incore use of XFS_OQUOTA_ENFD and XFS_OQUOTA_CHKD Chandra Seetharaman
2013-06-24 5:59 ` Dave Chinner
2013-06-24 22:25 ` Chandra Seetharaman [this message]
2013-06-25 5:32 ` Dave Chinner
2013-06-24 2:48 ` [PATCH v9 3/6] xfs: Add pquota fields where gquota is used Chandra Seetharaman
2013-06-24 8:00 ` Dave Chinner
2013-06-24 22:33 ` Chandra Seetharaman
2013-06-24 23:25 ` Chandra Seetharaman
2013-06-25 5:33 ` Dave Chinner
2013-06-24 2:48 ` [PATCH v9 4/6] xfs: Start using pquotaino from the superblock Chandra Seetharaman
2013-06-25 6:31 ` Dave Chinner
2013-07-01 15:50 ` Chandra Seetharaman
2013-07-04 1:12 ` Dave Chinner
2013-07-08 23:20 ` Chandra Seetharaman
2013-07-09 1:21 ` Dave Chinner
2013-07-09 21:06 ` Chandra Seetharaman
2013-06-24 2:48 ` [PATCH v9 5/6] xfs: Add proper versioning support to fs_quota_stat Chandra Seetharaman
2013-06-25 6:43 ` Dave Chinner
2013-06-25 22:36 ` Chandra Seetharaman
2013-06-26 1:20 ` Dave Chinner
2013-06-24 2:48 ` [PATCH v9 6/6] xfs: Use new qs_pquota field in fs_quota_stat for Q_XGETQSTAT Chandra Seetharaman
2013-06-25 6:45 ` Dave Chinner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1372112724.22504.77.camel@chandra-dt.ibm.com \
--to=sekharan@us.ibm.com \
--cc=david@fromorbit.com \
--cc=xfs@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox