]> Git Repo - J-linux.git/commitdiff
xfs: reserve quota for realtime files correctly
authorDarrick J. Wong <[email protected]>
Mon, 4 Nov 2024 04:19:41 +0000 (20:19 -0800)
committerDarrick J. Wong <[email protected]>
Tue, 5 Nov 2024 21:38:46 +0000 (13:38 -0800)
Fix xfs_quota_reserve_blkres to reserve rt block quota whenever we're
dealing with a realtime file.

Signed-off-by: Darrick J. Wong <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
fs/xfs/xfs_quota.h
fs/xfs/xfs_trans_dquot.c

index 2d36d967380e7c5c8089f4d137eff67db861dc1d..fa1317cc396c96abf83090e50cfd80efba31ead8 100644 (file)
@@ -130,6 +130,7 @@ extern void xfs_qm_mount_quotas(struct xfs_mount *);
 extern void xfs_qm_unmount(struct xfs_mount *);
 extern void xfs_qm_unmount_quotas(struct xfs_mount *);
 bool xfs_inode_near_dquot_enforcement(struct xfs_inode *ip, xfs_dqtype_t type);
+int xfs_quota_reserve_blkres(struct xfs_inode *ip, int64_t blocks);
 
 # ifdef CONFIG_XFS_LIVE_HOOKS
 void xfs_trans_mod_ino_dquot(struct xfs_trans *tp, struct xfs_inode *ip,
@@ -209,6 +210,11 @@ xfs_trans_reserve_quota_icreate(struct xfs_trans *tp, struct xfs_dquot *udqp,
 #define xfs_qm_unmount_quotas(mp)
 #define xfs_inode_near_dquot_enforcement(ip, type)                     (false)
 
+static inline int xfs_quota_reserve_blkres(struct xfs_inode *ip, int64_t blocks)
+{
+       return 0;
+}
+
 # ifdef CONFIG_XFS_LIVE_HOOKS
 #  define xfs_dqtrx_hook_enable()              ((void)0)
 #  define xfs_dqtrx_hook_disable()             ((void)0)
@@ -216,12 +222,6 @@ xfs_trans_reserve_quota_icreate(struct xfs_trans *tp, struct xfs_dquot *udqp,
 
 #endif /* CONFIG_XFS_QUOTA */
 
-static inline int
-xfs_quota_reserve_blkres(struct xfs_inode *ip, int64_t blocks)
-{
-       return xfs_trans_reserve_quota_nblks(NULL, ip, blocks, 0, false);
-}
-
 static inline void
 xfs_quota_unreserve_blkres(struct xfs_inode *ip, uint64_t blocks)
 {
index ca7df018290e0edff19be69bdd9257eef02d69da..481ba3dc9f190d4b584afd4f57785f9a47fcf4b0 100644 (file)
@@ -1031,3 +1031,14 @@ xfs_trans_free_dqinfo(
        kmem_cache_free(xfs_dqtrx_cache, tp->t_dqinfo);
        tp->t_dqinfo = NULL;
 }
+
+int
+xfs_quota_reserve_blkres(
+       struct xfs_inode        *ip,
+       int64_t                 blocks)
+{
+       if (XFS_IS_REALTIME_INODE(ip))
+               return xfs_trans_reserve_quota_nblks(NULL, ip, 0, blocks,
+                               false);
+       return xfs_trans_reserve_quota_nblks(NULL, ip, blocks, 0, false);
+}
This page took 0.05727 seconds and 4 git commands to generate.