defrag.h 927 B

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