提交 7ae44407 编写于 作者: C Christoph Hellwig 提交者: Ben Myers

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: NChristoph Hellwig <hch@lst.de>
Reviewed-by: NDave Chinner <dchinner@redhat.com>
Signed-off-by: NBen Myers <bpm@sgi.com>
上级 97e7ade5
...@@ -552,7 +552,7 @@ xfs_qm_dqtobp( ...@@ -552,7 +552,7 @@ xfs_qm_dqtobp(
* *
* If XFS_QMOPT_DQALLOC is set, allocate a dquot on disk if it needed. * If XFS_QMOPT_DQALLOC is set, allocate a dquot on disk if it needed.
*/ */
STATIC int int
xfs_qm_dqread( xfs_qm_dqread(
struct xfs_mount *mp, struct xfs_mount *mp,
xfs_dqid_t id, xfs_dqid_t id,
...@@ -804,32 +804,17 @@ xfs_qm_dqget( ...@@ -804,32 +804,17 @@ xfs_qm_dqget(
mutex_unlock(&h->qh_lock); mutex_unlock(&h->qh_lock);
error = xfs_qm_dqread(mp, id, type, flags, &dqp); error = xfs_qm_dqread(mp, id, type, flags, &dqp);
if (error) {
if (ip)
xfs_ilock(ip, XFS_ILOCK_EXCL);
return error;
}
/* if (ip)
* See if this is mount code calling to look at the overall quota limits xfs_ilock(ip, XFS_ILOCK_EXCL);
* which are stored in the id == 0 user or group's dquot.
* Since we may not have done a quotacheck by this point, just return if (error)
* the dquot without attaching it to any hashtables, lists, etc, or even return error;
* taking a reference.
* The caller must dqdestroy this once done.
*/
if (flags & XFS_QMOPT_DQSUSER) {
ASSERT(id == 0);
ASSERT(! ip);
goto dqret;
}
/* /*
* Dquot lock comes after hashlock in the lock ordering * Dquot lock comes after hashlock in the lock ordering
*/ */
if (ip) { if (ip) {
xfs_ilock(ip, XFS_ILOCK_EXCL);
/* /*
* A dquot could be attached to this inode by now, since * A dquot could be attached to this inode by now, since
* we had dropped the ilock. * we had dropped the ilock.
......
...@@ -129,6 +129,8 @@ static inline void xfs_dqunlock_nonotify(struct xfs_dquot *dqp) ...@@ -129,6 +129,8 @@ static inline void xfs_dqunlock_nonotify(struct xfs_dquot *dqp)
(XFS_IS_UQUOTA_ON((d)->q_mount)) : \ (XFS_IS_UQUOTA_ON((d)->q_mount)) : \
(XFS_IS_OQUOTA_ON((d)->q_mount)))) (XFS_IS_OQUOTA_ON((d)->q_mount))))
extern int xfs_qm_dqread(struct xfs_mount *, xfs_dqid_t, uint,
uint, struct xfs_dquot **);
extern void xfs_qm_dqdestroy(xfs_dquot_t *); extern void xfs_qm_dqdestroy(xfs_dquot_t *);
extern int xfs_qm_dqflush(xfs_dquot_t *, uint); extern int xfs_qm_dqflush(xfs_dquot_t *, uint);
extern void xfs_qm_dqpurge(xfs_dquot_t *); extern void xfs_qm_dqpurge(xfs_dquot_t *);
......
...@@ -858,18 +858,21 @@ xfs_qm_init_quotainfo( ...@@ -858,18 +858,21 @@ xfs_qm_init_quotainfo(
/* /*
* We try to get the limits from the superuser's limits fields. * We try to get the limits from the superuser's limits fields.
* This is quite hacky, but it is standard quota practice. * This is quite hacky, but it is standard quota practice.
*
* We look at the USR dquot with id == 0 first, but if user quotas * We look at the USR dquot with id == 0 first, but if user quotas
* are not enabled we goto the GRP dquot with id == 0. * are not enabled we goto the GRP dquot with id == 0.
* We don't really care to keep separate default limits for user * We don't really care to keep separate default limits for user
* and group quotas, at least not at this point. * and group quotas, at least not at this point.
*
* Since we may not have done a quotacheck by this point, just read
* the dquot without attaching it to any hashtables or lists.
*/ */
error = xfs_qm_dqget(mp, NULL, (xfs_dqid_t)0, error = xfs_qm_dqread(mp, 0,
XFS_IS_UQUOTA_RUNNING(mp) ? XFS_DQ_USER : XFS_IS_UQUOTA_RUNNING(mp) ? XFS_DQ_USER :
(XFS_IS_GQUOTA_RUNNING(mp) ? XFS_DQ_GROUP : (XFS_IS_GQUOTA_RUNNING(mp) ? XFS_DQ_GROUP :
XFS_DQ_PROJ), XFS_DQ_PROJ),
XFS_QMOPT_DQSUSER|XFS_QMOPT_DOWARN, XFS_QMOPT_DOWARN, &dqp);
&dqp); if (!error) {
if (! error) {
xfs_disk_dquot_t *ddqp = &dqp->q_core; xfs_disk_dquot_t *ddqp = &dqp->q_core;
/* /*
...@@ -896,11 +899,6 @@ xfs_qm_init_quotainfo( ...@@ -896,11 +899,6 @@ xfs_qm_init_quotainfo(
qinf->qi_rtbhardlimit = be64_to_cpu(ddqp->d_rtb_hardlimit); qinf->qi_rtbhardlimit = be64_to_cpu(ddqp->d_rtb_hardlimit);
qinf->qi_rtbsoftlimit = be64_to_cpu(ddqp->d_rtb_softlimit); qinf->qi_rtbsoftlimit = be64_to_cpu(ddqp->d_rtb_softlimit);
/*
* We sent the XFS_QMOPT_DQSUSER flag to dqget because
* we don't want this dquot cached. We haven't done a
* quotacheck yet, and quotacheck doesn't like incore dquots.
*/
xfs_qm_dqdestroy(dqp); xfs_qm_dqdestroy(dqp);
} else { } else {
qinf->qi_btimelimit = XFS_QM_BTIMELIMIT; qinf->qi_btimelimit = XFS_QM_BTIMELIMIT;
......
...@@ -197,7 +197,6 @@ typedef struct xfs_qoff_logformat { ...@@ -197,7 +197,6 @@ typedef struct xfs_qoff_logformat {
#define XFS_QMOPT_UQUOTA 0x0000004 /* user dquot requested */ #define XFS_QMOPT_UQUOTA 0x0000004 /* user dquot requested */
#define XFS_QMOPT_PQUOTA 0x0000008 /* project dquot requested */ #define XFS_QMOPT_PQUOTA 0x0000008 /* project dquot requested */
#define XFS_QMOPT_FORCE_RES 0x0000010 /* ignore quota limits */ #define XFS_QMOPT_FORCE_RES 0x0000010 /* ignore quota limits */
#define XFS_QMOPT_DQSUSER 0x0000020 /* don't cache super users dquot */
#define XFS_QMOPT_SBVERSION 0x0000040 /* change superblock version num */ #define XFS_QMOPT_SBVERSION 0x0000040 /* change superblock version num */
#define XFS_QMOPT_DOWARN 0x0000400 /* increase warning cnt if needed */ #define XFS_QMOPT_DOWARN 0x0000400 /* increase warning cnt if needed */
#define XFS_QMOPT_DQREPAIR 0x0001000 /* repair dquot if damaged */ #define XFS_QMOPT_DQREPAIR 0x0001000 /* repair dquot if damaged */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册