summaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_dquot.c
diff options
context:
space:
mode:
authorDarrick J. Wong2018-05-05 00:30:24 +0200
committerDarrick J. Wong2018-05-10 17:56:48 +0200
commit30ab2dcf2c0693e518b1920e6edc4212cba10d10 (patch)
tree40561e9ad625ae8e6e7dbc19a64919b31ef02832 /fs/xfs/xfs_dquot.c
parentxfs: remove direct calls to _qm_dqread (diff)
downloadkernel-qcow2-linux-30ab2dcf2c0693e518b1920e6edc4212cba10d10.tar.gz
kernel-qcow2-linux-30ab2dcf2c0693e518b1920e6edc4212cba10d10.tar.xz
kernel-qcow2-linux-30ab2dcf2c0693e518b1920e6edc4212cba10d10.zip
xfs: replace XFS_QMOPT_DQALLOC with a simple boolean
DQALLOC is only ever used with xfs_qm_dqget*, and the only flag that the _dqget family of functions cares about is DQALLOC. Therefore, change it to a boolean 'can alloc?' flag for the dqget interfaces where that makes sense. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Brian Foster <bfoster@redhat.com>
Diffstat (limited to 'fs/xfs/xfs_dquot.c')
-rw-r--r--fs/xfs/xfs_dquot.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/fs/xfs/xfs_dquot.c b/fs/xfs/xfs_dquot.c
index 5593a344732c..85f9ffd99998 100644
--- a/fs/xfs/xfs_dquot.c
+++ b/fs/xfs/xfs_dquot.c
@@ -582,16 +582,15 @@ err:
/*
* Read in the ondisk dquot using dqtobp() then copy it to an incore version,
- * and release the buffer immediately.
- *
- * If XFS_QMOPT_DQALLOC is set, allocate a dquot on disk if it needed.
+ * and release the buffer immediately. If @can_alloc is true, fill any
+ * holes in the on-disk metadata.
*/
static int
xfs_qm_dqread(
struct xfs_mount *mp,
xfs_dqid_t id,
uint type,
- uint flags,
+ bool can_alloc,
struct xfs_dquot **dqpp)
{
struct xfs_dquot *dqp;
@@ -603,7 +602,7 @@ xfs_qm_dqread(
/* Try to read the buffer, allocating if necessary. */
error = xfs_dquot_disk_read(mp, dqp, &bp);
- if (error == -ENOENT && (flags & XFS_QMOPT_DQALLOC))
+ if (error == -ENOENT && can_alloc)
error = xfs_qm_dqread_alloc(mp, dqp, &bp);
if (error)
goto err;
@@ -793,7 +792,7 @@ xfs_qm_dqget(
struct xfs_mount *mp,
xfs_dqid_t id,
uint type,
- uint flags, /* DQALLOC, DQSUSER, DQREPAIR, DOWARN */
+ bool can_alloc,
struct xfs_dquot **O_dqpp)
{
struct xfs_quotainfo *qi = mp->m_quotainfo;
@@ -812,7 +811,7 @@ restart:
return 0;
}
- error = xfs_qm_dqread(mp, id, type, flags, &dqp);
+ error = xfs_qm_dqread(mp, id, type, can_alloc, &dqp);
if (error)
return error;
@@ -889,16 +888,12 @@ xfs_qm_dqget_inode(
struct radix_tree_root *tree = xfs_dquot_tree(qi, type);
struct xfs_dquot *dqp;
xfs_dqid_t id;
- uint flags = 0;
int error;
error = xfs_qm_dqget_checks(mp, type);
if (error)
return error;
- if (can_alloc)
- flags |= XFS_QMOPT_DQALLOC;
-
ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
ASSERT(xfs_inode_dquot(ip, type) == NULL);
@@ -919,7 +914,7 @@ restart:
* we re-acquire the lock.
*/
xfs_iunlock(ip, XFS_ILOCK_EXCL);
- error = xfs_qm_dqread(mp, id, type, flags, &dqp);
+ error = xfs_qm_dqread(mp, id, type, can_alloc, &dqp);
xfs_ilock(ip, XFS_ILOCK_EXCL);
if (error)
return error;
@@ -978,7 +973,7 @@ xfs_qm_dqget_next(
*dqpp = NULL;
for (; !error; error = xfs_dq_get_next_id(mp, type, &id)) {
- error = xfs_qm_dqget(mp, id, type, 0, &dqp);
+ error = xfs_qm_dqget(mp, id, type, false, &dqp);
if (error == -ENOENT)
continue;
else if (error != 0)