Skip to content

Commit b7020ba

Browse files
author
Darrick J. Wong
committed
xfs: reserve quota for realtime files correctly
Fix xfs_quota_reserve_blkres to reserve rt block quota whenever we're dealing with a realtime file. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de>
1 parent 5dd7085 commit b7020ba

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

fs/xfs/xfs_quota.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ extern void xfs_qm_mount_quotas(struct xfs_mount *);
130130
extern void xfs_qm_unmount(struct xfs_mount *);
131131
extern void xfs_qm_unmount_quotas(struct xfs_mount *);
132132
bool xfs_inode_near_dquot_enforcement(struct xfs_inode *ip, xfs_dqtype_t type);
133+
int xfs_quota_reserve_blkres(struct xfs_inode *ip, int64_t blocks);
133134

134135
# ifdef CONFIG_XFS_LIVE_HOOKS
135136
void xfs_trans_mod_ino_dquot(struct xfs_trans *tp, struct xfs_inode *ip,
@@ -209,19 +210,18 @@ xfs_trans_reserve_quota_icreate(struct xfs_trans *tp, struct xfs_dquot *udqp,
209210
#define xfs_qm_unmount_quotas(mp)
210211
#define xfs_inode_near_dquot_enforcement(ip, type) (false)
211212

213+
static inline int xfs_quota_reserve_blkres(struct xfs_inode *ip, int64_t blocks)
214+
{
215+
return 0;
216+
}
217+
212218
# ifdef CONFIG_XFS_LIVE_HOOKS
213219
# define xfs_dqtrx_hook_enable() ((void)0)
214220
# define xfs_dqtrx_hook_disable() ((void)0)
215221
# endif /* CONFIG_XFS_LIVE_HOOKS */
216222

217223
#endif /* CONFIG_XFS_QUOTA */
218224

219-
static inline int
220-
xfs_quota_reserve_blkres(struct xfs_inode *ip, int64_t blocks)
221-
{
222-
return xfs_trans_reserve_quota_nblks(NULL, ip, blocks, 0, false);
223-
}
224-
225225
static inline void
226226
xfs_quota_unreserve_blkres(struct xfs_inode *ip, uint64_t blocks)
227227
{

fs/xfs/xfs_trans_dquot.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,3 +1031,14 @@ xfs_trans_free_dqinfo(
10311031
kmem_cache_free(xfs_dqtrx_cache, tp->t_dqinfo);
10321032
tp->t_dqinfo = NULL;
10331033
}
1034+
1035+
int
1036+
xfs_quota_reserve_blkres(
1037+
struct xfs_inode *ip,
1038+
int64_t blocks)
1039+
{
1040+
if (XFS_IS_REALTIME_INODE(ip))
1041+
return xfs_trans_reserve_quota_nblks(NULL, ip, 0, blocks,
1042+
false);
1043+
return xfs_trans_reserve_quota_nblks(NULL, ip, blocks, 0, false);
1044+
}

0 commit comments

Comments
 (0)