Commit 7ae4440723a413c7a52edd27f654c34680dd4ea2

Authored by Christoph Hellwig
Committed by Ben Myers
1 parent 97e7ade506

xfs: remove XFS_QMOPT_DQSUSER

Just read the id 0 dquot from disk directly in xfs_qm_init_quotainfo instead
of going through dqget and requiring a special flag to not add the dquot to
any lists.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Ben Myers <bpm@sgi.com>

Showing 4 changed files with 18 additions and 34 deletions Side-by-side Diff

... ... @@ -552,7 +552,7 @@
552 552 *
553 553 * If XFS_QMOPT_DQALLOC is set, allocate a dquot on disk if it needed.
554 554 */
555   -STATIC int
  555 +int
556 556 xfs_qm_dqread(
557 557 struct xfs_mount *mp,
558 558 xfs_dqid_t id,
559 559  
560 560  
561 561  
... ... @@ -804,32 +804,17 @@
804 804 mutex_unlock(&h->qh_lock);
805 805  
806 806 error = xfs_qm_dqread(mp, id, type, flags, &dqp);
807   - if (error) {
808   - if (ip)
809   - xfs_ilock(ip, XFS_ILOCK_EXCL);
  807 +
  808 + if (ip)
  809 + xfs_ilock(ip, XFS_ILOCK_EXCL);
  810 +
  811 + if (error)
810 812 return error;
811   - }
812 813  
813 814 /*
814   - * See if this is mount code calling to look at the overall quota limits
815   - * which are stored in the id == 0 user or group's dquot.
816   - * Since we may not have done a quotacheck by this point, just return
817   - * the dquot without attaching it to any hashtables, lists, etc, or even
818   - * taking a reference.
819   - * The caller must dqdestroy this once done.
820   - */
821   - if (flags & XFS_QMOPT_DQSUSER) {
822   - ASSERT(id == 0);
823   - ASSERT(! ip);
824   - goto dqret;
825   - }
826   -
827   - /*
828 815 * Dquot lock comes after hashlock in the lock ordering
829 816 */
830 817 if (ip) {
831   - xfs_ilock(ip, XFS_ILOCK_EXCL);
832   -
833 818 /*
834 819 * A dquot could be attached to this inode by now, since
835 820 * we had dropped the ilock.
... ... @@ -129,6 +129,8 @@
129 129 (XFS_IS_UQUOTA_ON((d)->q_mount)) : \
130 130 (XFS_IS_OQUOTA_ON((d)->q_mount))))
131 131  
  132 +extern int xfs_qm_dqread(struct xfs_mount *, xfs_dqid_t, uint,
  133 + uint, struct xfs_dquot **);
132 134 extern void xfs_qm_dqdestroy(xfs_dquot_t *);
133 135 extern int xfs_qm_dqflush(xfs_dquot_t *, uint);
134 136 extern void xfs_qm_dqpurge(xfs_dquot_t *);
... ... @@ -858,18 +858,21 @@
858 858 /*
859 859 * We try to get the limits from the superuser's limits fields.
860 860 * This is quite hacky, but it is standard quota practice.
  861 + *
861 862 * We look at the USR dquot with id == 0 first, but if user quotas
862 863 * are not enabled we goto the GRP dquot with id == 0.
863 864 * We don't really care to keep separate default limits for user
864 865 * and group quotas, at least not at this point.
  866 + *
  867 + * Since we may not have done a quotacheck by this point, just read
  868 + * the dquot without attaching it to any hashtables or lists.
865 869 */
866   - error = xfs_qm_dqget(mp, NULL, (xfs_dqid_t)0,
867   - XFS_IS_UQUOTA_RUNNING(mp) ? XFS_DQ_USER :
868   - (XFS_IS_GQUOTA_RUNNING(mp) ? XFS_DQ_GROUP :
869   - XFS_DQ_PROJ),
870   - XFS_QMOPT_DQSUSER|XFS_QMOPT_DOWARN,
871   - &dqp);
872   - if (! error) {
  870 + error = xfs_qm_dqread(mp, 0,
  871 + XFS_IS_UQUOTA_RUNNING(mp) ? XFS_DQ_USER :
  872 + (XFS_IS_GQUOTA_RUNNING(mp) ? XFS_DQ_GROUP :
  873 + XFS_DQ_PROJ),
  874 + XFS_QMOPT_DOWARN, &dqp);
  875 + if (!error) {
873 876 xfs_disk_dquot_t *ddqp = &dqp->q_core;
874 877  
875 878 /*
... ... @@ -896,11 +899,6 @@
896 899 qinf->qi_rtbhardlimit = be64_to_cpu(ddqp->d_rtb_hardlimit);
897 900 qinf->qi_rtbsoftlimit = be64_to_cpu(ddqp->d_rtb_softlimit);
898 901  
899   - /*
900   - * We sent the XFS_QMOPT_DQSUSER flag to dqget because
901   - * we don't want this dquot cached. We haven't done a
902   - * quotacheck yet, and quotacheck doesn't like incore dquots.
903   - */
904 902 xfs_qm_dqdestroy(dqp);
905 903 } else {
906 904 qinf->qi_btimelimit = XFS_QM_BTIMELIMIT;
... ... @@ -197,7 +197,6 @@
197 197 #define XFS_QMOPT_UQUOTA 0x0000004 /* user dquot requested */
198 198 #define XFS_QMOPT_PQUOTA 0x0000008 /* project dquot requested */
199 199 #define XFS_QMOPT_FORCE_RES 0x0000010 /* ignore quota limits */
200   -#define XFS_QMOPT_DQSUSER 0x0000020 /* don't cache super users dquot */
201 200 #define XFS_QMOPT_SBVERSION 0x0000040 /* change superblock version num */
202 201 #define XFS_QMOPT_DOWARN 0x0000400 /* increase warning cnt if needed */
203 202 #define XFS_QMOPT_DQREPAIR 0x0001000 /* repair dquot if damaged */