mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-23 20:53:53 +08:00
83104d449e
Trim CoW reservations made on behalf of a cowextsz hint if they get too old or we run low on quota, so long as we don't have dirty data awaiting writeback or directio operations in progress. Garbage collection of the cowextsize extents are kept separate from prealloc extent reaping because setting the CoW prealloc lifetime to a (much) higher value than the regular prealloc extent lifetime has been useful for combatting CoW fragmentation on VM hosts where the VMs experience bursty write behaviors and we can keep the utilization ratios low enough that we don't start to run out of space. IOWs, it benefits us to keep the CoW fork reservations around for as long as we can unless we run out of blocks or hit inode reclaim. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
59 lines
2.5 KiB
C
59 lines
2.5 KiB
C
/*
|
|
* 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
|
|
|
|
extern int xfs_reflink_find_shared(struct xfs_mount *mp, xfs_agnumber_t agno,
|
|
xfs_agblock_t agbno, xfs_extlen_t aglen, xfs_agblock_t *fbno,
|
|
xfs_extlen_t *flen, bool find_maximal);
|
|
extern int xfs_reflink_trim_around_shared(struct xfs_inode *ip,
|
|
struct xfs_bmbt_irec *irec, bool *shared, bool *trimmed);
|
|
|
|
extern int xfs_reflink_reserve_cow_range(struct xfs_inode *ip,
|
|
xfs_off_t offset, xfs_off_t count);
|
|
extern int xfs_reflink_allocate_cow_range(struct xfs_inode *ip,
|
|
xfs_off_t offset, xfs_off_t count);
|
|
extern bool xfs_reflink_find_cow_mapping(struct xfs_inode *ip, xfs_off_t offset,
|
|
struct xfs_bmbt_irec *imap, bool *need_alloc);
|
|
extern int xfs_reflink_trim_irec_to_next_cow(struct xfs_inode *ip,
|
|
xfs_fileoff_t offset_fsb, struct xfs_bmbt_irec *imap);
|
|
|
|
extern int xfs_reflink_cancel_cow_blocks(struct xfs_inode *ip,
|
|
struct xfs_trans **tpp, xfs_fileoff_t offset_fsb,
|
|
xfs_fileoff_t end_fsb);
|
|
extern int xfs_reflink_cancel_cow_range(struct xfs_inode *ip, xfs_off_t offset,
|
|
xfs_off_t count);
|
|
extern int xfs_reflink_end_cow(struct xfs_inode *ip, xfs_off_t offset,
|
|
xfs_off_t count);
|
|
extern int xfs_reflink_recover_cow(struct xfs_mount *mp);
|
|
#define XFS_REFLINK_DEDUPE 1 /* only reflink if contents match */
|
|
#define XFS_REFLINK_ALL (XFS_REFLINK_DEDUPE)
|
|
extern int xfs_reflink_remap_range(struct xfs_inode *src, xfs_off_t srcoff,
|
|
struct xfs_inode *dest, xfs_off_t destoff, xfs_off_t len,
|
|
unsigned int flags);
|
|
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);
|
|
|
|
extern bool xfs_reflink_has_real_cow_blocks(struct xfs_inode *ip);
|
|
|
|
#endif /* __XFS_REFLINK_H */
|