diff options
author | Mike Snitzer <snitzer@redhat.com> | 2014-05-20 13:38:33 -0400 |
---|---|---|
committer | Mike Snitzer <snitzer@redhat.com> | 2014-05-20 14:30:36 -0400 |
commit | 80c578930ce77ba8bcfb226a184b482020bdda7b (patch) | |
tree | a9fbfe8a07238c317651a283c9bbf230d4002bb5 | |
parent | 4cdd2ad78098244c1bc9ec4374ea1c225fd1cd6f (diff) |
dm thin: add 'no_space_timeout' dm-thin-pool module param
Commit 85ad643b ("dm thin: add timeout to stop out-of-data-space mode
holding IO forever") introduced a fixed 60 second timeout. Users may
want to either disable or modify this timeout.
Allow the out-of-data-space timeout to be configured using the
'no_space_timeout' dm-thin-pool module param. Setting it to 0 will
disable the timeout, resulting in IO being queued until more data space
is added to the thin-pool.
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Cc: stable@vger.kernel.org # 3.14+
-rw-r--r-- | Documentation/device-mapper/thin-provisioning.txt | 5 | ||||
-rw-r--r-- | drivers/md/dm-thin.c | 12 |
2 files changed, 13 insertions, 4 deletions
diff --git a/Documentation/device-mapper/thin-provisioning.txt b/Documentation/device-mapper/thin-provisioning.txt index 05a27e9442bd..2f5173500bd9 100644 --- a/Documentation/device-mapper/thin-provisioning.txt +++ b/Documentation/device-mapper/thin-provisioning.txt | |||
@@ -309,7 +309,10 @@ ii) Status | |||
309 | error_if_no_space|queue_if_no_space | 309 | error_if_no_space|queue_if_no_space |
310 | If the pool runs out of data or metadata space, the pool will | 310 | If the pool runs out of data or metadata space, the pool will |
311 | either queue or error the IO destined to the data device. The | 311 | either queue or error the IO destined to the data device. The |
312 | default is to queue the IO until more space is added. | 312 | default is to queue the IO until more space is added or the |
313 | 'no_space_timeout' expires. The 'no_space_timeout' dm-thin-pool | ||
314 | module parameter can be used to change this timeout -- it | ||
315 | defaults to 60 seconds but may be disabled using a value of 0. | ||
313 | 316 | ||
314 | iii) Messages | 317 | iii) Messages |
315 | 318 | ||
diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c index 2e71de8e0048..242ac2ea5f29 100644 --- a/drivers/md/dm-thin.c +++ b/drivers/md/dm-thin.c | |||
@@ -27,7 +27,9 @@ | |||
27 | #define MAPPING_POOL_SIZE 1024 | 27 | #define MAPPING_POOL_SIZE 1024 |
28 | #define PRISON_CELLS 1024 | 28 | #define PRISON_CELLS 1024 |
29 | #define COMMIT_PERIOD HZ | 29 | #define COMMIT_PERIOD HZ |
30 | #define NO_SPACE_TIMEOUT (HZ * 60) | 30 | #define NO_SPACE_TIMEOUT_SECS 60 |
31 | |||
32 | static unsigned no_space_timeout_secs = NO_SPACE_TIMEOUT_SECS; | ||
31 | 33 | ||
32 | DECLARE_DM_KCOPYD_THROTTLE_WITH_MODULE_PARM(snapshot_copy_throttle, | 34 | DECLARE_DM_KCOPYD_THROTTLE_WITH_MODULE_PARM(snapshot_copy_throttle, |
33 | "A percentage of time allocated for copy on write"); | 35 | "A percentage of time allocated for copy on write"); |
@@ -1670,6 +1672,7 @@ static void set_pool_mode(struct pool *pool, enum pool_mode new_mode) | |||
1670 | struct pool_c *pt = pool->ti->private; | 1672 | struct pool_c *pt = pool->ti->private; |
1671 | bool needs_check = dm_pool_metadata_needs_check(pool->pmd); | 1673 | bool needs_check = dm_pool_metadata_needs_check(pool->pmd); |
1672 | enum pool_mode old_mode = get_pool_mode(pool); | 1674 | enum pool_mode old_mode = get_pool_mode(pool); |
1675 | unsigned long no_space_timeout = ACCESS_ONCE(no_space_timeout_secs) * HZ; | ||
1673 | 1676 | ||
1674 | /* | 1677 | /* |
1675 | * Never allow the pool to transition to PM_WRITE mode if user | 1678 | * Never allow the pool to transition to PM_WRITE mode if user |
@@ -1732,8 +1735,8 @@ static void set_pool_mode(struct pool *pool, enum pool_mode new_mode) | |||
1732 | pool->process_prepared_mapping = process_prepared_mapping; | 1735 | pool->process_prepared_mapping = process_prepared_mapping; |
1733 | pool->process_prepared_discard = process_prepared_discard_passdown; | 1736 | pool->process_prepared_discard = process_prepared_discard_passdown; |
1734 | 1737 | ||
1735 | if (!pool->pf.error_if_no_space) | 1738 | if (!pool->pf.error_if_no_space && no_space_timeout) |
1736 | queue_delayed_work(pool->wq, &pool->no_space_timeout, NO_SPACE_TIMEOUT); | 1739 | queue_delayed_work(pool->wq, &pool->no_space_timeout, no_space_timeout); |
1737 | break; | 1740 | break; |
1738 | 1741 | ||
1739 | case PM_WRITE: | 1742 | case PM_WRITE: |
@@ -3508,6 +3511,9 @@ static void dm_thin_exit(void) | |||
3508 | module_init(dm_thin_init); | 3511 | module_init(dm_thin_init); |
3509 | module_exit(dm_thin_exit); | 3512 | module_exit(dm_thin_exit); |
3510 | 3513 | ||
3514 | module_param_named(no_space_timeout, no_space_timeout_secs, uint, S_IRUGO | S_IWUSR); | ||
3515 | MODULE_PARM_DESC(no_space_timeout, "Out of data space queue IO timeout in seconds"); | ||
3516 | |||
3511 | MODULE_DESCRIPTION(DM_NAME " thin provisioning target"); | 3517 | MODULE_DESCRIPTION(DM_NAME " thin provisioning target"); |
3512 | MODULE_AUTHOR("Joe Thornber <dm-devel@redhat.com>"); | 3518 | MODULE_AUTHOR("Joe Thornber <dm-devel@redhat.com>"); |
3513 | MODULE_LICENSE("GPL"); | 3519 | MODULE_LICENSE("GPL"); |