]>
Commit | Line | Data |
---|---|---|
0b61f8a4 | 1 | // SPDX-License-Identifier: GPL-2.0+ |
3993baeb DW |
2 | /* |
3 | * Copyright (C) 2016 Oracle. All Rights Reserved. | |
3993baeb | 4 | * Author: Darrick J. Wong <[email protected]> |
3993baeb DW |
5 | */ |
6 | #ifndef __XFS_REFLINK_H | |
7 | #define __XFS_REFLINK_H 1 | |
8 | ||
66ae56a5 CH |
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 | ||
92ff7285 DW |
20 | extern int xfs_reflink_find_shared(struct xfs_mount *mp, struct xfs_trans *tp, |
21 | xfs_agnumber_t agno, xfs_agblock_t agbno, xfs_extlen_t aglen, | |
22 | xfs_agblock_t *fbno, xfs_extlen_t *flen, bool find_maximal); | |
2a06705c | 23 | extern int xfs_reflink_trim_around_shared(struct xfs_inode *ip, |
d392bc81 | 24 | struct xfs_bmbt_irec *irec, bool *shared); |
aa124436 | 25 | int xfs_bmap_trim_cow(struct xfs_inode *ip, struct xfs_bmbt_irec *imap, |
66ae56a5 | 26 | bool *shared); |
2a06705c | 27 | |
ffb375a8 CH |
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, | |
affe250a | 30 | bool convert_now); |
5eda4300 DW |
31 | extern int xfs_reflink_convert_cow(struct xfs_inode *ip, xfs_off_t offset, |
32 | xfs_off_t count); | |
2a06705c | 33 | |
43caeb18 DW |
34 | extern int xfs_reflink_cancel_cow_blocks(struct xfs_inode *ip, |
35 | struct xfs_trans **tpp, xfs_fileoff_t offset_fsb, | |
3802a345 | 36 | xfs_fileoff_t end_fsb, bool cancel_real); |
43caeb18 | 37 | extern int xfs_reflink_cancel_cow_range(struct xfs_inode *ip, xfs_off_t offset, |
3802a345 | 38 | xfs_off_t count, bool cancel_real); |
43caeb18 DW |
39 | extern int xfs_reflink_end_cow(struct xfs_inode *ip, xfs_off_t offset, |
40 | xfs_off_t count); | |
174edb0e | 41 | extern int xfs_reflink_recover_cow(struct xfs_mount *mp); |
3f68c1f5 | 42 | extern loff_t xfs_reflink_remap_range(struct file *file_in, loff_t pos_in, |
42ec3d4c | 43 | struct file *file_out, loff_t pos_out, loff_t len, |
a91ae49b | 44 | unsigned int remap_flags); |
ea7cdd7b DW |
45 | extern int xfs_reflink_inode_has_shared_extents(struct xfs_trans *tp, |
46 | struct xfs_inode *ip, bool *has_shared); | |
98cc2db5 DW |
47 | extern int xfs_reflink_clear_inode_flag(struct xfs_inode *ip, |
48 | struct xfs_trans **tpp); | |
49 | extern int xfs_reflink_unshare(struct xfs_inode *ip, xfs_off_t offset, | |
50 | xfs_off_t len); | |
3fc9f5e4 DW |
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); | |
43caeb18 | 59 | |
3993baeb | 60 | #endif /* __XFS_REFLINK_H */ |