[NTFS]
[reactos.git] / drivers / filesystems / ext2 / inc / linux / ext4.h
1 #ifndef _EXT4_H
2 #define _EXT4_H
3
4 #include <linux/jbd.h>
5 /* Temporarily we need this. */
6 #include <linux/ext3_fs.h>
7
8 typedef unsigned __int16 uint16_t;
9 typedef unsigned __int32 uint32_t;
10 typedef unsigned __int64 uint64_t;
11
12 typedef uint32_t ext4_lblk_t;
13 typedef uint64_t ext4_fsblk_t;
14
15 /*
16 * Flags used by ext4_map_blocks()
17 */
18 /* Allocate any needed blocks and/or convert an unwritten
19 extent to be an initialized ext4 */
20 #define EXT4_GET_BLOCKS_CREATE 0x0001
21 /* Request the creation of an unwritten extent */
22 #define EXT4_GET_BLOCKS_UNWRIT_EXT 0x0002
23 #define EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT (EXT4_GET_BLOCKS_UNWRIT_EXT|\
24 EXT4_GET_BLOCKS_CREATE)
25 /* Caller is from the delayed allocation writeout path
26 * finally doing the actual allocation of delayed blocks */
27 #define EXT4_GET_BLOCKS_DELALLOC_RESERVE 0x0004
28 /* caller is from the direct IO path, request to creation of an
29 unwritten extents if not allocated, split the unwritten
30 extent if blocks has been preallocated already*/
31 #define EXT4_GET_BLOCKS_PRE_IO 0x0008
32 #define EXT4_GET_BLOCKS_CONVERT 0x0010
33 #define EXT4_GET_BLOCKS_IO_CREATE_EXT (EXT4_GET_BLOCKS_PRE_IO|\
34 EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT)
35 /* Convert extent to initialized after IO complete */
36 #define EXT4_GET_BLOCKS_IO_CONVERT_EXT (EXT4_GET_BLOCKS_CONVERT|\
37 EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT)
38 /* Eventual metadata allocation (due to growing extent tree)
39 * should not fail, so try to use reserved blocks for that.*/
40 #define EXT4_GET_BLOCKS_METADATA_NOFAIL 0x0020
41 /* Don't normalize allocation size (used for fallocate) */
42 #define EXT4_GET_BLOCKS_NO_NORMALIZE 0x0040
43 /* Request will not result in inode size update (user for fallocate) */
44 #define EXT4_GET_BLOCKS_KEEP_SIZE 0x0080
45 /* Do not take i_data_sem locking in ext4_map_blocks */
46 #define EXT4_GET_BLOCKS_NO_LOCK 0x0100
47 /* Do not put hole in extent cache */
48 #define EXT4_GET_BLOCKS_NO_PUT_HOLE 0x0200
49 /* Convert written extents to unwritten */
50 #define EXT4_GET_BLOCKS_CONVERT_UNWRITTEN 0x0400
51
52 /*
53 * The bit position of these flags must not overlap with any of the
54 * EXT4_GET_BLOCKS_*. They are used by ext4_find_extent(),
55 * read_extent_tree_block(), ext4_split_extent_at(),
56 * ext4_ext_insert_extent(), and ext4_ext_create_new_leaf().
57 * EXT4_EX_NOCACHE is used to indicate that the we shouldn't be
58 * caching the extents when reading from the extent tree while a
59 * truncate or punch hole operation is in progress.
60 */
61 #define EXT4_EX_NOCACHE 0x40000000
62 #define EXT4_EX_FORCE_CACHE 0x20000000
63
64 /*
65 * Flags used by ext4_free_blocks
66 */
67 #define EXT4_FREE_BLOCKS_METADATA 0x0001
68 #define EXT4_FREE_BLOCKS_FORGET 0x0002
69 #define EXT4_FREE_BLOCKS_VALIDATED 0x0004
70 #define EXT4_FREE_BLOCKS_NO_QUOT_UPDATE 0x0008
71 #define EXT4_FREE_BLOCKS_NOFREE_FIRST_CLUSTER 0x0010
72 #define EXT4_FREE_BLOCKS_NOFREE_LAST_CLUSTER 0x0020
73
74 /*
75 * Flags used in mballoc's allocation_context flags field.
76 *
77 * Also used to show what's going on for debugging purposes when the
78 * flag field is exported via the traceport interface
79 */
80
81 /* prefer goal again. length */
82 #define EXT4_MB_HINT_MERGE 0x0001
83 /* blocks already reserved */
84 #define EXT4_MB_HINT_RESERVED 0x0002
85 /* metadata is being allocated */
86 #define EXT4_MB_HINT_METADATA 0x0004
87 /* first blocks in the file */
88 #define EXT4_MB_HINT_FIRST 0x0008
89 /* search for the best chunk */
90 #define EXT4_MB_HINT_BEST 0x0010
91 /* data is being allocated */
92 #define EXT4_MB_HINT_DATA 0x0020
93 /* don't preallocate (for tails) */
94 #define EXT4_MB_HINT_NOPREALLOC 0x0040
95 /* allocate for locality group */
96 #define EXT4_MB_HINT_GROUP_ALLOC 0x0080
97 /* allocate goal blocks or none */
98 #define EXT4_MB_HINT_GOAL_ONLY 0x0100
99 /* goal is meaningful */
100 #define EXT4_MB_HINT_TRY_GOAL 0x0200
101 /* blocks already pre-reserved by delayed allocation */
102 #define EXT4_MB_DELALLOC_RESERVED 0x0400
103 /* We are doing stream allocation */
104 #define EXT4_MB_STREAM_ALLOC 0x0800
105 /* Use reserved root blocks if needed */
106 #define EXT4_MB_USE_ROOT_BLOCKS 0x1000
107 /* Use blocks from reserved pool */
108 #define EXT4_MB_USE_RESERVED 0x2000
109
110
111 #define ext4_sb_info ext3_sb_info
112
113 static inline struct ext4_sb_info * EXT4_SB(struct super_block *sb)
114 {
115 return sb->s_fs_info;
116 }
117 #define EXT4_I(i) (i)
118
119 #include <linux/ext4_jbd2.h>
120 #include <linux/ext4_ext.h>
121
122 #endif /* _EXT4_H */