Re: [PATCH v8 2/5] xfs: Add pquota fields where gquota is used.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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) {
	....
	}

Cheers,

Dave.
-- 
Dave Chinner
david@xxxxxxxxxxxxx

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




[Index of Archives]     [Linux XFS Devel]     [Linux Filesystem Development]     [Filesystem Testing]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux