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