xref: /openbmc/linux/fs/btrfs/defrag.h (revision 7ae9fb1b7ecbb5d85d07857943f677fd1a559b18)
1*59b818e0SJosef Bacik /* SPDX-License-Identifier: GPL-2.0 */
2*59b818e0SJosef Bacik 
3*59b818e0SJosef Bacik #ifndef BTRFS_DEFRAG_H
4*59b818e0SJosef Bacik #define BTRFS_DEFRAG_H
5*59b818e0SJosef Bacik 
6*59b818e0SJosef Bacik int btrfs_defrag_file(struct inode *inode, struct file_ra_state *ra,
7*59b818e0SJosef Bacik 		      struct btrfs_ioctl_defrag_range_args *range,
8*59b818e0SJosef Bacik 		      u64 newer_than, unsigned long max_to_defrag);
9*59b818e0SJosef Bacik int __init btrfs_auto_defrag_init(void);
10*59b818e0SJosef Bacik void __cold btrfs_auto_defrag_exit(void);
11*59b818e0SJosef Bacik int btrfs_add_inode_defrag(struct btrfs_trans_handle *trans,
12*59b818e0SJosef Bacik 			   struct btrfs_inode *inode, u32 extent_thresh);
13*59b818e0SJosef Bacik int btrfs_run_defrag_inodes(struct btrfs_fs_info *fs_info);
14*59b818e0SJosef Bacik void btrfs_cleanup_defrag_inodes(struct btrfs_fs_info *fs_info);
15*59b818e0SJosef Bacik int btrfs_defrag_leaves(struct btrfs_trans_handle *trans, struct btrfs_root *root);
16*59b818e0SJosef Bacik 
btrfs_defrag_cancelled(struct btrfs_fs_info * fs_info)17*59b818e0SJosef Bacik static inline int btrfs_defrag_cancelled(struct btrfs_fs_info *fs_info)
18*59b818e0SJosef Bacik {
19*59b818e0SJosef Bacik 	return signal_pending(current);
20*59b818e0SJosef Bacik }
21*59b818e0SJosef Bacik 
22*59b818e0SJosef Bacik #endif
23