2018-06-06 05:42:14 +03:00
// SPDX-License-Identifier: GPL-2.0+
2016-10-03 19:11:32 +03:00
/*
* Copyright ( C ) 2016 Oracle . All Rights Reserved .
* Author : Darrick J . Wong < darrick . wong @ oracle . com >
*/
# ifndef __XFS_REFLINK_H
# define __XFS_REFLINK_H 1
2019-02-18 20:38:49 +03:00
static inline bool xfs_is_always_cow_inode ( struct xfs_inode * ip )
{
2021-08-19 04:46:55 +03:00
return ip - > i_mount - > m_always_cow & & xfs_has_reflink ( ip - > i_mount ) ;
2019-02-18 20:38:49 +03:00
}
static inline bool xfs_is_cow_inode ( struct xfs_inode * ip )
{
return xfs_is_reflink_inode ( ip ) | | xfs_is_always_cow_inode ( ip ) ;
}
2016-10-03 19:11:33 +03:00
extern int xfs_reflink_trim_around_shared ( struct xfs_inode * ip ,
2018-10-18 09:19:48 +03:00
struct xfs_bmbt_irec * irec , bool * shared ) ;
2020-01-21 01:34:47 +03:00
int xfs_bmap_trim_cow ( struct xfs_inode * ip , struct xfs_bmbt_irec * imap ,
2019-02-18 20:38:49 +03:00
bool * shared ) ;
2016-10-03 19:11:33 +03:00
2019-10-19 19:09:43 +03:00
int xfs_reflink_allocate_cow ( struct xfs_inode * ip , struct xfs_bmbt_irec * imap ,
struct xfs_bmbt_irec * cmap , bool * shared , uint * lockmode ,
2019-02-22 03:26:35 +03:00
bool convert_now ) ;
2017-02-03 02:14:02 +03:00
extern int xfs_reflink_convert_cow ( struct xfs_inode * ip , xfs_off_t offset ,
xfs_off_t count ) ;
2016-10-03 19:11:33 +03:00
2016-10-03 19:11:35 +03:00
extern int xfs_reflink_cancel_cow_blocks ( struct xfs_inode * ip ,
struct xfs_trans * * tpp , xfs_fileoff_t offset_fsb ,
2017-03-08 03:45:58 +03:00
xfs_fileoff_t end_fsb , bool cancel_real ) ;
2016-10-03 19:11:35 +03:00
extern int xfs_reflink_cancel_cow_range ( struct xfs_inode * ip , xfs_off_t offset ,
2017-03-08 03:45:58 +03:00
xfs_off_t count , bool cancel_real ) ;
2016-10-03 19:11:35 +03:00
extern int xfs_reflink_end_cow ( struct xfs_inode * ip , xfs_off_t offset ,
xfs_off_t count ) ;
2016-10-03 19:11:39 +03:00
extern int xfs_reflink_recover_cow ( struct xfs_mount * mp ) ;
2018-10-30 02:47:06 +03:00
extern loff_t xfs_reflink_remap_range ( struct file * file_in , loff_t pos_in ,
2018-10-30 02:41:49 +03:00
struct file * file_out , loff_t pos_out , loff_t len ,
2018-10-30 02:41:28 +03:00
unsigned int remap_flags ) ;
2017-06-16 21:00:11 +03:00
extern int xfs_reflink_inode_has_shared_extents ( struct xfs_trans * tp ,
struct xfs_inode * ip , bool * has_shared ) ;
2016-10-03 19:11:43 +03: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 ) ;
2018-10-30 02:47:26 +03:00
extern int xfs_reflink_remap_prep ( struct file * file_in , loff_t pos_in ,
struct file * file_out , loff_t pos_out , loff_t * len ,
unsigned int remap_flags ) ;
extern int xfs_reflink_remap_blocks ( struct xfs_inode * src , loff_t pos_in ,
struct xfs_inode * dest , loff_t pos_out , loff_t remap_len ,
loff_t * remapped ) ;
extern int xfs_reflink_update_dest ( struct xfs_inode * dest , xfs_off_t newlen ,
xfs_extlen_t cowextsize , unsigned int remap_flags ) ;
2016-10-03 19:11:35 +03:00
2016-10-03 19:11:32 +03:00
# endif /* __XFS_REFLINK_H */