1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (c) 2000-2006 Silicon Graphics, Inc.
6 #ifndef __XFS_BMAP_UTIL_H__
7 #define __XFS_BMAP_UTIL_H__
9 /* Kernel only BMAP related definitions and functions */
12 struct xfs_extent_free_item;
20 int xfs_bmap_rtalloc(struct xfs_bmalloca *ap);
21 #else /* !CONFIG_XFS_RT */
23 * Attempts to allocate RT extents when RT is disable indicates corruption and
24 * should trigger a shutdown.
27 xfs_bmap_rtalloc(struct xfs_bmalloca *ap)
31 #endif /* CONFIG_XFS_RT */
33 int xfs_bmap_punch_delalloc_range(struct xfs_inode *ip,
34 xfs_fileoff_t start_fsb, xfs_fileoff_t length);
37 __s64 bmv_offset; /* file offset of segment in blocks */
38 __s64 bmv_block; /* starting block (64-bit daddr_t) */
39 __s64 bmv_length; /* length of segment, blocks */
40 __s32 bmv_oflags; /* output flags */
42 int xfs_getbmap(struct xfs_inode *ip, struct getbmapx *bmv,
43 struct kgetbmap *out);
45 /* functions in xfs_bmap.c that are only needed by xfs_bmap_util.c */
46 int xfs_bmap_extsize_align(struct xfs_mount *mp, struct xfs_bmbt_irec *gotp,
47 struct xfs_bmbt_irec *prevp, xfs_extlen_t extsz,
48 int rt, int eof, int delay, int convert,
49 xfs_fileoff_t *offp, xfs_extlen_t *lenp);
50 void xfs_bmap_adjacent(struct xfs_bmalloca *ap);
51 int xfs_bmap_last_extent(struct xfs_trans *tp, struct xfs_inode *ip,
52 int whichfork, struct xfs_bmbt_irec *rec,
55 /* preallocation and hole punch interface */
56 int xfs_alloc_file_space(struct xfs_inode *ip, xfs_off_t offset,
58 int xfs_free_file_space(struct xfs_inode *ip, xfs_off_t offset,
60 int xfs_collapse_file_space(struct xfs_inode *, xfs_off_t offset,
62 int xfs_insert_file_space(struct xfs_inode *, xfs_off_t offset,
65 /* EOF block manipulation functions */
66 bool xfs_can_free_eofblocks(struct xfs_inode *ip, bool force);
67 int xfs_free_eofblocks(struct xfs_inode *ip);
69 int xfs_swap_extents(struct xfs_inode *ip, struct xfs_inode *tip,
70 struct xfs_swapext *sx);
72 xfs_daddr_t xfs_fsb_to_db(struct xfs_inode *ip, xfs_fsblock_t fsb);
74 xfs_extnum_t xfs_bmap_count_leaves(struct xfs_ifork *ifp, xfs_filblks_t *count);
75 int xfs_bmap_count_blocks(struct xfs_trans *tp, struct xfs_inode *ip,
76 int whichfork, xfs_extnum_t *nextents,
77 xfs_filblks_t *count);
79 int xfs_flush_unmap_range(struct xfs_inode *ip, xfs_off_t offset,
82 #endif /* __XFS_BMAP_UTIL_H__ */