|
37 | 37 | #include <sys/dmu_tx.h>
|
38 | 38 | #include <sys/dmu_objset.h>
|
39 | 39 | #include <sys/arc.h>
|
| 40 | +#include <sys/arc_impl.h> |
40 | 41 | #include <sys/zap.h>
|
41 | 42 | #include <sys/zio.h>
|
42 | 43 | #include <sys/zfs_context.h>
|
@@ -126,7 +127,7 @@ static boolean_t scan_ds_queue_contains(dsl_scan_t *scn, uint64_t dsobj,
|
126 | 127 | static void scan_ds_queue_insert(dsl_scan_t *scn, uint64_t dsobj, uint64_t txg);
|
127 | 128 | static void scan_ds_queue_remove(dsl_scan_t *scn, uint64_t dsobj);
|
128 | 129 | static void scan_ds_queue_sync(dsl_scan_t *scn, dmu_tx_t *tx);
|
129 |
| -static uint64_t dsl_scan_count_data_disks(vdev_t *vd); |
| 130 | +static uint64_t dsl_scan_count_data_disks(spa_t *spa); |
130 | 131 |
|
131 | 132 | extern int zfs_vdev_async_write_active_min_dirty_percent;
|
132 | 133 | static int zfs_scan_blkstats = 0;
|
@@ -156,7 +157,7 @@ int zfs_scan_strict_mem_lim = B_FALSE;
|
156 | 157 | * overload the drives with I/O, since that is protected by
|
157 | 158 | * zfs_vdev_scrub_max_active.
|
158 | 159 | */
|
159 |
| -unsigned long zfs_scan_vdev_limit = 4 << 20; |
| 160 | +unsigned long zfs_scan_vdev_limit = 16 << 20; |
160 | 161 |
|
161 | 162 | int zfs_scan_issue_strategy = 0;
|
162 | 163 | int zfs_scan_legacy = B_FALSE; /* don't queue & sort zios, go direct */
|
@@ -459,11 +460,12 @@ dsl_scan_init(dsl_pool_t *dp, uint64_t txg)
|
459 | 460 |
|
460 | 461 | /*
|
461 | 462 | * Calculate the max number of in-flight bytes for pool-wide
|
462 |
| - * scanning operations (minimum 1MB). Limits for the issuing |
463 |
| - * phase are done per top-level vdev and are handled separately. |
| 463 | + * scanning operations (minimum 1MB, maximum 1/4 of arc_c_max). |
| 464 | + * Limits for the issuing phase are done per top-level vdev and |
| 465 | + * are handled separately. |
464 | 466 | */
|
465 |
| - scn->scn_maxinflight_bytes = MAX(zfs_scan_vdev_limit * |
466 |
| - dsl_scan_count_data_disks(spa->spa_root_vdev), 1ULL << 20); |
| 467 | + scn->scn_maxinflight_bytes = MIN(arc_c_max / 4, MAX(1ULL << 20, |
| 468 | + zfs_scan_vdev_limit * dsl_scan_count_data_disks(spa))); |
467 | 469 |
|
468 | 470 | avl_create(&scn->scn_queue, scan_ds_queue_compare, sizeof (scan_ds_t),
|
469 | 471 | offsetof(scan_ds_t, sds_node));
|
@@ -2794,8 +2796,9 @@ dsl_scan_visit(dsl_scan_t *scn, dmu_tx_t *tx)
|
2794 | 2796 | }
|
2795 | 2797 |
|
2796 | 2798 | static uint64_t
|
2797 |
| -dsl_scan_count_data_disks(vdev_t *rvd) |
| 2799 | +dsl_scan_count_data_disks(spa_t *spa) |
2798 | 2800 | {
|
| 2801 | + vdev_t *rvd = spa->spa_root_vdev; |
2799 | 2802 | uint64_t i, leaves = 0;
|
2800 | 2803 |
|
2801 | 2804 | for (i = 0; i < rvd->vdev_children; i++) {
|
@@ -3700,12 +3703,13 @@ dsl_scan_sync(dsl_pool_t *dp, dmu_tx_t *tx)
|
3700 | 3703 | taskqid_t prefetch_tqid;
|
3701 | 3704 |
|
3702 | 3705 | /*
|
3703 |
| - * Recalculate the max number of in-flight bytes for pool-wide |
3704 |
| - * scanning operations (minimum 1MB). Limits for the issuing |
3705 |
| - * phase are done per top-level vdev and are handled separately. |
| 3706 | + * Calculate the max number of in-flight bytes for pool-wide |
| 3707 | + * scanning operations (minimum 1MB, maximum 1/4 of arc_c_max). |
| 3708 | + * Limits for the issuing phase are done per top-level vdev and |
| 3709 | + * are handled separately. |
3706 | 3710 | */
|
3707 |
| - scn->scn_maxinflight_bytes = MAX(zfs_scan_vdev_limit * |
3708 |
| - dsl_scan_count_data_disks(spa->spa_root_vdev), 1ULL << 20); |
| 3711 | + scn->scn_maxinflight_bytes = MIN(arc_c_max / 4, MAX(1ULL << 20, |
| 3712 | + zfs_scan_vdev_limit * dsl_scan_count_data_disks(spa))); |
3709 | 3713 |
|
3710 | 3714 | if (scnp->scn_ddt_bookmark.ddb_class <=
|
3711 | 3715 | scnp->scn_ddt_class_max) {
|
|
0 commit comments