aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_dquot.c
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2018-05-04 15:30:23 -0700
committerDarrick J. Wong <darrick.wong@oracle.com>2018-05-10 08:56:48 -0700
commit114e73ccfa2a51b47160f49524aa46f0d70cb8a9 (patch)
tree16762cedc8d858252ac47947e28e3201ff684149 /fs/xfs/xfs_dquot.c
parentxfs: refactor xfs_qm_dqtobp and xfs_qm_dqalloc (diff)
downloadlinux-dev-114e73ccfa2a51b47160f49524aa46f0d70cb8a9.tar.xz
linux-dev-114e73ccfa2a51b47160f49524aa46f0d70cb8a9.zip
xfs: remove direct calls to _qm_dqread
The quota initialization code needs an "uncached" variant of _dqget to read in default quota limits and timers before the dquot cache is fully set up. We've already split up _dqget into its component pieces so create a fourth variant to address this need, and make dqread internal to xfs_dquot.c again. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs/xfs/xfs_dquot.c')
-rw-r--r--fs/xfs/xfs_dquot.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/fs/xfs/xfs_dquot.c b/fs/xfs/xfs_dquot.c
index 22bb52ee82c8..5593a344732c 100644
--- a/fs/xfs/xfs_dquot.c
+++ b/fs/xfs/xfs_dquot.c
@@ -586,7 +586,7 @@ err:
*
* If XFS_QMOPT_DQALLOC is set, allocate a dquot on disk if it needed.
*/
-int
+static int
xfs_qm_dqread(
struct xfs_mount *mp,
xfs_dqid_t id,
@@ -832,6 +832,28 @@ restart:
return 0;
}
+/*
+ * Given a dquot id and type, read and initialize a dquot from the on-disk
+ * metadata. This function is only for use during quota initialization so
+ * it ignores the dquot cache assuming that the dquot shrinker isn't set up.
+ * The caller is responsible for _qm_dqdestroy'ing the returned dquot.
+ */
+int
+xfs_qm_dqget_uncached(
+ struct xfs_mount *mp,
+ xfs_dqid_t id,
+ uint type,
+ struct xfs_dquot **dqpp)
+{
+ int error;
+
+ error = xfs_qm_dqget_checks(mp, type);
+ if (error)
+ return error;
+
+ return xfs_qm_dqread(mp, id, type, 0, dqpp);
+}
+
/* Return the quota id for a given inode and type. */
xfs_dqid_t
xfs_qm_id_for_quotatype(