1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (C) 2016 Oracle. All Rights Reserved.
4 * Author: Darrick J. Wong <darrick.wong@oracle.com>
6 #ifndef __XFS_REFLINK_H
7 #define __XFS_REFLINK_H 1
9 extern int xfs_reflink_find_shared(struct xfs_mount *mp, struct xfs_trans *tp,
10 xfs_agnumber_t agno, xfs_agblock_t agbno, xfs_extlen_t aglen,
11 xfs_agblock_t *fbno, xfs_extlen_t *flen, bool find_maximal);
12 extern int xfs_reflink_trim_around_shared(struct xfs_inode *ip,
13 struct xfs_bmbt_irec *irec, bool *shared, bool *trimmed);
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);
19 extern int xfs_reflink_convert_cow(struct xfs_inode *ip, xfs_off_t offset,
21 extern bool xfs_reflink_find_cow_mapping(struct xfs_inode *ip, xfs_off_t offset,
22 struct xfs_bmbt_irec *imap);
23 extern void xfs_reflink_trim_irec_to_next_cow(struct xfs_inode *ip,
24 xfs_fileoff_t offset_fsb, struct xfs_bmbt_irec *imap);
26 extern int xfs_reflink_cancel_cow_blocks(struct xfs_inode *ip,
27 struct xfs_trans **tpp, xfs_fileoff_t offset_fsb,
28 xfs_fileoff_t end_fsb, bool cancel_real);
29 extern int xfs_reflink_cancel_cow_range(struct xfs_inode *ip, xfs_off_t offset,
30 xfs_off_t count, bool cancel_real);
31 extern int xfs_reflink_end_cow(struct xfs_inode *ip, xfs_off_t offset,
33 extern int xfs_reflink_recover_cow(struct xfs_mount *mp);
34 extern int xfs_reflink_remap_range(struct file *file_in, loff_t pos_in,
35 struct file *file_out, loff_t pos_out, u64 len, bool is_dedupe);
36 extern int xfs_reflink_inode_has_shared_extents(struct xfs_trans *tp,
37 struct xfs_inode *ip, bool *has_shared);
38 extern int xfs_reflink_clear_inode_flag(struct xfs_inode *ip,
39 struct xfs_trans **tpp);
40 extern int xfs_reflink_unshare(struct xfs_inode *ip, xfs_off_t offset,
43 #endif /* __XFS_REFLINK_H */