hc
2024-05-10 cde9070d9970eef1f7ec2360586c802a16230ad8
kernel/fs/xfs/xfs_reflink.h
....@@ -6,16 +6,28 @@
66 #ifndef __XFS_REFLINK_H
77 #define __XFS_REFLINK_H 1
88
9
+static inline bool xfs_is_always_cow_inode(struct xfs_inode *ip)
10
+{
11
+ return ip->i_mount->m_always_cow &&
12
+ xfs_sb_version_hasreflink(&ip->i_mount->m_sb);
13
+}
14
+
15
+static inline bool xfs_is_cow_inode(struct xfs_inode *ip)
16
+{
17
+ return xfs_is_reflink_inode(ip) || xfs_is_always_cow_inode(ip);
18
+}
19
+
920 extern int xfs_reflink_find_shared(struct xfs_mount *mp, struct xfs_trans *tp,
1021 xfs_agnumber_t agno, xfs_agblock_t agbno, xfs_extlen_t aglen,
1122 xfs_agblock_t *fbno, xfs_extlen_t *flen, bool find_maximal);
1223 extern int xfs_reflink_trim_around_shared(struct xfs_inode *ip,
13
- struct xfs_bmbt_irec *irec, bool *shared, bool *trimmed);
24
+ struct xfs_bmbt_irec *irec, bool *shared);
25
+int xfs_bmap_trim_cow(struct xfs_inode *ip, struct xfs_bmbt_irec *imap,
26
+ bool *shared);
1427
15
-extern int xfs_reflink_reserve_cow(struct xfs_inode *ip,
16
- struct xfs_bmbt_irec *imap, bool *shared);
17
-extern int xfs_reflink_allocate_cow(struct xfs_inode *ip,
18
- struct xfs_bmbt_irec *imap, bool *shared, uint *lockmode);
28
+int xfs_reflink_allocate_cow(struct xfs_inode *ip, struct xfs_bmbt_irec *imap,
29
+ struct xfs_bmbt_irec *cmap, bool *shared, uint *lockmode,
30
+ bool convert_now);
1931 extern int xfs_reflink_convert_cow(struct xfs_inode *ip, xfs_off_t offset,
2032 xfs_off_t count);
2133
....@@ -27,13 +39,22 @@
2739 extern int xfs_reflink_end_cow(struct xfs_inode *ip, xfs_off_t offset,
2840 xfs_off_t count);
2941 extern int xfs_reflink_recover_cow(struct xfs_mount *mp);
30
-extern int xfs_reflink_remap_range(struct file *file_in, loff_t pos_in,
31
- struct file *file_out, loff_t pos_out, u64 len, bool is_dedupe);
42
+extern loff_t xfs_reflink_remap_range(struct file *file_in, loff_t pos_in,
43
+ struct file *file_out, loff_t pos_out, loff_t len,
44
+ unsigned int remap_flags);
3245 extern int xfs_reflink_inode_has_shared_extents(struct xfs_trans *tp,
3346 struct xfs_inode *ip, bool *has_shared);
3447 extern int xfs_reflink_clear_inode_flag(struct xfs_inode *ip,
3548 struct xfs_trans **tpp);
3649 extern int xfs_reflink_unshare(struct xfs_inode *ip, xfs_off_t offset,
3750 xfs_off_t len);
51
+extern int xfs_reflink_remap_prep(struct file *file_in, loff_t pos_in,
52
+ struct file *file_out, loff_t pos_out, loff_t *len,
53
+ unsigned int remap_flags);
54
+extern int xfs_reflink_remap_blocks(struct xfs_inode *src, loff_t pos_in,
55
+ struct xfs_inode *dest, loff_t pos_out, loff_t remap_len,
56
+ loff_t *remapped);
57
+extern int xfs_reflink_update_dest(struct xfs_inode *dest, xfs_off_t newlen,
58
+ xfs_extlen_t cowextsize, unsigned int remap_flags);
3859
3960 #endif /* __XFS_REFLINK_H */