Commit 113a5683 authored by Chandra Seetharaman's avatar Chandra Seetharaman Committed by Ben Myers

xfs: Code cleanup and removal of some typedef usage

In preparation for combined pquota/gquota support, for the sake
of readability, do some code cleanup surrounding the affected
code.
Signed-off-by: default avatarChandra Seetharaman <sekharan@us.ibm.com>
Reviewed-by: default avatarBen Myers <bpm@sgi.com>
Signed-off-by: default avatarBen Myers <bpm@sgi.com>
parent 995961c4
...@@ -570,13 +570,13 @@ xfs_qm_dqtobp( ...@@ -570,13 +570,13 @@ xfs_qm_dqtobp(
xfs_buf_t **O_bpp, xfs_buf_t **O_bpp,
uint flags) uint flags)
{ {
xfs_bmbt_irec_t map; struct xfs_bmbt_irec map;
int nmaps = 1, error; int nmaps = 1, error;
xfs_buf_t *bp; struct xfs_buf *bp;
struct xfs_inode *quotip = xfs_dq_to_quota_inode(dqp); struct xfs_inode *quotip = xfs_dq_to_quota_inode(dqp);
xfs_mount_t *mp = dqp->q_mount; struct xfs_mount *mp = dqp->q_mount;
xfs_dqid_t id = be32_to_cpu(dqp->q_core.d_id); xfs_dqid_t id = be32_to_cpu(dqp->q_core.d_id);
xfs_trans_t *tp = (tpp ? *tpp : NULL); struct xfs_trans *tp = (tpp ? *tpp : NULL);
dqp->q_fileoffset = (xfs_fileoff_t)id / mp->m_quotainfo->qi_dqperchunk; dqp->q_fileoffset = (xfs_fileoff_t)id / mp->m_quotainfo->qi_dqperchunk;
......
...@@ -335,7 +335,8 @@ xfs_iget_cache_miss( ...@@ -335,7 +335,8 @@ xfs_iget_cache_miss(
iflags = XFS_INEW; iflags = XFS_INEW;
if (flags & XFS_IGET_DONTCACHE) if (flags & XFS_IGET_DONTCACHE)
iflags |= XFS_IDONTCACHE; iflags |= XFS_IDONTCACHE;
ip->i_udquot = ip->i_gdquot = NULL; ip->i_udquot = NULL;
ip->i_gdquot = NULL;
xfs_iflags_set(ip, iflags); xfs_iflags_set(ip, iflags);
/* insert the new inode */ /* insert the new inode */
......
...@@ -1260,19 +1260,20 @@ int ...@@ -1260,19 +1260,20 @@ int
xfs_qm_quotacheck( xfs_qm_quotacheck(
xfs_mount_t *mp) xfs_mount_t *mp)
{ {
int done, count, error, error2; int done, count, error, error2;
xfs_ino_t lastino; xfs_ino_t lastino;
size_t structsz; size_t structsz;
xfs_inode_t *uip, *gip; uint flags;
uint flags; LIST_HEAD (buffer_list);
LIST_HEAD (buffer_list); struct xfs_inode *uip = mp->m_quotainfo->qi_uquotaip;
struct xfs_inode *gip = mp->m_quotainfo->qi_gquotaip;
count = INT_MAX; count = INT_MAX;
structsz = 1; structsz = 1;
lastino = 0; lastino = 0;
flags = 0; flags = 0;
ASSERT(mp->m_quotainfo->qi_uquotaip || mp->m_quotainfo->qi_gquotaip); ASSERT(uip || gip);
ASSERT(XFS_IS_QUOTA_RUNNING(mp)); ASSERT(XFS_IS_QUOTA_RUNNING(mp));
xfs_notice(mp, "Quotacheck needed: Please wait."); xfs_notice(mp, "Quotacheck needed: Please wait.");
...@@ -1282,7 +1283,6 @@ xfs_qm_quotacheck( ...@@ -1282,7 +1283,6 @@ xfs_qm_quotacheck(
* their counters to zero. We need a clean slate. * their counters to zero. We need a clean slate.
* We don't log our changes till later. * We don't log our changes till later.
*/ */
uip = mp->m_quotainfo->qi_uquotaip;
if (uip) { if (uip) {
error = xfs_qm_dqiterate(mp, uip, XFS_QMOPT_UQUOTA, error = xfs_qm_dqiterate(mp, uip, XFS_QMOPT_UQUOTA,
&buffer_list); &buffer_list);
...@@ -1291,7 +1291,6 @@ xfs_qm_quotacheck( ...@@ -1291,7 +1291,6 @@ xfs_qm_quotacheck(
flags |= XFS_UQUOTA_CHKD; flags |= XFS_UQUOTA_CHKD;
} }
gip = mp->m_quotainfo->qi_gquotaip;
if (gip) { if (gip) {
error = xfs_qm_dqiterate(mp, gip, XFS_IS_GQUOTA_ON(mp) ? error = xfs_qm_dqiterate(mp, gip, XFS_IS_GQUOTA_ON(mp) ?
XFS_QMOPT_GQUOTA : XFS_QMOPT_PQUOTA, XFS_QMOPT_GQUOTA : XFS_QMOPT_PQUOTA,
...@@ -1393,15 +1392,13 @@ STATIC int ...@@ -1393,15 +1392,13 @@ STATIC int
xfs_qm_init_quotainos( xfs_qm_init_quotainos(
xfs_mount_t *mp) xfs_mount_t *mp)
{ {
xfs_inode_t *uip, *gip; struct xfs_inode *uip = NULL;
int error; struct xfs_inode *gip = NULL;
__int64_t sbflags; int error;
uint flags; __int64_t sbflags = 0;
uint flags = 0;
ASSERT(mp->m_quotainfo); ASSERT(mp->m_quotainfo);
uip = gip = NULL;
sbflags = 0;
flags = 0;
/* /*
* Get the uquota and gquota inodes * Get the uquota and gquota inodes
...@@ -1410,19 +1407,18 @@ xfs_qm_init_quotainos( ...@@ -1410,19 +1407,18 @@ xfs_qm_init_quotainos(
if (XFS_IS_UQUOTA_ON(mp) && if (XFS_IS_UQUOTA_ON(mp) &&
mp->m_sb.sb_uquotino != NULLFSINO) { mp->m_sb.sb_uquotino != NULLFSINO) {
ASSERT(mp->m_sb.sb_uquotino > 0); ASSERT(mp->m_sb.sb_uquotino > 0);
if ((error = xfs_iget(mp, NULL, mp->m_sb.sb_uquotino, error = xfs_iget(mp, NULL, mp->m_sb.sb_uquotino,
0, 0, &uip))) 0, 0, &uip);
if (error)
return XFS_ERROR(error); return XFS_ERROR(error);
} }
if (XFS_IS_OQUOTA_ON(mp) && if (XFS_IS_OQUOTA_ON(mp) &&
mp->m_sb.sb_gquotino != NULLFSINO) { mp->m_sb.sb_gquotino != NULLFSINO) {
ASSERT(mp->m_sb.sb_gquotino > 0); ASSERT(mp->m_sb.sb_gquotino > 0);
if ((error = xfs_iget(mp, NULL, mp->m_sb.sb_gquotino, error = xfs_iget(mp, NULL, mp->m_sb.sb_gquotino,
0, 0, &gip))) { 0, 0, &gip);
if (uip) if (error)
IRELE(uip); goto error_rele;
return XFS_ERROR(error);
}
} }
} else { } else {
flags |= XFS_QMOPT_SBVERSION; flags |= XFS_QMOPT_SBVERSION;
...@@ -1437,10 +1433,11 @@ xfs_qm_init_quotainos( ...@@ -1437,10 +1433,11 @@ xfs_qm_init_quotainos(
* temporarily switch to read-write to do this. * temporarily switch to read-write to do this.
*/ */
if (XFS_IS_UQUOTA_ON(mp) && uip == NULL) { if (XFS_IS_UQUOTA_ON(mp) && uip == NULL) {
if ((error = xfs_qm_qino_alloc(mp, &uip, error = xfs_qm_qino_alloc(mp, &uip,
sbflags | XFS_SB_UQUOTINO, sbflags | XFS_SB_UQUOTINO,
flags | XFS_QMOPT_UQUOTA))) flags | XFS_QMOPT_UQUOTA);
return XFS_ERROR(error); if (error)
goto error_rele;
flags &= ~XFS_QMOPT_SBVERSION; flags &= ~XFS_QMOPT_SBVERSION;
} }
...@@ -1449,18 +1446,21 @@ xfs_qm_init_quotainos( ...@@ -1449,18 +1446,21 @@ xfs_qm_init_quotainos(
XFS_QMOPT_GQUOTA : XFS_QMOPT_PQUOTA); XFS_QMOPT_GQUOTA : XFS_QMOPT_PQUOTA);
error = xfs_qm_qino_alloc(mp, &gip, error = xfs_qm_qino_alloc(mp, &gip,
sbflags | XFS_SB_GQUOTINO, flags); sbflags | XFS_SB_GQUOTINO, flags);
if (error) { if (error)
if (uip) goto error_rele;
IRELE(uip);
return XFS_ERROR(error);
}
} }
mp->m_quotainfo->qi_uquotaip = uip; mp->m_quotainfo->qi_uquotaip = uip;
mp->m_quotainfo->qi_gquotaip = gip; mp->m_quotainfo->qi_gquotaip = gip;
return 0; return 0;
error_rele:
if (uip)
IRELE(uip);
if (gip)
IRELE(gip);
return XFS_ERROR(error);
} }
STATIC void STATIC void
...@@ -1657,7 +1657,8 @@ xfs_qm_vop_dqalloc( ...@@ -1657,7 +1657,8 @@ xfs_qm_vop_dqalloc(
struct xfs_dquot **O_gdqpp) struct xfs_dquot **O_gdqpp)
{ {
struct xfs_mount *mp = ip->i_mount; struct xfs_mount *mp = ip->i_mount;
struct xfs_dquot *uq, *gq; struct xfs_dquot *uq = NULL;
struct xfs_dquot *gq = NULL;
int error; int error;
uint lockflags; uint lockflags;
...@@ -1682,7 +1683,6 @@ xfs_qm_vop_dqalloc( ...@@ -1682,7 +1683,6 @@ xfs_qm_vop_dqalloc(
} }
} }
uq = gq = NULL;
if ((flags & XFS_QMOPT_UQUOTA) && XFS_IS_UQUOTA_ON(mp)) { if ((flags & XFS_QMOPT_UQUOTA) && XFS_IS_UQUOTA_ON(mp)) {
if (ip->i_d.di_uid != uid) { if (ip->i_d.di_uid != uid) {
/* /*
...@@ -1695,11 +1695,12 @@ xfs_qm_vop_dqalloc( ...@@ -1695,11 +1695,12 @@ xfs_qm_vop_dqalloc(
* holding ilock. * holding ilock.
*/ */
xfs_iunlock(ip, lockflags); xfs_iunlock(ip, lockflags);
if ((error = xfs_qm_dqget(mp, NULL, (xfs_dqid_t) uid, error = xfs_qm_dqget(mp, NULL, (xfs_dqid_t) uid,
XFS_DQ_USER, XFS_DQ_USER,
XFS_QMOPT_DQALLOC | XFS_QMOPT_DQALLOC |
XFS_QMOPT_DOWARN, XFS_QMOPT_DOWARN,
&uq))) { &uq);
if (error) {
ASSERT(error != ENOENT); ASSERT(error != ENOENT);
return error; return error;
} }
...@@ -1721,15 +1722,14 @@ xfs_qm_vop_dqalloc( ...@@ -1721,15 +1722,14 @@ xfs_qm_vop_dqalloc(
if ((flags & XFS_QMOPT_GQUOTA) && XFS_IS_GQUOTA_ON(mp)) { if ((flags & XFS_QMOPT_GQUOTA) && XFS_IS_GQUOTA_ON(mp)) {
if (ip->i_d.di_gid != gid) { if (ip->i_d.di_gid != gid) {
xfs_iunlock(ip, lockflags); xfs_iunlock(ip, lockflags);
if ((error = xfs_qm_dqget(mp, NULL, (xfs_dqid_t)gid, error = xfs_qm_dqget(mp, NULL, (xfs_dqid_t)gid,
XFS_DQ_GROUP, XFS_DQ_GROUP,
XFS_QMOPT_DQALLOC | XFS_QMOPT_DQALLOC |
XFS_QMOPT_DOWARN, XFS_QMOPT_DOWARN,
&gq))) { &gq);
if (uq) if (error) {
xfs_qm_dqrele(uq);
ASSERT(error != ENOENT); ASSERT(error != ENOENT);
return error; goto error_rele;
} }
xfs_dqunlock(gq); xfs_dqunlock(gq);
lockflags = XFS_ILOCK_SHARED; lockflags = XFS_ILOCK_SHARED;
...@@ -1741,15 +1741,14 @@ xfs_qm_vop_dqalloc( ...@@ -1741,15 +1741,14 @@ xfs_qm_vop_dqalloc(
} else if ((flags & XFS_QMOPT_PQUOTA) && XFS_IS_PQUOTA_ON(mp)) { } else if ((flags & XFS_QMOPT_PQUOTA) && XFS_IS_PQUOTA_ON(mp)) {
if (xfs_get_projid(ip) != prid) { if (xfs_get_projid(ip) != prid) {
xfs_iunlock(ip, lockflags); xfs_iunlock(ip, lockflags);
if ((error = xfs_qm_dqget(mp, NULL, (xfs_dqid_t)prid, error = xfs_qm_dqget(mp, NULL, (xfs_dqid_t)prid,
XFS_DQ_PROJ, XFS_DQ_PROJ,
XFS_QMOPT_DQALLOC | XFS_QMOPT_DQALLOC |
XFS_QMOPT_DOWARN, XFS_QMOPT_DOWARN,
&gq))) { &gq);
if (uq) if (error) {
xfs_qm_dqrele(uq);
ASSERT(error != ENOENT); ASSERT(error != ENOENT);
return (error); goto error_rele;
} }
xfs_dqunlock(gq); xfs_dqunlock(gq);
lockflags = XFS_ILOCK_SHARED; lockflags = XFS_ILOCK_SHARED;
...@@ -1772,6 +1771,11 @@ xfs_qm_vop_dqalloc( ...@@ -1772,6 +1771,11 @@ xfs_qm_vop_dqalloc(
else if (gq) else if (gq)
xfs_qm_dqrele(gq); xfs_qm_dqrele(gq);
return 0; return 0;
error_rele:
if (uq)
xfs_qm_dqrele(uq);
return error;
} }
/* /*
...@@ -1819,29 +1823,31 @@ xfs_qm_vop_chown( ...@@ -1819,29 +1823,31 @@ xfs_qm_vop_chown(
*/ */
int int
xfs_qm_vop_chown_reserve( xfs_qm_vop_chown_reserve(
xfs_trans_t *tp, struct xfs_trans *tp,
xfs_inode_t *ip, struct xfs_inode *ip,
xfs_dquot_t *udqp, struct xfs_dquot *udqp,
xfs_dquot_t *gdqp, struct xfs_dquot *gdqp,
uint flags) uint flags)
{ {
xfs_mount_t *mp = ip->i_mount; struct xfs_mount *mp = ip->i_mount;
uint delblks, blkflags, prjflags = 0; uint delblks, blkflags, prjflags = 0;
xfs_dquot_t *unresudq, *unresgdq, *delblksudq, *delblksgdq; struct xfs_dquot *udq_unres = NULL;
int error; struct xfs_dquot *gdq_unres = NULL;
struct xfs_dquot *udq_delblks = NULL;
struct xfs_dquot *gdq_delblks = NULL;
int error;
ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL|XFS_ILOCK_SHARED)); ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL|XFS_ILOCK_SHARED));
ASSERT(XFS_IS_QUOTA_RUNNING(mp)); ASSERT(XFS_IS_QUOTA_RUNNING(mp));
delblks = ip->i_delayed_blks; delblks = ip->i_delayed_blks;
delblksudq = delblksgdq = unresudq = unresgdq = NULL;
blkflags = XFS_IS_REALTIME_INODE(ip) ? blkflags = XFS_IS_REALTIME_INODE(ip) ?
XFS_QMOPT_RES_RTBLKS : XFS_QMOPT_RES_REGBLKS; XFS_QMOPT_RES_RTBLKS : XFS_QMOPT_RES_REGBLKS;
if (XFS_IS_UQUOTA_ON(mp) && udqp && if (XFS_IS_UQUOTA_ON(mp) && udqp &&
ip->i_d.di_uid != (uid_t)be32_to_cpu(udqp->q_core.d_id)) { ip->i_d.di_uid != (uid_t)be32_to_cpu(udqp->q_core.d_id)) {
delblksudq = udqp; udq_delblks = udqp;
/* /*
* If there are delayed allocation blocks, then we have to * If there are delayed allocation blocks, then we have to
* unreserve those from the old dquot, and add them to the * unreserve those from the old dquot, and add them to the
...@@ -1849,7 +1855,7 @@ xfs_qm_vop_chown_reserve( ...@@ -1849,7 +1855,7 @@ xfs_qm_vop_chown_reserve(
*/ */
if (delblks) { if (delblks) {
ASSERT(ip->i_udquot); ASSERT(ip->i_udquot);
unresudq = ip->i_udquot; udq_unres = ip->i_udquot;
} }
} }
if (XFS_IS_OQUOTA_ON(ip->i_mount) && gdqp) { if (XFS_IS_OQUOTA_ON(ip->i_mount) && gdqp) {
...@@ -1860,18 +1866,19 @@ xfs_qm_vop_chown_reserve( ...@@ -1860,18 +1866,19 @@ xfs_qm_vop_chown_reserve(
if (prjflags || if (prjflags ||
(XFS_IS_GQUOTA_ON(ip->i_mount) && (XFS_IS_GQUOTA_ON(ip->i_mount) &&
ip->i_d.di_gid != be32_to_cpu(gdqp->q_core.d_id))) { ip->i_d.di_gid != be32_to_cpu(gdqp->q_core.d_id))) {
delblksgdq = gdqp; gdq_delblks = gdqp;
if (delblks) { if (delblks) {
ASSERT(ip->i_gdquot); ASSERT(ip->i_gdquot);
unresgdq = ip->i_gdquot; gdq_unres = ip->i_gdquot;
} }
} }
} }
if ((error = xfs_trans_reserve_quota_bydquots(tp, ip->i_mount, error = xfs_trans_reserve_quota_bydquots(tp, ip->i_mount,
delblksudq, delblksgdq, ip->i_d.di_nblocks, 1, udq_delblks, gdq_delblks, ip->i_d.di_nblocks, 1,
flags | blkflags | prjflags))) flags | blkflags | prjflags);
return (error); if (error)
return error;
/* /*
* Do the delayed blks reservations/unreservations now. Since, these * Do the delayed blks reservations/unreservations now. Since, these
...@@ -1883,14 +1890,15 @@ xfs_qm_vop_chown_reserve( ...@@ -1883,14 +1890,15 @@ xfs_qm_vop_chown_reserve(
/* /*
* Do the reservations first. Unreservation can't fail. * Do the reservations first. Unreservation can't fail.
*/ */
ASSERT(delblksudq || delblksgdq); ASSERT(udq_delblks || gdq_delblks);
ASSERT(unresudq || unresgdq); ASSERT(udq_unres || gdq_unres);
if ((error = xfs_trans_reserve_quota_bydquots(NULL, ip->i_mount, error = xfs_trans_reserve_quota_bydquots(NULL, ip->i_mount,
delblksudq, delblksgdq, (xfs_qcnt_t)delblks, 0, udq_delblks, gdq_delblks, (xfs_qcnt_t)delblks, 0,
flags | blkflags | prjflags))) flags | blkflags | prjflags);
return (error); if (error)
return error;
xfs_trans_reserve_quota_bydquots(NULL, ip->i_mount, xfs_trans_reserve_quota_bydquots(NULL, ip->i_mount,
unresudq, unresgdq, -((xfs_qcnt_t)delblks), 0, udq_unres, gdq_unres, -((xfs_qcnt_t)delblks), 0,
blkflags); blkflags);
} }
......
...@@ -103,11 +103,13 @@ xfs_dq_to_quota_inode(struct xfs_dquot *dqp) ...@@ -103,11 +103,13 @@ xfs_dq_to_quota_inode(struct xfs_dquot *dqp)
extern int xfs_qm_calc_dquots_per_chunk(struct xfs_mount *mp, extern int xfs_qm_calc_dquots_per_chunk(struct xfs_mount *mp,
unsigned int nbblks); unsigned int nbblks);
extern void xfs_trans_mod_dquot(xfs_trans_t *, xfs_dquot_t *, uint, long); extern void xfs_trans_mod_dquot(struct xfs_trans *,
extern int xfs_trans_reserve_quota_bydquots(xfs_trans_t *, xfs_mount_t *, struct xfs_dquot *, uint, long);
xfs_dquot_t *, xfs_dquot_t *, long, long, uint); extern int xfs_trans_reserve_quota_bydquots(struct xfs_trans *,
extern void xfs_trans_dqjoin(xfs_trans_t *, xfs_dquot_t *); struct xfs_mount *, struct xfs_dquot *,
extern void xfs_trans_log_dquot(xfs_trans_t *, xfs_dquot_t *); struct xfs_dquot *, long, long, uint);
extern void xfs_trans_dqjoin(struct xfs_trans *, struct xfs_dquot *);
extern void xfs_trans_log_dquot(struct xfs_trans *, struct xfs_dquot *);
/* /*
* We keep the usr and grp dquots separately so that locking will be easier * We keep the usr and grp dquots separately so that locking will be easier
...@@ -132,22 +134,23 @@ typedef struct xfs_dquot_acct { ...@@ -132,22 +134,23 @@ typedef struct xfs_dquot_acct {
#define XFS_QM_IWARNLIMIT 5 #define XFS_QM_IWARNLIMIT 5
#define XFS_QM_RTBWARNLIMIT 5 #define XFS_QM_RTBWARNLIMIT 5
extern void xfs_qm_destroy_quotainfo(xfs_mount_t *); extern void xfs_qm_destroy_quotainfo(struct xfs_mount *);
extern int xfs_qm_quotacheck(xfs_mount_t *); extern int xfs_qm_quotacheck(struct xfs_mount *);
extern int xfs_qm_write_sb_changes(xfs_mount_t *, __int64_t); extern int xfs_qm_write_sb_changes(struct xfs_mount *, __int64_t);
/* dquot stuff */ /* dquot stuff */
extern void xfs_qm_dqpurge_all(xfs_mount_t *, uint); extern void xfs_qm_dqpurge_all(struct xfs_mount *, uint);
extern void xfs_qm_dqrele_all_inodes(xfs_mount_t *, uint); extern void xfs_qm_dqrele_all_inodes(struct xfs_mount *, uint);
/* quota ops */ /* quota ops */
extern int xfs_qm_scall_trunc_qfiles(xfs_mount_t *, uint); extern int xfs_qm_scall_trunc_qfiles(struct xfs_mount *, uint);
extern int xfs_qm_scall_getquota(xfs_mount_t *, xfs_dqid_t, uint, extern int xfs_qm_scall_getquota(struct xfs_mount *, xfs_dqid_t,
fs_disk_quota_t *); uint, struct fs_disk_quota *);
extern int xfs_qm_scall_setqlim(struct xfs_mount *, xfs_dqid_t, uint, extern int xfs_qm_scall_setqlim(struct xfs_mount *, xfs_dqid_t, uint,
fs_disk_quota_t *); struct fs_disk_quota *);
extern int xfs_qm_scall_getqstat(xfs_mount_t *, fs_quota_stat_t *); extern int xfs_qm_scall_getqstat(struct xfs_mount *,
extern int xfs_qm_scall_quotaon(xfs_mount_t *, uint); struct fs_quota_stat *);
extern int xfs_qm_scall_quotaoff(xfs_mount_t *, uint); extern int xfs_qm_scall_quotaon(struct xfs_mount *, uint);
extern int xfs_qm_scall_quotaoff(struct xfs_mount *, uint);
#endif /* __XFS_QM_H__ */ #endif /* __XFS_QM_H__ */
...@@ -407,11 +407,11 @@ xfs_qm_scall_getqstat( ...@@ -407,11 +407,11 @@ xfs_qm_scall_getqstat(
struct fs_quota_stat *out) struct fs_quota_stat *out)
{ {
struct xfs_quotainfo *q = mp->m_quotainfo; struct xfs_quotainfo *q = mp->m_quotainfo;
struct xfs_inode *uip, *gip; struct xfs_inode *uip = NULL;
bool tempuqip, tempgqip; struct xfs_inode *gip = NULL;
bool tempuqip = false;
bool tempgqip = false;
uip = gip = NULL;
tempuqip = tempgqip = false;
memset(out, 0, sizeof(fs_quota_stat_t)); memset(out, 0, sizeof(fs_quota_stat_t));
out->qs_version = FS_QSTAT_VERSION; out->qs_version = FS_QSTAT_VERSION;
......
...@@ -358,7 +358,8 @@ xfs_symlink( ...@@ -358,7 +358,8 @@ xfs_symlink(
int n; int n;
xfs_buf_t *bp; xfs_buf_t *bp;
prid_t prid; prid_t prid;
struct xfs_dquot *udqp, *gdqp; struct xfs_dquot *udqp = NULL;
struct xfs_dquot *gdqp = NULL;
uint resblks; uint resblks;
*ipp = NULL; *ipp = NULL;
......
...@@ -169,13 +169,13 @@ xfs_trans_mod_dquot_byino( ...@@ -169,13 +169,13 @@ xfs_trans_mod_dquot_byino(
(void) xfs_trans_mod_dquot(tp, ip->i_gdquot, field, delta); (void) xfs_trans_mod_dquot(tp, ip->i_gdquot, field, delta);
} }
STATIC xfs_dqtrx_t * STATIC struct xfs_dqtrx *
xfs_trans_get_dqtrx( xfs_trans_get_dqtrx(
xfs_trans_t *tp, struct xfs_trans *tp,
xfs_dquot_t *dqp) struct xfs_dquot *dqp)
{ {
int i; int i;
xfs_dqtrx_t *qa; struct xfs_dqtrx *qa;
qa = XFS_QM_ISUDQ(dqp) ? qa = XFS_QM_ISUDQ(dqp) ?
tp->t_dqinfo->dqa_usrdquots : tp->t_dqinfo->dqa_grpdquots; tp->t_dqinfo->dqa_usrdquots : tp->t_dqinfo->dqa_grpdquots;
...@@ -747,15 +747,15 @@ xfs_trans_dqresv( ...@@ -747,15 +747,15 @@ xfs_trans_dqresv(
*/ */
int int
xfs_trans_reserve_quota_bydquots( xfs_trans_reserve_quota_bydquots(
xfs_trans_t *tp, struct xfs_trans *tp,
xfs_mount_t *mp, struct xfs_mount *mp,
xfs_dquot_t *udqp, struct xfs_dquot *udqp,
xfs_dquot_t *gdqp, struct xfs_dquot *gdqp,
long nblks, long nblks,
long ninos, long ninos,
uint flags) uint flags)
{ {
int resvd = 0, error; int error;
if (!XFS_IS_QUOTA_RUNNING(mp) || !XFS_IS_QUOTA_ON(mp)) if (!XFS_IS_QUOTA_RUNNING(mp) || !XFS_IS_QUOTA_ON(mp))
return 0; return 0;
...@@ -770,28 +770,24 @@ xfs_trans_reserve_quota_bydquots( ...@@ -770,28 +770,24 @@ xfs_trans_reserve_quota_bydquots(
(flags & ~XFS_QMOPT_ENOSPC)); (flags & ~XFS_QMOPT_ENOSPC));
if (error) if (error)
return error; return error;
resvd = 1;
} }
if (gdqp) { if (gdqp) {
error = xfs_trans_dqresv(tp, mp, gdqp, nblks, ninos, flags); error = xfs_trans_dqresv(tp, mp, gdqp, nblks, ninos, flags);
if (error) { if (error)
/* goto unwind_usr;
* can't do it, so backout previous reservation
*/
if (resvd) {
flags |= XFS_QMOPT_FORCE_RES;
xfs_trans_dqresv(tp, mp, udqp,
-nblks, -ninos, flags);
}
return error;
}
} }
/* /*
* Didn't change anything critical, so, no need to log * Didn't change anything critical, so, no need to log
*/ */
return 0; return 0;
unwind_usr:
flags |= XFS_QMOPT_FORCE_RES;
if (udqp)
xfs_trans_dqresv(tp, mp, udqp, -nblks, -ninos, flags);
return error;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment