Darrick J. Wong | 3993bae | 2016-10-03 09:11:32 -0700 | [diff] [blame] | 1 | /* |
| 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. Wong | 92ff728 | 2017-06-16 11:00:10 -0700 | [diff] [blame] | 23 | extern int xfs_reflink_find_shared(struct xfs_mount *mp, struct xfs_trans *tp, |
| 24 | xfs_agnumber_t agno, xfs_agblock_t agbno, xfs_extlen_t aglen, |
| 25 | xfs_agblock_t *fbno, xfs_extlen_t *flen, bool find_maximal); |
Darrick J. Wong | 2a06705 | 2016-10-03 09:11:33 -0700 | [diff] [blame] | 26 | extern int xfs_reflink_trim_around_shared(struct xfs_inode *ip, |
| 27 | struct xfs_bmbt_irec *irec, bool *shared, bool *trimmed); |
| 28 | |
Christoph Hellwig | 3ba020b | 2016-10-20 15:53:50 +1100 | [diff] [blame] | 29 | extern int xfs_reflink_reserve_cow(struct xfs_inode *ip, |
| 30 | struct xfs_bmbt_irec *imap, bool *shared); |
Christoph Hellwig | 3c68d44 | 2017-02-06 10:51:03 -0800 | [diff] [blame] | 31 | extern int xfs_reflink_allocate_cow(struct xfs_inode *ip, |
| 32 | struct xfs_bmbt_irec *imap, bool *shared, uint *lockmode); |
Darrick J. Wong | 5eda430 | 2017-02-02 15:14:02 -0800 | [diff] [blame] | 33 | extern int xfs_reflink_convert_cow(struct xfs_inode *ip, xfs_off_t offset, |
| 34 | xfs_off_t count); |
Darrick J. Wong | ef47366 | 2016-10-03 09:11:34 -0700 | [diff] [blame] | 35 | extern bool xfs_reflink_find_cow_mapping(struct xfs_inode *ip, xfs_off_t offset, |
Christoph Hellwig | 092d5d9 | 2016-11-24 11:39:49 +1100 | [diff] [blame] | 36 | struct xfs_bmbt_irec *imap); |
Christoph Hellwig | 86f12ab | 2016-11-24 11:39:50 +1100 | [diff] [blame] | 37 | extern void xfs_reflink_trim_irec_to_next_cow(struct xfs_inode *ip, |
Darrick J. Wong | ef47366 | 2016-10-03 09:11:34 -0700 | [diff] [blame] | 38 | xfs_fileoff_t offset_fsb, struct xfs_bmbt_irec *imap); |
Darrick J. Wong | 2a06705 | 2016-10-03 09:11:33 -0700 | [diff] [blame] | 39 | |
Darrick J. Wong | 43caeb1 | 2016-10-03 09:11:35 -0700 | [diff] [blame] | 40 | extern int xfs_reflink_cancel_cow_blocks(struct xfs_inode *ip, |
| 41 | struct xfs_trans **tpp, xfs_fileoff_t offset_fsb, |
Christoph Hellwig | 3802a34 | 2017-03-07 16:45:58 -0800 | [diff] [blame] | 42 | xfs_fileoff_t end_fsb, bool cancel_real); |
Darrick J. Wong | 43caeb1 | 2016-10-03 09:11:35 -0700 | [diff] [blame] | 43 | extern int xfs_reflink_cancel_cow_range(struct xfs_inode *ip, xfs_off_t offset, |
Christoph Hellwig | 3802a34 | 2017-03-07 16:45:58 -0800 | [diff] [blame] | 44 | xfs_off_t count, bool cancel_real); |
Darrick J. Wong | 43caeb1 | 2016-10-03 09:11:35 -0700 | [diff] [blame] | 45 | extern int xfs_reflink_end_cow(struct xfs_inode *ip, xfs_off_t offset, |
| 46 | xfs_off_t count); |
Darrick J. Wong | 174edb0 | 2016-10-03 09:11:39 -0700 | [diff] [blame] | 47 | extern int xfs_reflink_recover_cow(struct xfs_mount *mp); |
Christoph Hellwig | 5faaf4f | 2016-10-20 15:50:07 +1100 | [diff] [blame] | 48 | extern 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. Wong | ea7cdd7 | 2017-06-16 11:00:11 -0700 | [diff] [blame] | 50 | extern int xfs_reflink_inode_has_shared_extents(struct xfs_trans *tp, |
| 51 | struct xfs_inode *ip, bool *has_shared); |
Darrick J. Wong | 98cc2db | 2016-10-03 09:11:43 -0700 | [diff] [blame] | 52 | extern int xfs_reflink_clear_inode_flag(struct xfs_inode *ip, |
| 53 | struct xfs_trans **tpp); |
| 54 | extern int xfs_reflink_unshare(struct xfs_inode *ip, xfs_off_t offset, |
| 55 | xfs_off_t len); |
Darrick J. Wong | 43caeb1 | 2016-10-03 09:11:35 -0700 | [diff] [blame] | 56 | |
Darrick J. Wong | 3993bae | 2016-10-03 09:11:32 -0700 | [diff] [blame] | 57 | #endif /* __XFS_REFLINK_H */ |