blob: a57966fc7ddd8668c643ada24d409374ccc9f4ee [file] [log] [blame]
Darrick J. Wong3993bae2016-10-03 09:11:32 -07001/*
2 * Copyright (C) 2016 Oracle. All Rights Reserved.
3 *
4 * Author: Darrick J. Wong <darrick.wong@oracle.com>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it would be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
19 */
20#ifndef __XFS_REFLINK_H
21#define __XFS_REFLINK_H 1
22
Darrick J. Wong2a067052016-10-03 09:11:33 -070023extern int xfs_reflink_find_shared(struct xfs_mount *mp, xfs_agnumber_t agno,
24 xfs_agblock_t agbno, xfs_extlen_t aglen, xfs_agblock_t *fbno,
25 xfs_extlen_t *flen, bool find_maximal);
26extern int xfs_reflink_trim_around_shared(struct xfs_inode *ip,
27 struct xfs_bmbt_irec *irec, bool *shared, bool *trimmed);
28
Christoph Hellwig3ba020b2016-10-20 15:53:50 +110029extern int xfs_reflink_reserve_cow(struct xfs_inode *ip,
30 struct xfs_bmbt_irec *imap, bool *shared);
Darrick J. Wong0613f162016-10-03 09:11:37 -070031extern int xfs_reflink_allocate_cow_range(struct xfs_inode *ip,
32 xfs_off_t offset, xfs_off_t count);
Darrick J. Wonge02f0ff2017-02-02 15:14:02 -080033extern int xfs_reflink_convert_cow(struct xfs_inode *ip, xfs_off_t offset,
34 xfs_off_t count);
Darrick J. Wongef473662016-10-03 09:11:34 -070035extern bool xfs_reflink_find_cow_mapping(struct xfs_inode *ip, xfs_off_t offset,
36 struct xfs_bmbt_irec *imap, bool *need_alloc);
37extern int xfs_reflink_trim_irec_to_next_cow(struct xfs_inode *ip,
38 xfs_fileoff_t offset_fsb, struct xfs_bmbt_irec *imap);
Darrick J. Wong2a067052016-10-03 09:11:33 -070039
Darrick J. Wong43caeb12016-10-03 09:11:35 -070040extern int xfs_reflink_cancel_cow_blocks(struct xfs_inode *ip,
41 struct xfs_trans **tpp, xfs_fileoff_t offset_fsb,
Christoph Hellwig3b83a022017-03-07 16:45:58 -080042 xfs_fileoff_t end_fsb, bool cancel_real);
Darrick J. Wong43caeb12016-10-03 09:11:35 -070043extern int xfs_reflink_cancel_cow_range(struct xfs_inode *ip, xfs_off_t offset,
Christoph Hellwig3b83a022017-03-07 16:45:58 -080044 xfs_off_t count, bool cancel_real);
Darrick J. Wong43caeb12016-10-03 09:11:35 -070045extern int xfs_reflink_end_cow(struct xfs_inode *ip, xfs_off_t offset,
46 xfs_off_t count);
Darrick J. Wong174edb02016-10-03 09:11:39 -070047extern int xfs_reflink_recover_cow(struct xfs_mount *mp);
Christoph Hellwig5faaf4f2016-10-20 15:50:07 +110048extern int xfs_reflink_remap_range(struct file *file_in, loff_t pos_in,
49 struct file *file_out, loff_t pos_out, u64 len, bool is_dedupe);
Darrick J. Wong98cc2db2016-10-03 09:11:43 -070050extern int xfs_reflink_clear_inode_flag(struct xfs_inode *ip,
51 struct xfs_trans **tpp);
52extern int xfs_reflink_unshare(struct xfs_inode *ip, xfs_off_t offset,
53 xfs_off_t len);
Darrick J. Wong43caeb12016-10-03 09:11:35 -070054
Darrick J. Wong3993bae2016-10-03 09:11:32 -070055#endif /* __XFS_REFLINK_H */