From: Dave Chinner <david@fromorbit.com>
To: Chandra Seetharaman <sekharan@us.ibm.com>
Cc: xfs@oss.sgi.com
Subject: Re: [RFC v6 PATCH 1/5] xfs: Remove incore use of XFS_OQUOTA_ENFD and XFS_OQUOTA_CHKD
Date: Wed, 15 Aug 2012 08:46:45 +1000 [thread overview]
Message-ID: <20120814224645.GQ2877@dastard> (raw)
In-Reply-To: <20120720230208.20477.49663.sendpatchset@chandra-lucid.austin.ibm.com>
On Fri, Jul 20, 2012 at 06:02:08PM -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 nd
> PQUOTA respectively.
>
> No changes are made to the on-disk version of the superblock yet. 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*.
Couple of minor style things....
> @@ -622,6 +636,7 @@ xfs_sb_to_disk(
> xfs_sb_field_t f;
> int first;
> int size;
> + __uint16_t tmp16;
tmp16 is a bad name for a temporary variable. Move it to the scope
that uses it, and name it for it's purpose. i.e:
>
> ASSERT(fields);
> if (!fields)
> @@ -636,6 +651,26 @@ xfs_sb_to_disk(
>
> if (size == 1 || xfs_sb_info[f].type == 1) {
> memcpy(to_ptr + first, from_ptr + first, size);
> + } else if (f == XFS_SBS_QFLAGS) {
__uint16_t qflags;
> + /*
> + * The in-core version of sb_qflags do not have
> + * XFS_OQUOTA_* flags, whereas the on-disk version
> + * does. Save the in-core sb_qflags temporarily,
> + * removing the new XFS_{PG}QUOTA_* flags and re-apply
> + * the old on-disk flags.
> + */
> + tmp16 = from->sb_qflags &
qflags = from->sb_qflags & ....
> + ~(XFS_PQUOTA_ENFD | XFS_PQUOTA_CHKD |
> + XFS_GQUOTA_ENFD | XFS_GQUOTA_CHKD);
> +
> + if (from->sb_qflags &
> + (XFS_PQUOTA_ENFD | XFS_GQUOTA_ENFD))
> + tmp16 |= XFS_OQUOTA_ENFD;
> + if (from->sb_qflags &
> + (XFS_PQUOTA_CHKD | XFS_GQUOTA_CHKD))
> + tmp16 |= XFS_OQUOTA_CHKD;
> +
> + *(__be16 *)(to_ptr + first) = cpu_to_be16(tmp16);
> } else {
> switch (size) {
> case 2:
....
> @@ -339,9 +339,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))) {
Can you fix the flat indenting here at the same time so that the
logic is obvious at a glance and consistent with the rest of the XFS
code? i.e.
if (((flags & XFS_UQUOTA_ACCT) == 0 &&
(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_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);
> @@ -771,8 +773,10 @@ xfs_qm_scall_getquota(
> * 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)))) {
> + (!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)) {
Same here:
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)) {
Otherwise it looks good. Fix the above and you can add a
Reviewed-by: Dave Chinner <dchinner@redhat.com>
--
Dave Chinner
david@fromorbit.com
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2012-08-14 22:46 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-20 23:02 [RFC v6 PATCH 0/5] xfs: Allow pquota and gquota to be used together Chandra Seetharaman
2012-07-20 23:02 ` [RFC v6 PATCH 1/5] xfs: Remove incore use of XFS_OQUOTA_ENFD and XFS_OQUOTA_CHKD Chandra Seetharaman
2012-08-14 22:46 ` Dave Chinner [this message]
2012-08-22 22:53 ` Chandra Seetharaman
2012-09-13 7:56 ` Christoph Hellwig
2012-09-13 20:37 ` Chandra Seetharaman
2012-07-20 23:02 ` [RFC v6 PATCH 2/5] xfs: Add pquota fields where gquota is used Chandra Seetharaman
2012-08-15 1:15 ` Dave Chinner
2012-08-22 22:56 ` Chandra Seetharaman
2012-07-20 23:02 ` [RFC v6 PATCH 3/5] xfs: Add pquotaino to on-disk super block Chandra Seetharaman
2012-08-15 2:09 ` Dave Chinner
2012-08-22 23:30 ` Chandra Seetharaman
2012-08-23 0:25 ` Dave Chinner
2012-07-20 23:02 ` [RFC v6 PATCH 4/5] xfs: Add proper versioning support to fs_quota_stat Chandra Seetharaman
2012-08-15 2:32 ` Dave Chinner
2012-08-22 23:32 ` Chandra Seetharaman
2012-07-20 23:03 ` [RFC v6 PATCH 5/5] xfs: Add a new field to fs_quota_stat to get pquota information Chandra Seetharaman
2012-08-15 2:37 ` Dave Chinner
2012-08-22 23:40 ` Chandra Seetharaman
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=20120814224645.GQ2877@dastard \
--to=david@fromorbit.com \
--cc=sekharan@us.ibm.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