1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18#ifndef __XFS_BMAP_UTIL_H__
19#define __XFS_BMAP_UTIL_H__
20
21
22
23struct xfs_bmbt_irec;
24struct xfs_bmap_free_item;
25struct xfs_ifork;
26struct xfs_inode;
27struct xfs_mount;
28struct xfs_trans;
29
30
31
32
33struct xfs_bmalloca {
34 xfs_fsblock_t *firstblock;
35 struct xfs_bmap_free *flist;
36 struct xfs_trans *tp;
37 struct xfs_inode *ip;
38 struct xfs_bmbt_irec prev;
39 struct xfs_bmbt_irec got;
40
41 xfs_fileoff_t offset;
42 xfs_extlen_t length;
43 xfs_fsblock_t blkno;
44
45 struct xfs_btree_cur *cur;
46 xfs_extnum_t idx;
47 int nallocs;
48 int logflags;
49
50 xfs_extlen_t total;
51 xfs_extlen_t minlen;
52 xfs_extlen_t minleft;
53 char eof;
54 char wasdel;
55 char userdata;
56 char aeof;
57 char conv;
58 char stack_switch;
59 int flags;
60 struct completion *done;
61 struct work_struct work;
62 int result;
63};
64
65int xfs_bmap_finish(struct xfs_trans **tp, struct xfs_bmap_free *flist,
66 int *committed);
67int xfs_bmap_rtalloc(struct xfs_bmalloca *ap);
68int xfs_bmapi_allocate(struct xfs_bmalloca *args);
69int __xfs_bmapi_allocate(struct xfs_bmalloca *args);
70int xfs_bmap_eof(struct xfs_inode *ip, xfs_fileoff_t endoff,
71 int whichfork, int *eof);
72int xfs_bmap_count_blocks(struct xfs_trans *tp, struct xfs_inode *ip,
73 int whichfork, int *count);
74int xfs_bmap_punch_delalloc_range(struct xfs_inode *ip,
75 xfs_fileoff_t start_fsb, xfs_fileoff_t length);
76
77
78typedef int (*xfs_bmap_format_t)(void **, struct getbmapx *, int *);
79int xfs_getbmap(struct xfs_inode *ip, struct getbmapx *bmv,
80 xfs_bmap_format_t formatter, void *arg);
81
82
83void xfs_bmap_del_free(struct xfs_bmap_free *flist,
84 struct xfs_bmap_free_item *prev,
85 struct xfs_bmap_free_item *free);
86int xfs_bmap_extsize_align(struct xfs_mount *mp, struct xfs_bmbt_irec *gotp,
87 struct xfs_bmbt_irec *prevp, xfs_extlen_t extsz,
88 int rt, int eof, int delay, int convert,
89 xfs_fileoff_t *offp, xfs_extlen_t *lenp);
90void xfs_bmap_adjacent(struct xfs_bmalloca *ap);
91int xfs_bmap_last_extent(struct xfs_trans *tp, struct xfs_inode *ip,
92 int whichfork, struct xfs_bmbt_irec *rec,
93 int *is_empty);
94
95
96int xfs_alloc_file_space(struct xfs_inode *ip, xfs_off_t offset,
97 xfs_off_t len, int alloc_type);
98int xfs_free_file_space(struct xfs_inode *ip, xfs_off_t offset,
99 xfs_off_t len);
100int xfs_zero_file_space(struct xfs_inode *ip, xfs_off_t offset,
101 xfs_off_t len);
102
103
104bool xfs_can_free_eofblocks(struct xfs_inode *ip, bool force);
105int xfs_free_eofblocks(struct xfs_mount *mp, struct xfs_inode *ip,
106 bool need_iolock);
107
108int xfs_swap_extents(struct xfs_inode *ip, struct xfs_inode *tip,
109 struct xfs_swapext *sx);
110
111xfs_daddr_t xfs_fsb_to_db(struct xfs_inode *ip, xfs_fsblock_t fsb);
112
113#endif
114