^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) #ifndef BTRFS_DISCARD_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) #define BTRFS_DISCARD_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) #include <linux/sizes.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) struct btrfs_fs_info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) struct btrfs_discard_ctl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) struct btrfs_block_group;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) /* Discard size limits */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #define BTRFS_ASYNC_DISCARD_DEFAULT_MAX_SIZE (SZ_64M)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #define BTRFS_ASYNC_DISCARD_MAX_FILTER (SZ_1M)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #define BTRFS_ASYNC_DISCARD_MIN_FILTER (SZ_32K)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) /* List operations */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) void btrfs_discard_check_filter(struct btrfs_block_group *block_group, u64 bytes);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) /* Work operations */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) void btrfs_discard_cancel_work(struct btrfs_discard_ctl *discard_ctl,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) struct btrfs_block_group *block_group);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) void btrfs_discard_queue_work(struct btrfs_discard_ctl *discard_ctl,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) struct btrfs_block_group *block_group);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) void btrfs_discard_schedule_work(struct btrfs_discard_ctl *discard_ctl,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) bool override);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) bool btrfs_run_discard_work(struct btrfs_discard_ctl *discard_ctl);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) /* Update operations */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) void btrfs_discard_calc_delay(struct btrfs_discard_ctl *discard_ctl);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) void btrfs_discard_update_discardable(struct btrfs_block_group *block_group,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) struct btrfs_free_space_ctl *ctl);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) /* Setup/cleanup operations */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) void btrfs_discard_punt_unused_bgs_list(struct btrfs_fs_info *fs_info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) void btrfs_discard_resume(struct btrfs_fs_info *fs_info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) void btrfs_discard_stop(struct btrfs_fs_info *fs_info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) void btrfs_discard_init(struct btrfs_fs_info *fs_info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) void btrfs_discard_cleanup(struct btrfs_fs_info *fs_info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) #endif