xref: /linux/fs/xfs/xfs_reflink.h (revision c94cd9508b1335b949fd13ebd269313c65492df0)
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * Copyright (C) 2016 Oracle.  All Rights Reserved.
4  * Author: Darrick J. Wong <darrick.wong@oracle.com>
5  */
6 #ifndef __XFS_REFLINK_H
7 #define __XFS_REFLINK_H 1
8 
9 extern int xfs_reflink_trim_around_shared(struct xfs_inode *ip,
10 		struct xfs_bmbt_irec *irec, bool *shared);
11 int xfs_bmap_trim_cow(struct xfs_inode *ip, struct xfs_bmbt_irec *imap,
12 		bool *shared);
13 
14 int xfs_reflink_allocate_cow(struct xfs_inode *ip, struct xfs_bmbt_irec *imap,
15 		struct xfs_bmbt_irec *cmap, bool *shared, uint *lockmode,
16 		bool convert_now);
17 extern int xfs_reflink_convert_cow(struct xfs_inode *ip, xfs_off_t offset,
18 		xfs_off_t count);
19 
20 extern int xfs_reflink_cancel_cow_blocks(struct xfs_inode *ip,
21 		struct xfs_trans **tpp, xfs_fileoff_t offset_fsb,
22 		xfs_fileoff_t end_fsb, bool cancel_real);
23 extern int xfs_reflink_cancel_cow_range(struct xfs_inode *ip, xfs_off_t offset,
24 		xfs_off_t count, bool cancel_real);
25 extern int xfs_reflink_end_cow(struct xfs_inode *ip, xfs_off_t offset,
26 		xfs_off_t count);
27 extern int xfs_reflink_recover_cow(struct xfs_mount *mp);
28 extern loff_t xfs_reflink_remap_range(struct file *file_in, loff_t pos_in,
29 		struct file *file_out, loff_t pos_out, loff_t len,
30 		unsigned int remap_flags);
31 extern int xfs_reflink_inode_has_shared_extents(struct xfs_trans *tp,
32 		struct xfs_inode *ip, bool *has_shared);
33 extern int xfs_reflink_clear_inode_flag(struct xfs_inode *ip,
34 		struct xfs_trans **tpp);
35 extern int xfs_reflink_unshare(struct xfs_inode *ip, xfs_off_t offset,
36 		xfs_off_t len);
37 extern int xfs_reflink_remap_prep(struct file *file_in, loff_t pos_in,
38 		struct file *file_out, loff_t pos_out, loff_t *len,
39 		unsigned int remap_flags);
40 extern int xfs_reflink_remap_blocks(struct xfs_inode *src, loff_t pos_in,
41 		struct xfs_inode *dest, loff_t pos_out, loff_t remap_len,
42 		loff_t *remapped);
43 extern int xfs_reflink_update_dest(struct xfs_inode *dest, xfs_off_t newlen,
44 		xfs_extlen_t cowextsize, unsigned int remap_flags);
45 
46 #endif /* __XFS_REFLINK_H */
47