public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeff Liu <jeff.liu@oracle.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: Ben Myers <bpm@sgi.com>,
	Chandra Seetharaman <sekharan@us.ibm.com>,
	Mark Tinguely <tinguely@sgi.com>,
	Chris Mason <chris.mason@oracle.com>,
	xfs@oss.sgi.com
Subject: Re: [PATCH 1/4] xfs: Remove incore use of XFS_OQUOTA_ENFD and XFS_OQUOTA_CHKD
Date: Tue, 17 Jul 2012 20:44:17 +0800	[thread overview]
Message-ID: <50055E21.6040705@oracle.com> (raw)
In-Reply-To: <20120717073221.GA24395@infradead.org>

On 07/17/2012 03:32 PM, Christoph Hellwig wrote:

>> +	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);
> 
> It's suggest factoring this into a xfs_quota_flags_from_disk helper,
> which a) makes this code more clear, and b) can get a comment about what
> is going on.

Exactly!

> 
>> +			/*
>> +			 * 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 &
>> +					~(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_CHKD;
>> +			*(__be16 *)(to_ptr + first) = cpu_to_be16(tmp16);
> 
> Same here for the other direction.

Ok, I'll take care of it as well.

> 
>> + * Start differentiating group quota and project quota in-core
>> + * using distinct flags, instread 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 limit enforced */
>> +#define XFS_GQUOTA_CHKD 0x0100	/* quotacheck run on group quotas */
>> +#define XFS_PQUOTA_ENFD	0x0200	/* project quota limits enforced */
>> +#define XFS_PQUOTA_CHKD	0x0800	/* quotacheck run on project quotas.
>> +				 * FIXME: here we cannot using 0x0400
>> +				 * because it is already reserved for
>> +				 * XFS_GQUOTA_ACTIVE.  Otherwise,
>> +				 * XFS_IS_GQUOTA_ON() is also true
>> +				 * although it does not enabled.
>> +				 */
> 
> Seems like all te 0x0?00 values are used for XFS_U?UOTA_ACTIVE flags.
> Why not move it to the 0x?000 range?

I have not took that previously because it will make the code looks a bit in-continuous, consider we have to skip all 0x0?00.
But yes, move PQUOTA_ENFD/PQUOTA_CHKD to 0x?000 range is fine, thanks for the advice!

-Jeff
 .

> 
> Otherwise these changes look good to me.


_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

      reply	other threads:[~2012-07-17 12:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-13  8:35 [PATCH 1/4] xfs: Remove incore use of XFS_OQUOTA_ENFD and XFS_OQUOTA_CHKD Jeff Liu
2012-07-17  7:32 ` Christoph Hellwig
2012-07-17 12:44   ` Jeff Liu [this message]

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=50055E21.6040705@oracle.com \
    --to=jeff.liu@oracle.com \
    --cc=bpm@sgi.com \
    --cc=chris.mason@oracle.com \
    --cc=hch@infradead.org \
    --cc=sekharan@us.ibm.com \
    --cc=tinguely@sgi.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