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 | 2a06705 | 2016-10-03 09:11:33 -0700 | [diff] [blame] | 23 | extern 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); |
| 26 | extern int xfs_reflink_trim_around_shared(struct xfs_inode *ip, |
| 27 | struct xfs_bmbt_irec *irec, bool *shared, bool *trimmed); |
| 28 | |
| 29 | extern int xfs_reflink_reserve_cow_range(struct xfs_inode *ip, |
| 30 | xfs_off_t offset, xfs_off_t count); |
Darrick J. Wong | 0613f16 | 2016-10-03 09:11:37 -0700 | [diff] [blame] | 31 | extern int xfs_reflink_allocate_cow_range(struct xfs_inode *ip, |
| 32 | xfs_off_t offset, xfs_off_t count); |
Darrick J. Wong | ef47366 | 2016-10-03 09:11:34 -0700 | [diff] [blame] | 33 | extern bool xfs_reflink_find_cow_mapping(struct xfs_inode *ip, xfs_off_t offset, |
| 34 | struct xfs_bmbt_irec *imap, bool *need_alloc); |
| 35 | extern int xfs_reflink_trim_irec_to_next_cow(struct xfs_inode *ip, |
| 36 | xfs_fileoff_t offset_fsb, struct xfs_bmbt_irec *imap); |
Darrick J. Wong | 2a06705 | 2016-10-03 09:11:33 -0700 | [diff] [blame] | 37 | |
Darrick J. Wong | 43caeb1 | 2016-10-03 09:11:35 -0700 | [diff] [blame] | 38 | extern int xfs_reflink_cancel_cow_blocks(struct xfs_inode *ip, |
| 39 | struct xfs_trans **tpp, xfs_fileoff_t offset_fsb, |
| 40 | xfs_fileoff_t end_fsb); |
| 41 | extern int xfs_reflink_cancel_cow_range(struct xfs_inode *ip, xfs_off_t offset, |
| 42 | xfs_off_t count); |
| 43 | extern int xfs_reflink_end_cow(struct xfs_inode *ip, xfs_off_t offset, |
| 44 | xfs_off_t count); |
Darrick J. Wong | 174edb0 | 2016-10-03 09:11:39 -0700 | [diff] [blame] | 45 | extern int xfs_reflink_recover_cow(struct xfs_mount *mp); |
Darrick J. Wong | cc71466 | 2016-10-03 09:11:41 -0700 | [diff] [blame] | 46 | #define XFS_REFLINK_DEDUPE 1 /* only reflink if contents match */ |
| 47 | #define XFS_REFLINK_ALL (XFS_REFLINK_DEDUPE) |
Darrick J. Wong | 862bb36 | 2016-10-03 09:11:40 -0700 | [diff] [blame] | 48 | extern int xfs_reflink_remap_range(struct xfs_inode *src, xfs_off_t srcoff, |
Darrick J. Wong | cc71466 | 2016-10-03 09:11:41 -0700 | [diff] [blame] | 49 | struct xfs_inode *dest, xfs_off_t destoff, xfs_off_t len, |
| 50 | unsigned int flags); |
Darrick J. Wong | 98cc2db | 2016-10-03 09:11:43 -0700 | [diff] [blame] | 51 | extern int xfs_reflink_clear_inode_flag(struct xfs_inode *ip, |
| 52 | struct xfs_trans **tpp); |
| 53 | extern int xfs_reflink_unshare(struct xfs_inode *ip, xfs_off_t offset, |
| 54 | xfs_off_t len); |
Darrick J. Wong | 43caeb1 | 2016-10-03 09:11:35 -0700 | [diff] [blame] | 55 | |
Darrick J. Wong | 83104d4 | 2016-10-03 09:11:46 -0700 | [diff] [blame] | 56 | extern bool xfs_reflink_has_real_cow_blocks(struct xfs_inode *ip); |
| 57 | |
Darrick J. Wong | 3993bae | 2016-10-03 09:11:32 -0700 | [diff] [blame] | 58 | #endif /* __XFS_REFLINK_H */ |