@@ -2014,6 +2014,8 @@ xfs_alloc_buftarg(
btp->bt_bdev = bdev;
btp->bt_daxdev = fs_dax_get_by_bdev(bdev, &btp->bt_dax_part_off,
mp, ops);
+ if (bdev_max_provision_sectors(bdev))
+ btp->bt_needs_provisioning = true;
/*
* Buffer IO error rate limiting. Limit it to no more than 10 messages
@@ -106,6 +106,7 @@ typedef struct xfs_buftarg {
size_t bt_meta_sectormask;
size_t bt_logical_sectorsize;
size_t bt_logical_sectormask;
+ bool bt_needs_provisioning;
/* LRU control structures */
struct shrinker bt_shrinker;
@@ -407,6 +407,13 @@ __XFS_HAS_FEAT(nouuid, NOUUID)
#define XFS_OPSTATE_WARNED_LARP 9
/* Mount time quotacheck is running */
#define XFS_OPSTATE_QUOTACHECK_RUNNING 10
+/*
+ * If the block device underlying either the data or rt volume needs
+ * provisioning to guarantee space availability, this flag will be set.
+ * Operations that need to check, issue or free provisioning trigger off
+ * this flag.
+ */
+#define XFS_OPSTATE_PROVISION_BLOCKS 11
#define __XFS_IS_OPSTATE(name, NAME) \
static inline bool xfs_is_ ## name (struct xfs_mount *mp) \
@@ -434,6 +441,7 @@ __XFS_IS_OPSTATE(quotacheck_running, QUOTACHECK_RUNNING)
#else
# define xfs_is_quotacheck_running(mp) (false)
#endif
+__XFS_IS_OPSTATE(provisioning_blocks, PROVISION_BLOCKS)
static inline bool
xfs_should_warn(struct xfs_mount *mp, long nr)
@@ -452,7 +460,8 @@ xfs_should_warn(struct xfs_mount *mp, long nr)
{ (1UL << XFS_OPSTATE_WARNED_SCRUB), "wscrub" }, \
{ (1UL << XFS_OPSTATE_WARNED_SHRINK), "wshrink" }, \
{ (1UL << XFS_OPSTATE_WARNED_LARP), "wlarp" }, \
- { (1UL << XFS_OPSTATE_QUOTACHECK_RUNNING), "quotacheck" }
+ { (1UL << XFS_OPSTATE_QUOTACHECK_RUNNING), "quotacheck" }, \
+ { (1UL << XFS_OPSTATE_PROVISION_BLOCKS), "provision" }
/*
* Max and min values for mount-option defined I/O
@@ -471,11 +471,15 @@ xfs_open_devices(
mp->m_ddev_targp = xfs_alloc_buftarg(mp, ddev);
if (!mp->m_ddev_targp)
goto out_close_rtdev;
+ if (mp->m_ddev_targp->bt_needs_provisioning)
+ xfs_set_provisioning_blocks(mp);
if (rtdev) {
mp->m_rtdev_targp = xfs_alloc_buftarg(mp, rtdev);
if (!mp->m_rtdev_targp)
goto out_free_ddev_targ;
+ if (mp->m_rtdev_targp->bt_needs_provisioning)
+ xfs_set_provisioning_blocks(mp);
}
if (logdev && logdev != ddev) {