mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-08 14:13:53 +00:00
xfs: convert quotacheck to use the new iwalk functions
Convert quotacheck to use the new iwalk iterator to dig through the inodes. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com>
This commit is contained in:
parent
a211432c27
commit
ebd126a651
@ -13,7 +13,7 @@
|
|||||||
#include "xfs_sb.h"
|
#include "xfs_sb.h"
|
||||||
#include "xfs_mount.h"
|
#include "xfs_mount.h"
|
||||||
#include "xfs_inode.h"
|
#include "xfs_inode.h"
|
||||||
#include "xfs_itable.h"
|
#include "xfs_iwalk.h"
|
||||||
#include "xfs_quota.h"
|
#include "xfs_quota.h"
|
||||||
#include "xfs_bmap.h"
|
#include "xfs_bmap.h"
|
||||||
#include "xfs_bmap_util.h"
|
#include "xfs_bmap_util.h"
|
||||||
@ -1114,17 +1114,15 @@ xfs_qm_quotacheck_dqadjust(
|
|||||||
/* ARGSUSED */
|
/* ARGSUSED */
|
||||||
STATIC int
|
STATIC int
|
||||||
xfs_qm_dqusage_adjust(
|
xfs_qm_dqusage_adjust(
|
||||||
xfs_mount_t *mp, /* mount point for filesystem */
|
struct xfs_mount *mp,
|
||||||
xfs_ino_t ino, /* inode number to get data for */
|
struct xfs_trans *tp,
|
||||||
void __user *buffer, /* not used */
|
xfs_ino_t ino,
|
||||||
int ubsize, /* not used */
|
void *data)
|
||||||
int *ubused, /* not used */
|
|
||||||
int *res) /* result code value */
|
|
||||||
{
|
{
|
||||||
xfs_inode_t *ip;
|
struct xfs_inode *ip;
|
||||||
xfs_qcnt_t nblks;
|
xfs_qcnt_t nblks;
|
||||||
xfs_filblks_t rtblks = 0; /* total rt blks */
|
xfs_filblks_t rtblks = 0; /* total rt blks */
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
ASSERT(XFS_IS_QUOTA_RUNNING(mp));
|
ASSERT(XFS_IS_QUOTA_RUNNING(mp));
|
||||||
|
|
||||||
@ -1132,20 +1130,18 @@ xfs_qm_dqusage_adjust(
|
|||||||
* rootino must have its resources accounted for, not so with the quota
|
* rootino must have its resources accounted for, not so with the quota
|
||||||
* inodes.
|
* inodes.
|
||||||
*/
|
*/
|
||||||
if (xfs_is_quota_inode(&mp->m_sb, ino)) {
|
if (xfs_is_quota_inode(&mp->m_sb, ino))
|
||||||
*res = BULKSTAT_RV_NOTHING;
|
return 0;
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We don't _need_ to take the ilock EXCL here because quotacheck runs
|
* We don't _need_ to take the ilock EXCL here because quotacheck runs
|
||||||
* at mount time and therefore nobody will be racing chown/chproj.
|
* at mount time and therefore nobody will be racing chown/chproj.
|
||||||
*/
|
*/
|
||||||
error = xfs_iget(mp, NULL, ino, XFS_IGET_DONTCACHE, 0, &ip);
|
error = xfs_iget(mp, tp, ino, XFS_IGET_DONTCACHE, 0, &ip);
|
||||||
if (error) {
|
if (error == -EINVAL || error == -ENOENT)
|
||||||
*res = BULKSTAT_RV_NOTHING;
|
return 0;
|
||||||
|
if (error)
|
||||||
return error;
|
return error;
|
||||||
}
|
|
||||||
|
|
||||||
ASSERT(ip->i_delayed_blks == 0);
|
ASSERT(ip->i_delayed_blks == 0);
|
||||||
|
|
||||||
@ -1153,7 +1149,7 @@ xfs_qm_dqusage_adjust(
|
|||||||
struct xfs_ifork *ifp = XFS_IFORK_PTR(ip, XFS_DATA_FORK);
|
struct xfs_ifork *ifp = XFS_IFORK_PTR(ip, XFS_DATA_FORK);
|
||||||
|
|
||||||
if (!(ifp->if_flags & XFS_IFEXTENTS)) {
|
if (!(ifp->if_flags & XFS_IFEXTENTS)) {
|
||||||
error = xfs_iread_extents(NULL, ip, XFS_DATA_FORK);
|
error = xfs_iread_extents(tp, ip, XFS_DATA_FORK);
|
||||||
if (error)
|
if (error)
|
||||||
goto error0;
|
goto error0;
|
||||||
}
|
}
|
||||||
@ -1196,13 +1192,8 @@ xfs_qm_dqusage_adjust(
|
|||||||
goto error0;
|
goto error0;
|
||||||
}
|
}
|
||||||
|
|
||||||
xfs_irele(ip);
|
|
||||||
*res = BULKSTAT_RV_DIDONE;
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
error0:
|
error0:
|
||||||
xfs_irele(ip);
|
xfs_irele(ip);
|
||||||
*res = BULKSTAT_RV_GIVEUP;
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1266,18 +1257,13 @@ STATIC int
|
|||||||
xfs_qm_quotacheck(
|
xfs_qm_quotacheck(
|
||||||
xfs_mount_t *mp)
|
xfs_mount_t *mp)
|
||||||
{
|
{
|
||||||
int done, count, error, error2;
|
int error, error2;
|
||||||
xfs_ino_t lastino;
|
|
||||||
size_t structsz;
|
|
||||||
uint flags;
|
uint flags;
|
||||||
LIST_HEAD (buffer_list);
|
LIST_HEAD (buffer_list);
|
||||||
struct xfs_inode *uip = mp->m_quotainfo->qi_uquotaip;
|
struct xfs_inode *uip = mp->m_quotainfo->qi_uquotaip;
|
||||||
struct xfs_inode *gip = mp->m_quotainfo->qi_gquotaip;
|
struct xfs_inode *gip = mp->m_quotainfo->qi_gquotaip;
|
||||||
struct xfs_inode *pip = mp->m_quotainfo->qi_pquotaip;
|
struct xfs_inode *pip = mp->m_quotainfo->qi_pquotaip;
|
||||||
|
|
||||||
count = INT_MAX;
|
|
||||||
structsz = 1;
|
|
||||||
lastino = 0;
|
|
||||||
flags = 0;
|
flags = 0;
|
||||||
|
|
||||||
ASSERT(uip || gip || pip);
|
ASSERT(uip || gip || pip);
|
||||||
@ -1314,18 +1300,9 @@ xfs_qm_quotacheck(
|
|||||||
flags |= XFS_PQUOTA_CHKD;
|
flags |= XFS_PQUOTA_CHKD;
|
||||||
}
|
}
|
||||||
|
|
||||||
do {
|
error = xfs_iwalk(mp, NULL, 0, xfs_qm_dqusage_adjust, 0, NULL);
|
||||||
/*
|
if (error)
|
||||||
* Iterate thru all the inodes in the file system,
|
goto error_return;
|
||||||
* adjusting the corresponding dquot counters in core.
|
|
||||||
*/
|
|
||||||
error = xfs_bulkstat(mp, &lastino, &count,
|
|
||||||
xfs_qm_dqusage_adjust,
|
|
||||||
structsz, NULL, &done);
|
|
||||||
if (error)
|
|
||||||
break;
|
|
||||||
|
|
||||||
} while (!done);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We've made all the changes that we need to make incore. Flush them
|
* We've made all the changes that we need to make incore. Flush them
|
||||||
|
Loading…
Reference in New Issue
Block a user