| To: | Dave Chinner <david@xxxxxxxxxxxxx> |
|---|---|
| Subject: | Re: [PATCH v8 2/5] xfs: Add pquota fields where gquota is used. |
| From: | Jeff Liu <jeff.liu@xxxxxxxxxx> |
| Date: | Fri, 17 May 2013 13:40:19 +0800 |
| Cc: | Chandra Seetharaman <sekharan@xxxxxxxxxx>, xfs@xxxxxxxxxxx |
| Delivered-to: | xfs@xxxxxxxxxxx |
| In-reply-to: | <20130517030125.GT29466@dastard> |
| References: | <1368220889-25188-1-git-send-email-sekharan@xxxxxxxxxx> <1368220889-25188-3-git-send-email-sekharan@xxxxxxxxxx> <51906528.3030307@xxxxxxxxxx> <20130517030125.GT29466@dastard> |
| User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 |
On 05/17/2013 11:01 AM, Dave Chinner wrote:
> On Mon, May 13, 2013 at 11:59:36AM +0800, Jeff Liu wrote:
>> Hi,
>>
>>> +struct xfs_inode *
>>> +xfs_dq_to_quota_inode(struct xfs_dquot *dqp)
>>> +{
>>> + if (XFS_QM_ISUDQ(dqp))
>>> + return dqp->q_mount->m_quotainfo->qi_uquotaip;
>>> + if (XFS_QM_ISGDQ(dqp))
>>> + return dqp->q_mount->m_quotainfo->qi_gquotaip;
>>> + ASSERT(XFS_QM_ISPDQ(dqp));
>>> + return dqp->q_mount->m_quotainfo->qi_pquotaip;
>>> +}
>> Is it better to replace above conditional judgment with 'switch...case'?
>> i.e.
>> static inline struct xfs_inode *
>> xfs_dq_to_qip(struct xfs_dquot *dqp)
>> {
>> switch (dqp->dq_flags) {
>> case XFS_DQ_USER:
>> return dqp->q_mount->m_quotainfo->qi_uquotaip;
>> case XFS_DQ_GROUP:
>> return dqp->q_mount->m_quotainfo->qi_gqoutaip;
>> case XFS_DQ_PROJ:
>> return dqp->q_mount->m_quotainfo->qi_pquotaip;
>> }
>
> Doesn't work because dq_flags can have other fields set in it (e.g
> XFS_DQ_DIRTY). It would need to be:
>
> switch (dqp->dq_flags & XFS_DQ_ALLTYPES) {
> ....
> }
Ah, yep. thanks for the teaching. :)
Thanks,
-Jeff
|
| Previous by Date: | [PATCH v2 7/8] xfs: Add xfs_log_rlimit.[c|h], Jeff Liu |
|---|---|
| Next by Date: | 2013 USA (W.C.H.R) CONFERENCE/INVITATION!!!, mrs.jessica powell |
| Previous by Thread: | Re: [PATCH v8 2/5] xfs: Add pquota fields where gquota is used., Dave Chinner |
| Next by Thread: | Re: [PATCH v8 2/5] xfs: Add pquota fields where gquota is used., Chandra Seetharaman |
| Indexes: | [Date] [Thread] [Top] [All Lists] |