Dennis Zhou | b0643e5 | 2019-12-13 16:22:14 -0800 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | |
| 3 | #ifndef BTRFS_DISCARD_H |
| 4 | #define BTRFS_DISCARD_H |
| 5 | |
Dennis Zhou | 4aa9ad5 | 2020-01-02 16:26:37 -0500 | [diff] [blame] | 6 | #include <linux/sizes.h> |
| 7 | |
Dennis Zhou | b0643e5 | 2019-12-13 16:22:14 -0800 | [diff] [blame] | 8 | struct btrfs_fs_info; |
| 9 | struct btrfs_discard_ctl; |
| 10 | struct btrfs_block_group; |
| 11 | |
Dennis Zhou | 4aa9ad5 | 2020-01-02 16:26:37 -0500 | [diff] [blame] | 12 | /* Discard size limits */ |
Dennis Zhou | 19b2a2c | 2020-01-02 16:26:38 -0500 | [diff] [blame^] | 13 | #define BTRFS_ASYNC_DISCARD_DEFAULT_MAX_SIZE (SZ_64M) |
Dennis Zhou | 4aa9ad5 | 2020-01-02 16:26:37 -0500 | [diff] [blame] | 14 | |
Dennis Zhou | 6e80d4f | 2019-12-13 16:22:15 -0800 | [diff] [blame] | 15 | /* Work operations */ |
Dennis Zhou | b0643e5 | 2019-12-13 16:22:14 -0800 | [diff] [blame] | 16 | void btrfs_discard_cancel_work(struct btrfs_discard_ctl *discard_ctl, |
| 17 | struct btrfs_block_group *block_group); |
| 18 | void btrfs_discard_queue_work(struct btrfs_discard_ctl *discard_ctl, |
| 19 | struct btrfs_block_group *block_group); |
| 20 | void btrfs_discard_schedule_work(struct btrfs_discard_ctl *discard_ctl, |
| 21 | bool override); |
| 22 | bool btrfs_run_discard_work(struct btrfs_discard_ctl *discard_ctl); |
| 23 | |
Dennis Zhou | dfb79dd | 2019-12-13 16:22:20 -0800 | [diff] [blame] | 24 | /* Update operations */ |
Dennis Zhou | a230930 | 2020-01-02 16:26:35 -0500 | [diff] [blame] | 25 | void btrfs_discard_calc_delay(struct btrfs_discard_ctl *discard_ctl); |
Dennis Zhou | dfb79dd | 2019-12-13 16:22:20 -0800 | [diff] [blame] | 26 | void btrfs_discard_update_discardable(struct btrfs_block_group *block_group, |
| 27 | struct btrfs_free_space_ctl *ctl); |
| 28 | |
Dennis Zhou | 6e80d4f | 2019-12-13 16:22:15 -0800 | [diff] [blame] | 29 | /* Setup/cleanup operations */ |
| 30 | void btrfs_discard_punt_unused_bgs_list(struct btrfs_fs_info *fs_info); |
Dennis Zhou | b0643e5 | 2019-12-13 16:22:14 -0800 | [diff] [blame] | 31 | void btrfs_discard_resume(struct btrfs_fs_info *fs_info); |
| 32 | void btrfs_discard_stop(struct btrfs_fs_info *fs_info); |
| 33 | void btrfs_discard_init(struct btrfs_fs_info *fs_info); |
| 34 | void btrfs_discard_cleanup(struct btrfs_fs_info *fs_info); |
| 35 | |
| 36 | #endif |