![Darrick J. Wong](/assets/img/avatar_default.png)
Modify the writepage handler to find and convert pending delalloc extents to real allocations. Furthermore, when we're doing non-cow writes to a part of a file that already has a CoW reservation (the cowextsz hint that we set up in a subsequent patch facilitates this), promote the write to copy-on-write so that the entire extent can get written out as a single extent on disk, thereby reducing post-CoW fragmentation. Christoph moved the CoW support code in _map_blocks to a separate helper function, refactored other functions, and reduced the number of CoW fork lookups, so I merged those changes here to reduce churn. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
37 lines
1.5 KiB
C
37 lines
1.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 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);
|
|
|
|
#endif /* __XFS_REFLINK_H */
|