Commit b7020ba8 authored by Darrick J. Wong's avatar Darrick J. Wong
Browse files

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: default avatarDarrick J. Wong <djwong@kernel.org>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
parent 5dd70852
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -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)
{
+11 −0
Original line number Diff line number Diff line
@@ -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);
}