2016-10-04 00:11:32 +08:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2016 Oracle. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Author: Darrick J. Wong <darrick.wong@oracle.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it would be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write the Free Software Foundation,
|
|
|
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
#ifndef __XFS_REFLINK_H
|
|
|
|
#define __XFS_REFLINK_H 1
|
|
|
|
|
2017-06-17 02:00:10 +08:00
|
|
|
extern int xfs_reflink_find_shared(struct xfs_mount *mp, struct xfs_trans *tp,
|
|
|
|
xfs_agnumber_t agno, xfs_agblock_t agbno, xfs_extlen_t aglen,
|
|
|
|
xfs_agblock_t *fbno, xfs_extlen_t *flen, bool find_maximal);
|
2016-10-04 00:11:33 +08:00
|
|
|
extern int xfs_reflink_trim_around_shared(struct xfs_inode *ip,
|
|
|
|
struct xfs_bmbt_irec *irec, bool *shared, bool *trimmed);
|
|
|
|
|
2016-10-20 12:53:50 +08:00
|
|
|
extern int xfs_reflink_reserve_cow(struct xfs_inode *ip,
|
|
|
|
struct xfs_bmbt_irec *imap, bool *shared);
|
2017-02-07 02:51:03 +08:00
|
|
|
extern int xfs_reflink_allocate_cow(struct xfs_inode *ip,
|
|
|
|
struct xfs_bmbt_irec *imap, bool *shared, uint *lockmode);
|
2017-02-03 07:14:02 +08:00
|
|
|
extern int xfs_reflink_convert_cow(struct xfs_inode *ip, xfs_off_t offset,
|
|
|
|
xfs_off_t count);
|
2016-10-04 00:11:34 +08:00
|
|
|
extern bool xfs_reflink_find_cow_mapping(struct xfs_inode *ip, xfs_off_t offset,
|
2016-11-24 08:39:49 +08:00
|
|
|
struct xfs_bmbt_irec *imap);
|
2016-11-24 08:39:50 +08:00
|
|
|
extern void xfs_reflink_trim_irec_to_next_cow(struct xfs_inode *ip,
|
2016-10-04 00:11:34 +08:00
|
|
|
xfs_fileoff_t offset_fsb, struct xfs_bmbt_irec *imap);
|
2016-10-04 00:11:33 +08:00
|
|
|
|
2016-10-04 00:11:35 +08:00
|
|
|
extern int xfs_reflink_cancel_cow_blocks(struct xfs_inode *ip,
|
|
|
|
struct xfs_trans **tpp, xfs_fileoff_t offset_fsb,
|
2017-03-08 08:45:58 +08:00
|
|
|
xfs_fileoff_t end_fsb, bool cancel_real);
|
2016-10-04 00:11:35 +08:00
|
|
|
extern int xfs_reflink_cancel_cow_range(struct xfs_inode *ip, xfs_off_t offset,
|
2017-03-08 08:45:58 +08:00
|
|
|
xfs_off_t count, bool cancel_real);
|
2016-10-04 00:11:35 +08:00
|
|
|
extern int xfs_reflink_end_cow(struct xfs_inode *ip, xfs_off_t offset,
|
|
|
|
xfs_off_t count);
|
2016-10-04 00:11:39 +08:00
|
|
|
extern int xfs_reflink_recover_cow(struct xfs_mount *mp);
|
2016-10-20 12:50:07 +08:00
|
|
|
extern int xfs_reflink_remap_range(struct file *file_in, loff_t pos_in,
|
|
|
|
struct file *file_out, loff_t pos_out, u64 len, bool is_dedupe);
|
2017-06-17 02:00:11 +08:00
|
|
|
extern int xfs_reflink_inode_has_shared_extents(struct xfs_trans *tp,
|
|
|
|
struct xfs_inode *ip, bool *has_shared);
|
2016-10-04 00:11:43 +08:00
|
|
|
extern int xfs_reflink_clear_inode_flag(struct xfs_inode *ip,
|
|
|
|
struct xfs_trans **tpp);
|
|
|
|
extern int xfs_reflink_unshare(struct xfs_inode *ip, xfs_off_t offset,
|
|
|
|
xfs_off_t len);
|
2016-10-04 00:11:35 +08:00
|
|
|
|
2016-10-04 00:11:32 +08:00
|
|
|
#endif /* __XFS_REFLINK_H */
|