xref: /openbmc/linux/fs/xfs/xfs_reflink.h (revision a2818ee4)
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_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);
14 
15 extern int xfs_reflink_reserve_cow(struct xfs_inode *ip,
16 		struct xfs_bmbt_irec *imap);
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,
20 		xfs_off_t count);
21 
22 extern int xfs_reflink_cancel_cow_blocks(struct xfs_inode *ip,
23 		struct xfs_trans **tpp, xfs_fileoff_t offset_fsb,
24 		xfs_fileoff_t end_fsb, bool cancel_real);
25 extern int xfs_reflink_cancel_cow_range(struct xfs_inode *ip, xfs_off_t offset,
26 		xfs_off_t count, bool cancel_real);
27 extern int xfs_reflink_end_cow(struct xfs_inode *ip, xfs_off_t offset,
28 		xfs_off_t count);
29 extern int xfs_reflink_recover_cow(struct xfs_mount *mp);
30 extern loff_t xfs_reflink_remap_range(struct file *file_in, loff_t pos_in,
31 		struct file *file_out, loff_t pos_out, loff_t len,
32 		unsigned int remap_flags);
33 extern int xfs_reflink_inode_has_shared_extents(struct xfs_trans *tp,
34 		struct xfs_inode *ip, bool *has_shared);
35 extern int xfs_reflink_clear_inode_flag(struct xfs_inode *ip,
36 		struct xfs_trans **tpp);
37 extern int xfs_reflink_unshare(struct xfs_inode *ip, xfs_off_t offset,
38 		xfs_off_t len);
39 extern int xfs_reflink_remap_prep(struct file *file_in, loff_t pos_in,
40 		struct file *file_out, loff_t pos_out, loff_t *len,
41 		unsigned int remap_flags);
42 extern int xfs_reflink_remap_blocks(struct xfs_inode *src, loff_t pos_in,
43 		struct xfs_inode *dest, loff_t pos_out, loff_t remap_len,
44 		loff_t *remapped);
45 extern int xfs_reflink_update_dest(struct xfs_inode *dest, xfs_off_t newlen,
46 		xfs_extlen_t cowextsize, unsigned int remap_flags);
47 extern void xfs_reflink_remap_unlock(struct file *file_in,
48 		struct file *file_out);
49 
50 #endif /* __XFS_REFLINK_H */
51