diff options
author | Matthew Macy <[email protected]> | 2019-09-05 14:49:49 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2019-09-05 14:49:49 -0700 |
commit | 03fdcb9adc596fb86a65edb56d8088b77ea2d891 (patch) | |
tree | c68cec08565296ad37d53677fdfbc4d5c6e7ef7d /module/zfs/arc.c | |
parent | 65a91b166e66a57c44b62bb5ca20ccb6f0ecc46d (diff) |
Make module tunables cross platform
Adds ZFS_MODULE_PARAM to abstract module parameter
setting to operating systems other than Linux.
Reviewed-by: Jorgen Lundman <[email protected]>
Reviewed-by: Igor Kozhukhov <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Matt Macy <[email protected]>
Signed-off-by: Ryan Moeller <[email protected]>
Closes #9230
Diffstat (limited to 'module/zfs/arc.c')
-rw-r--r-- | module/zfs/arc.c | 140 |
1 files changed, 66 insertions, 74 deletions
diff --git a/module/zfs/arc.c b/module/zfs/arc.c index 1235074ef..187158955 100644 --- a/module/zfs/arc.c +++ b/module/zfs/arc.c @@ -893,7 +893,8 @@ static arc_state_t *arc_l2c_only; #define arc_tempreserve ARCSTAT(arcstat_tempreserve) #define arc_loaned_bytes ARCSTAT(arcstat_loaned_bytes) #define arc_meta_limit ARCSTAT(arcstat_meta_limit) /* max size for metadata */ -#define arc_dnode_limit ARCSTAT(arcstat_dnode_limit) /* max size for dnodes */ +/* max size for dnodes */ +#define arc_dnode_size_limit ARCSTAT(arcstat_dnode_limit) #define arc_meta_min ARCSTAT(arcstat_meta_min) /* min size for metadata */ #define arc_meta_max ARCSTAT(arcstat_meta_max) /* max size of metadata */ #define arc_need_free ARCSTAT(arcstat_need_free) /* bytes to be freed */ @@ -4214,9 +4215,9 @@ arc_evict_state(arc_state_t *state, uint64_t spa, int64_t bytes, * shrinker. */ if (type == ARC_BUFC_DATA && aggsum_compare(&astat_dnode_size, - arc_dnode_limit) > 0) { + arc_dnode_size_limit) > 0) { arc_prune_async((aggsum_upper_bound(&astat_dnode_size) - - arc_dnode_limit) / sizeof (dnode_t) / + arc_dnode_size_limit) / sizeof (dnode_t) / zfs_arc_dnode_reduce_percent); } @@ -7573,8 +7574,8 @@ arc_tuning_update(void) arc_p = (arc_c >> 1); if (arc_meta_limit > arc_c_max) arc_meta_limit = arc_c_max; - if (arc_dnode_limit > arc_meta_limit) - arc_dnode_limit = arc_meta_limit; + if (arc_dnode_size_limit > arc_meta_limit) + arc_dnode_size_limit = arc_meta_limit; } /* Valid range: 32M - <arc_c_max> */ @@ -7592,8 +7593,8 @@ arc_tuning_update(void) arc_meta_min = zfs_arc_meta_min; if (arc_meta_limit < arc_meta_min) arc_meta_limit = arc_meta_min; - if (arc_dnode_limit < arc_meta_min) - arc_dnode_limit = arc_meta_min; + if (arc_dnode_size_limit < arc_meta_min) + arc_dnode_size_limit = arc_meta_min; } /* Valid range: <arc_meta_min> - <arc_c_max> */ @@ -7607,10 +7608,10 @@ arc_tuning_update(void) /* Valid range: <arc_meta_min> - <arc_meta_limit> */ limit = zfs_arc_dnode_limit ? zfs_arc_dnode_limit : MIN(zfs_arc_dnode_limit_percent, 100) * arc_meta_limit / 100; - if ((limit != arc_dnode_limit) && + if ((limit != arc_dnode_size_limit) && (limit >= arc_meta_min) && (limit <= arc_meta_limit)) - arc_dnode_limit = limit; + arc_dnode_size_limit = limit; /* Valid range: 1 - N */ if (zfs_arc_grow_retry) @@ -7840,7 +7841,7 @@ arc_init(void) percent = MIN(zfs_arc_meta_limit_percent, 100); arc_meta_limit = MAX(arc_meta_min, (percent * arc_c_max) / 100); percent = MIN(zfs_arc_dnode_limit_percent, 100); - arc_dnode_limit = (percent * arc_meta_limit) / 100; + arc_dnode_size_limit = (percent * arc_meta_limit) / 100; /* Apply user specified tunings */ arc_tuning_update(); @@ -9376,7 +9377,6 @@ l2arc_stop(void) mutex_exit(&l2arc_feed_thr_lock); } -#if defined(_KERNEL) EXPORT_SYMBOL(arc_buf_size); EXPORT_SYMBOL(arc_write); EXPORT_SYMBOL(arc_read); @@ -9386,104 +9386,96 @@ EXPORT_SYMBOL(arc_add_prune_callback); EXPORT_SYMBOL(arc_remove_prune_callback); /* BEGIN CSTYLED */ -module_param(zfs_arc_min, ulong, 0644); -MODULE_PARM_DESC(zfs_arc_min, "Min arc size"); +ZFS_MODULE_PARAM(zfs_arc, zfs_arc_, min, ULONG, ZMOD_RW, + "Min arc size"); -module_param(zfs_arc_max, ulong, 0644); -MODULE_PARM_DESC(zfs_arc_max, "Max arc size"); +ZFS_MODULE_PARAM(zfs_arc, zfs_arc_, max, ULONG, ZMOD_RW, + "Max arc size"); -module_param(zfs_arc_meta_limit, ulong, 0644); -MODULE_PARM_DESC(zfs_arc_meta_limit, "Meta limit for arc size"); +ZFS_MODULE_PARAM(zfs_arc, zfs_arc_, meta_limit, ULONG, ZMOD_RW, + "Metadata limit for arc size"); -module_param(zfs_arc_meta_limit_percent, ulong, 0644); -MODULE_PARM_DESC(zfs_arc_meta_limit_percent, +ZFS_MODULE_PARAM(zfs_arc, zfs_arc_, meta_limit_percent, ULONG, ZMOD_RW, "Percent of arc size for arc meta limit"); -module_param(zfs_arc_meta_min, ulong, 0644); -MODULE_PARM_DESC(zfs_arc_meta_min, "Min arc metadata"); +ZFS_MODULE_PARAM(zfs_arc, zfs_arc_, meta_min, ULONG, ZMOD_RW, + "Min arc metadata"); -module_param(zfs_arc_meta_prune, int, 0644); -MODULE_PARM_DESC(zfs_arc_meta_prune, "Meta objects to scan for prune"); +ZFS_MODULE_PARAM(zfs_arc, zfs_arc_, meta_prune, INT, ZMOD_RW, + "Meta objects to scan for prune"); -module_param(zfs_arc_meta_adjust_restarts, int, 0644); -MODULE_PARM_DESC(zfs_arc_meta_adjust_restarts, +ZFS_MODULE_PARAM(zfs_arc, zfs_arc_, meta_adjust_restarts, INT, ZMOD_RW, "Limit number of restarts in arc_adjust_meta"); -module_param(zfs_arc_meta_strategy, int, 0644); -MODULE_PARM_DESC(zfs_arc_meta_strategy, "Meta reclaim strategy"); +ZFS_MODULE_PARAM(zfs_arc, zfs_arc_, meta_strategy, INT, ZMOD_RW, + "Meta reclaim strategy"); -module_param(zfs_arc_grow_retry, int, 0644); -MODULE_PARM_DESC(zfs_arc_grow_retry, "Seconds before growing arc size"); +ZFS_MODULE_PARAM(zfs_arc, zfs_arc_, grow_retry, INT, ZMOD_RW, + "Seconds before growing arc size"); -module_param(zfs_arc_p_dampener_disable, int, 0644); -MODULE_PARM_DESC(zfs_arc_p_dampener_disable, "disable arc_p adapt dampener"); +ZFS_MODULE_PARAM(zfs_arc, zfs_arc_, p_dampener_disable, INT, ZMOD_RW, + "Disable arc_p adapt dampener"); -module_param(zfs_arc_shrink_shift, int, 0644); -MODULE_PARM_DESC(zfs_arc_shrink_shift, "log2(fraction of arc to reclaim)"); +ZFS_MODULE_PARAM(zfs_arc, zfs_arc_, shrink_shift, INT, ZMOD_RW, + "log2(fraction of arc to reclaim)"); -module_param(zfs_arc_pc_percent, uint, 0644); -MODULE_PARM_DESC(zfs_arc_pc_percent, +ZFS_MODULE_PARAM(zfs_arc, zfs_arc_, pc_percent, UINT, ZMOD_RW, "Percent of pagecache to reclaim arc to"); -module_param(zfs_arc_p_min_shift, int, 0644); -MODULE_PARM_DESC(zfs_arc_p_min_shift, "arc_c shift to calc min/max arc_p"); +ZFS_MODULE_PARAM(zfs_arc, zfs_arc_, p_min_shift, INT, ZMOD_RW, + "arc_c shift to calc min/max arc_p"); -module_param(zfs_arc_average_blocksize, int, 0444); -MODULE_PARM_DESC(zfs_arc_average_blocksize, "Target average block size"); +ZFS_MODULE_PARAM(zfs_arc, zfs_arc_, average_blocksize, INT, ZMOD_RD, + "Target average block size"); -module_param(zfs_compressed_arc_enabled, int, 0644); -MODULE_PARM_DESC(zfs_compressed_arc_enabled, "Disable compressed arc buffers"); +ZFS_MODULE_PARAM(zfs, zfs_, compressed_arc_enabled, INT, ZMOD_RW, + "Disable compressed arc buffers"); -module_param(zfs_arc_min_prefetch_ms, int, 0644); -MODULE_PARM_DESC(zfs_arc_min_prefetch_ms, "Min life of prefetch block in ms"); +ZFS_MODULE_PARAM(zfs_arc, zfs_arc_, min_prefetch_ms, INT, ZMOD_RW, + "Min life of prefetch block in ms"); -module_param(zfs_arc_min_prescient_prefetch_ms, int, 0644); -MODULE_PARM_DESC(zfs_arc_min_prescient_prefetch_ms, +ZFS_MODULE_PARAM(zfs_arc, zfs_arc_, min_prescient_prefetch_ms, INT, ZMOD_RW, "Min life of prescient prefetched block in ms"); -module_param(l2arc_write_max, ulong, 0644); -MODULE_PARM_DESC(l2arc_write_max, "Max write bytes per interval"); +ZFS_MODULE_PARAM(zfs_l2arc, l2arc_, write_max, ULONG, ZMOD_RW, + "Max write bytes per interval"); -module_param(l2arc_write_boost, ulong, 0644); -MODULE_PARM_DESC(l2arc_write_boost, "Extra write bytes during device warmup"); +ZFS_MODULE_PARAM(zfs_l2arc, l2arc_, write_boost, ULONG, ZMOD_RW, + "Extra write bytes during device warmup"); -module_param(l2arc_headroom, ulong, 0644); -MODULE_PARM_DESC(l2arc_headroom, "Number of max device writes to precache"); +ZFS_MODULE_PARAM(zfs_l2arc, l2arc_, headroom, ULONG, ZMOD_RW, + "Number of max device writes to precache"); -module_param(l2arc_headroom_boost, ulong, 0644); -MODULE_PARM_DESC(l2arc_headroom_boost, "Compressed l2arc_headroom multiplier"); +ZFS_MODULE_PARAM(zfs_l2arc, l2arc_, headroom_boost, ULONG, ZMOD_RW, + "Compressed l2arc_headroom multiplier"); -module_param(l2arc_feed_secs, ulong, 0644); -MODULE_PARM_DESC(l2arc_feed_secs, "Seconds between L2ARC writing"); +ZFS_MODULE_PARAM(zfs_l2arc, l2arc_, feed_secs, ULONG, ZMOD_RW, + "Seconds between L2ARC writing"); -module_param(l2arc_feed_min_ms, ulong, 0644); -MODULE_PARM_DESC(l2arc_feed_min_ms, "Min feed interval in milliseconds"); +ZFS_MODULE_PARAM(zfs_l2arc, l2arc_, feed_min_ms, ULONG, ZMOD_RW, + "Min feed interval in milliseconds"); -module_param(l2arc_noprefetch, int, 0644); -MODULE_PARM_DESC(l2arc_noprefetch, "Skip caching prefetched buffers"); +ZFS_MODULE_PARAM(zfs_l2arc, l2arc_, noprefetch, INT, ZMOD_RW, + "Skip caching prefetched buffers"); -module_param(l2arc_feed_again, int, 0644); -MODULE_PARM_DESC(l2arc_feed_again, "Turbo L2ARC warmup"); +ZFS_MODULE_PARAM(zfs_l2arc, l2arc_, feed_again, INT, ZMOD_RW, + "Turbo L2ARC warmup"); -module_param(l2arc_norw, int, 0644); -MODULE_PARM_DESC(l2arc_norw, "No reads during writes"); +ZFS_MODULE_PARAM(zfs_l2arc, l2arc_, norw, INT, ZMOD_RW, + "No reads during writes"); -module_param(zfs_arc_lotsfree_percent, int, 0644); -MODULE_PARM_DESC(zfs_arc_lotsfree_percent, +ZFS_MODULE_PARAM(zfs_arc, zfs_arc_, lotsfree_percent, INT, ZMOD_RW, "System free memory I/O throttle in bytes"); -module_param(zfs_arc_sys_free, ulong, 0644); -MODULE_PARM_DESC(zfs_arc_sys_free, "System free memory target size in bytes"); +ZFS_MODULE_PARAM(zfs_arc, zfs_arc_, sys_free, ULONG, ZMOD_RW, + "System free memory target size in bytes"); -module_param(zfs_arc_dnode_limit, ulong, 0644); -MODULE_PARM_DESC(zfs_arc_dnode_limit, "Minimum bytes of dnodes in arc"); +ZFS_MODULE_PARAM(zfs_arc, zfs_arc_, dnode_limit, ULONG, ZMOD_RW, + "Minimum bytes of dnodes in arc"); -module_param(zfs_arc_dnode_limit_percent, ulong, 0644); -MODULE_PARM_DESC(zfs_arc_dnode_limit_percent, +ZFS_MODULE_PARAM(zfs_arc, zfs_arc_, dnode_limit_percent, ULONG, ZMOD_RW, "Percent of ARC meta buffers for dnodes"); -module_param(zfs_arc_dnode_reduce_percent, ulong, 0644); -MODULE_PARM_DESC(zfs_arc_dnode_reduce_percent, +ZFS_MODULE_PARAM(zfs_arc, zfs_arc_, dnode_reduce_percent, ULONG, ZMOD_RW, "Percentage of excess dnodes to try to unpin"); /* END CSTYLED */ -#endif |