blob: 1532827ba911849d193a647115b2376d50f9cf47 [file] [log] [blame]
Dave Chinner0b61f8a2018-06-05 19:42:14 -07001// SPDX-License-Identifier: GPL-2.0+
Darrick J. Wong3993bae2016-10-03 09:11:32 -07002/*
3 * Copyright (C) 2016 Oracle. All Rights Reserved.
Darrick J. Wong3993bae2016-10-03 09:11:32 -07004 * Author: Darrick J. Wong <darrick.wong@oracle.com>
Darrick J. Wong3993bae2016-10-03 09:11:32 -07005 */
6#ifndef __XFS_REFLINK_H
7#define __XFS_REFLINK_H 1
8
Darrick J. Wong92ff7282017-06-16 11:00:10 -07009extern 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);
Darrick J. Wong2a067052016-10-03 09:11:33 -070012extern int xfs_reflink_trim_around_shared(struct xfs_inode *ip,
13 struct xfs_bmbt_irec *irec, bool *shared, bool *trimmed);
14
Christoph Hellwig3ba020b2016-10-20 15:53:50 +110015extern int xfs_reflink_reserve_cow(struct xfs_inode *ip,
16 struct xfs_bmbt_irec *imap, bool *shared);
Christoph Hellwig3c68d442017-02-06 10:51:03 -080017extern int xfs_reflink_allocate_cow(struct xfs_inode *ip,
18 struct xfs_bmbt_irec *imap, bool *shared, uint *lockmode);
Darrick J. Wong5eda4302017-02-02 15:14:02 -080019extern int xfs_reflink_convert_cow(struct xfs_inode *ip, xfs_off_t offset,
20 xfs_off_t count);
Darrick J. Wongef473662016-10-03 09:11:34 -070021extern bool xfs_reflink_find_cow_mapping(struct xfs_inode *ip, xfs_off_t offset,
Christoph Hellwig092d5d92016-11-24 11:39:49 +110022 struct xfs_bmbt_irec *imap);
Christoph Hellwig86f12ab2016-11-24 11:39:50 +110023extern void xfs_reflink_trim_irec_to_next_cow(struct xfs_inode *ip,
Darrick J. Wongef473662016-10-03 09:11:34 -070024 xfs_fileoff_t offset_fsb, struct xfs_bmbt_irec *imap);
Darrick J. Wong2a067052016-10-03 09:11:33 -070025
Darrick J. Wong43caeb12016-10-03 09:11:35 -070026extern int xfs_reflink_cancel_cow_blocks(struct xfs_inode *ip,
27 struct xfs_trans **tpp, xfs_fileoff_t offset_fsb,
Christoph Hellwig3802a342017-03-07 16:45:58 -080028 xfs_fileoff_t end_fsb, bool cancel_real);
Darrick J. Wong43caeb12016-10-03 09:11:35 -070029extern int xfs_reflink_cancel_cow_range(struct xfs_inode *ip, xfs_off_t offset,
Christoph Hellwig3802a342017-03-07 16:45:58 -080030 xfs_off_t count, bool cancel_real);
Darrick J. Wong43caeb12016-10-03 09:11:35 -070031extern int xfs_reflink_end_cow(struct xfs_inode *ip, xfs_off_t offset,
32 xfs_off_t count);
Darrick J. Wong174edb02016-10-03 09:11:39 -070033extern int xfs_reflink_recover_cow(struct xfs_mount *mp);
Christoph Hellwig5faaf4f2016-10-20 15:50:07 +110034extern int xfs_reflink_remap_range(struct file *file_in, loff_t pos_in,
35 struct file *file_out, loff_t pos_out, u64 len, bool is_dedupe);
Darrick J. Wongea7cdd72017-06-16 11:00:11 -070036extern int xfs_reflink_inode_has_shared_extents(struct xfs_trans *tp,
37 struct xfs_inode *ip, bool *has_shared);
Darrick J. Wong98cc2db2016-10-03 09:11:43 -070038extern int xfs_reflink_clear_inode_flag(struct xfs_inode *ip,
39 struct xfs_trans **tpp);
40extern int xfs_reflink_unshare(struct xfs_inode *ip, xfs_off_t offset,
41 xfs_off_t len);
Darrick J. Wong43caeb12016-10-03 09:11:35 -070042
Darrick J. Wong3993bae2016-10-03 09:11:32 -070043#endif /* __XFS_REFLINK_H */