Josef Bacik | 59b818e | 2022-10-26 15:08:25 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | |
| 3 | #ifndef BTRFS_DEFRAG_H |
| 4 | #define BTRFS_DEFRAG_H |
| 5 | |
David Sterba | 22b46bd | 2024-01-27 00:53:06 +0100 | [diff] [blame] | 6 | #include <linux/types.h> |
| 7 | #include <linux/compiler_types.h> |
| 8 | |
| 9 | struct inode; |
| 10 | struct file_ra_state; |
| 11 | struct btrfs_fs_info; |
| 12 | struct btrfs_root; |
| 13 | struct btrfs_trans_handle; |
| 14 | struct btrfs_ioctl_defrag_range_args; |
| 15 | |
Josef Bacik | 59b818e | 2022-10-26 15:08:25 -0400 | [diff] [blame] | 16 | int btrfs_defrag_file(struct inode *inode, struct file_ra_state *ra, |
| 17 | struct btrfs_ioctl_defrag_range_args *range, |
| 18 | u64 newer_than, unsigned long max_to_defrag); |
| 19 | int __init btrfs_auto_defrag_init(void); |
| 20 | void __cold btrfs_auto_defrag_exit(void); |
David Sterba | 11e3107 | 2024-08-27 04:13:44 +0200 | [diff] [blame] | 21 | void btrfs_add_inode_defrag(struct btrfs_inode *inode, u32 extent_thresh); |
Josef Bacik | 59b818e | 2022-10-26 15:08:25 -0400 | [diff] [blame] | 22 | int btrfs_run_defrag_inodes(struct btrfs_fs_info *fs_info); |
| 23 | void btrfs_cleanup_defrag_inodes(struct btrfs_fs_info *fs_info); |
Filipe Manana | 1723270 | 2023-09-22 11:37:56 +0100 | [diff] [blame] | 24 | int btrfs_defrag_root(struct btrfs_root *root); |
Josef Bacik | 59b818e | 2022-10-26 15:08:25 -0400 | [diff] [blame] | 25 | |
| 26 | static inline int btrfs_defrag_cancelled(struct btrfs_fs_info *fs_info) |
| 27 | { |
| 28 | return signal_pending(current); |
| 29 | } |
| 30 | |
| 31 | #endif |