aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_bmap_util.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-09-09 14:19:09 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-09-09 14:19:09 -0400
commit300893b08f3bc7057a7a5f84074090ba66c8b5ca (patch)
tree5fc5aef0b9dbab8e47e161303d57e631786c7d17 /fs/xfs/xfs_bmap_util.h
parent45150c43b1b0c16e665fd0a5cdcca128b8192db1 (diff)
parent1d03c6fa88af35e55047a1f2ab116f0fdf2f55aa (diff)
Merge tag 'xfs-for-linus-v3.12-rc1' of git://oss.sgi.com/xfs/xfs
Pull xfs updates from Ben Myers: "For 3.12-rc1 there are a number of bugfixes in addition to work to ease usage of shared code between libxfs and the kernel, the rest of the work to enable project and group quotas to be used simultaneously, performance optimisations in the log and the CIL, directory entry file type support, fixes for log space reservations, some spelling/grammar cleanups, and the addition of user namespace support. - introduce readahead to log recovery - add directory entry file type support - fix a number of spelling errors in comments - introduce new Q_XGETQSTATV quotactl for project quotas - add USER_NS support - log space reservation rework - CIL optimisations - kernel/userspace libxfs rework" * tag 'xfs-for-linus-v3.12-rc1' of git://oss.sgi.com/xfs/xfs: (112 commits) xfs: XFS_MOUNT_QUOTA_ALL needed by userspace xfs: dtype changed xfs_dir2_sfe_put_ino to xfs_dir3_sfe_put_ino Fix wrong flag ASSERT in xfs_attr_shortform_getvalue xfs: finish removing IOP_* macros. xfs: inode log reservations are too small xfs: check correct status variable for xfs_inobt_get_rec() call xfs: inode buffers may not be valid during recovery readahead xfs: check LSN ordering for v5 superblocks during recovery xfs: btree block LSN escaping to disk uninitialised XFS: Assertion failed: first <= last && last < BBTOB(bp->b_length), file: fs/xfs/xfs_trans_buf.c, line: 568 xfs: fix bad dquot buffer size in log recovery readahead xfs: don't account buffer cancellation during log recovery readahead xfs: check for underflow in xfs_iformat_fork() xfs: xfs_dir3_sfe_put_ino can be static xfs: introduce object readahead to log recovery xfs: Simplify xfs_ail_min() with list_first_entry_or_null() xfs: Register hotcpu notifier after initialization xfs: add xfs sb v4 support for dirent filetype field xfs: Add write support for dirent filetype field xfs: Add read-only support for dirent filetype field ...
Diffstat (limited to 'fs/xfs/xfs_bmap_util.h')
-rw-r--r--fs/xfs/xfs_bmap_util.h110
1 files changed, 110 insertions, 0 deletions
diff --git a/fs/xfs/xfs_bmap_util.h b/fs/xfs/xfs_bmap_util.h
new file mode 100644
index 000000000000..061260946f7a
--- /dev/null
+++ b/fs/xfs/xfs_bmap_util.h
@@ -0,0 +1,110 @@
1/*
2 * Copyright (c) 2000-2006 Silicon Graphics, Inc.
3 * All Rights Reserved.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it would be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18#ifndef __XFS_BMAP_UTIL_H__
19#define __XFS_BMAP_UTIL_H__
20
21/* Kernel only BMAP related definitions and functions */
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 * Argument structure for xfs_bmap_alloc.
32 */
33struct xfs_bmalloca {
34 xfs_fsblock_t *firstblock; /* i/o first block allocated */
35 struct xfs_bmap_free *flist; /* bmap freelist */
36 struct xfs_trans *tp; /* transaction pointer */
37 struct xfs_inode *ip; /* incore inode pointer */
38 struct xfs_bmbt_irec prev; /* extent before the new one */
39 struct xfs_bmbt_irec got; /* extent after, or delayed */
40
41 xfs_fileoff_t offset; /* offset in file filling in */
42 xfs_extlen_t length; /* i/o length asked/allocated */
43 xfs_fsblock_t blkno; /* starting block of new extent */
44
45 struct xfs_btree_cur *cur; /* btree cursor */
46 xfs_extnum_t idx; /* current extent index */
47 int nallocs;/* number of extents alloc'd */
48 int logflags;/* flags for transaction logging */
49
50 xfs_extlen_t total; /* total blocks needed for xaction */
51 xfs_extlen_t minlen; /* minimum allocation size (blocks) */
52 xfs_extlen_t minleft; /* amount must be left after alloc */
53 char eof; /* set if allocating past last extent */
54 char wasdel; /* replacing a delayed allocation */
55 char userdata;/* set if is user data */
56 char aeof; /* allocated space at eof */
57 char conv; /* overwriting unwritten extents */
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/* bmap to userspace formatter - copy to user & advance pointer */
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/* functions in xfs_bmap.c that are only needed by xfs_bmap_util.c */
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/* preallocation and hole punch interface */
96int xfs_change_file_space(struct xfs_inode *ip, int cmd,
97 xfs_flock64_t *bf, xfs_off_t offset,
98 int attr_flags);
99
100/* EOF block manipulation functions */
101bool xfs_can_free_eofblocks(struct xfs_inode *ip, bool force);
102int xfs_free_eofblocks(struct xfs_mount *mp, struct xfs_inode *ip,
103 bool need_iolock);
104
105int xfs_swap_extents(struct xfs_inode *ip, struct xfs_inode *tip,
106 struct xfs_swapext *sx);
107
108xfs_daddr_t xfs_fsb_to_db(struct xfs_inode *ip, xfs_fsblock_t fsb);
109
110#endif /* __XFS_BMAP_UTIL_H__ */