mm/memunmap: don't access uninitialized memmap in memunmap_pages()
[linux-2.6-block.git] / fs / xfs / xfs_bmap_util.h
CommitLineData
0b61f8a4 1// SPDX-License-Identifier: GPL-2.0
68988114
DC
2/*
3 * Copyright (c) 2000-2006 Silicon Graphics, Inc.
4 * All Rights Reserved.
68988114
DC
5 */
6#ifndef __XFS_BMAP_UTIL_H__
7#define __XFS_BMAP_UTIL_H__
8
9/* Kernel only BMAP related definitions and functions */
10
11struct xfs_bmbt_irec;
310a75a3 12struct xfs_extent_free_item;
68988114
DC
13struct xfs_ifork;
14struct xfs_inode;
15struct xfs_mount;
16struct xfs_trans;
9799b438 17struct xfs_bmalloca;
68988114 18
bb9c2e54 19#ifdef CONFIG_XFS_RT
68988114 20int xfs_bmap_rtalloc(struct xfs_bmalloca *ap);
bb9c2e54
DC
21#else /* !CONFIG_XFS_RT */
22/*
23 * Attempts to allocate RT extents when RT is disable indicates corruption and
24 * should trigger a shutdown.
25 */
26static inline int
27xfs_bmap_rtalloc(struct xfs_bmalloca *ap)
28{
29 return -EFSCORRUPTED;
30}
31#endif /* CONFIG_XFS_RT */
32
68988114
DC
33int xfs_bmap_eof(struct xfs_inode *ip, xfs_fileoff_t endoff,
34 int whichfork, int *eof);
68988114
DC
35int xfs_bmap_punch_delalloc_range(struct xfs_inode *ip,
36 xfs_fileoff_t start_fsb, xfs_fileoff_t length);
37
232b5194
CH
38struct kgetbmap {
39 __s64 bmv_offset; /* file offset of segment in blocks */
40 __s64 bmv_block; /* starting block (64-bit daddr_t) */
41 __s64 bmv_length; /* length of segment, blocks */
42 __s32 bmv_oflags; /* output flags */
43};
68988114 44int xfs_getbmap(struct xfs_inode *ip, struct getbmapx *bmv,
232b5194 45 struct kgetbmap *out);
68988114
DC
46
47/* functions in xfs_bmap.c that are only needed by xfs_bmap_util.c */
68988114
DC
48int xfs_bmap_extsize_align(struct xfs_mount *mp, struct xfs_bmbt_irec *gotp,
49 struct xfs_bmbt_irec *prevp, xfs_extlen_t extsz,
50 int rt, int eof, int delay, int convert,
51 xfs_fileoff_t *offp, xfs_extlen_t *lenp);
52void xfs_bmap_adjacent(struct xfs_bmalloca *ap);
53int xfs_bmap_last_extent(struct xfs_trans *tp, struct xfs_inode *ip,
54 int whichfork, struct xfs_bmbt_irec *rec,
55 int *is_empty);
56
c24b5dfa 57/* preallocation and hole punch interface */
83aee9e4
CH
58int xfs_alloc_file_space(struct xfs_inode *ip, xfs_off_t offset,
59 xfs_off_t len, int alloc_type);
60int xfs_free_file_space(struct xfs_inode *ip, xfs_off_t offset,
61 xfs_off_t len);
865e9446
CH
62int xfs_zero_file_space(struct xfs_inode *ip, xfs_off_t offset,
63 xfs_off_t len);
e1d8fb88
NJ
64int xfs_collapse_file_space(struct xfs_inode *, xfs_off_t offset,
65 xfs_off_t len);
a904b1ca
NJ
66int xfs_insert_file_space(struct xfs_inode *, xfs_off_t offset,
67 xfs_off_t len);
c24b5dfa
DC
68
69/* EOF block manipulation functions */
70bool xfs_can_free_eofblocks(struct xfs_inode *ip, bool force);
a36b9261 71int xfs_free_eofblocks(struct xfs_inode *ip);
c24b5dfa 72
a133d952
DC
73int xfs_swap_extents(struct xfs_inode *ip, struct xfs_inode *tip,
74 struct xfs_swapext *sx);
75
68988114
DC
76xfs_daddr_t xfs_fsb_to_db(struct xfs_inode *ip, xfs_fsblock_t fsb);
77
e17a5c6f 78xfs_extnum_t xfs_bmap_count_leaves(struct xfs_ifork *ifp, xfs_filblks_t *count);
e7f5d5ca
DW
79int xfs_bmap_count_blocks(struct xfs_trans *tp, struct xfs_inode *ip,
80 int whichfork, xfs_extnum_t *nextents,
81 xfs_filblks_t *count);
82
2c307174
DC
83int xfs_flush_unmap_range(struct xfs_inode *ip, xfs_off_t offset,
84 xfs_off_t len);
85
68988114 86#endif /* __XFS_BMAP_UTIL_H__ */