diff options
author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
---|---|---|
committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
commit | 8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch) | |
tree | a8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /fs/ext4/ext4.h | |
parent | 406089d01562f1e2bf9f089fd7637009ebaad589 (diff) |
Patched in Tegra support.
Diffstat (limited to 'fs/ext4/ext4.h')
-rw-r--r-- | fs/ext4/ext4.h | 587 |
1 files changed, 128 insertions, 459 deletions
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 8462eb3c33a..5c38120c389 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h | |||
@@ -29,7 +29,6 @@ | |||
29 | #include <linux/wait.h> | 29 | #include <linux/wait.h> |
30 | #include <linux/blockgroup_lock.h> | 30 | #include <linux/blockgroup_lock.h> |
31 | #include <linux/percpu_counter.h> | 31 | #include <linux/percpu_counter.h> |
32 | #include <crypto/hash.h> | ||
33 | #ifdef __KERNEL__ | 32 | #ifdef __KERNEL__ |
34 | #include <linux/compat.h> | 33 | #include <linux/compat.h> |
35 | #endif | 34 | #endif |
@@ -54,17 +53,7 @@ | |||
54 | printk(KERN_DEBUG f, ## a); \ | 53 | printk(KERN_DEBUG f, ## a); \ |
55 | } while (0) | 54 | } while (0) |
56 | #else | 55 | #else |
57 | #define ext4_debug(fmt, ...) no_printk(fmt, ##__VA_ARGS__) | 56 | #define ext4_debug(f, a...) do {} while (0) |
58 | #endif | ||
59 | |||
60 | /* | ||
61 | * Turn on EXT_DEBUG to get lots of info about extents operations. | ||
62 | */ | ||
63 | #define EXT_DEBUG__ | ||
64 | #ifdef EXT_DEBUG | ||
65 | #define ext_debug(fmt, ...) printk(fmt, ##__VA_ARGS__) | ||
66 | #else | ||
67 | #define ext_debug(fmt, ...) no_printk(fmt, ##__VA_ARGS__) | ||
68 | #endif | 57 | #endif |
69 | 58 | ||
70 | #define EXT4_ERROR_INODE(inode, fmt, a...) \ | 59 | #define EXT4_ERROR_INODE(inode, fmt, a...) \ |
@@ -155,17 +144,9 @@ struct ext4_allocation_request { | |||
155 | #define EXT4_MAP_UNWRITTEN (1 << BH_Unwritten) | 144 | #define EXT4_MAP_UNWRITTEN (1 << BH_Unwritten) |
156 | #define EXT4_MAP_BOUNDARY (1 << BH_Boundary) | 145 | #define EXT4_MAP_BOUNDARY (1 << BH_Boundary) |
157 | #define EXT4_MAP_UNINIT (1 << BH_Uninit) | 146 | #define EXT4_MAP_UNINIT (1 << BH_Uninit) |
158 | /* Sometimes (in the bigalloc case, from ext4_da_get_block_prep) the caller of | ||
159 | * ext4_map_blocks wants to know whether or not the underlying cluster has | ||
160 | * already been accounted for. EXT4_MAP_FROM_CLUSTER conveys to the caller that | ||
161 | * the requested mapping was from previously mapped (or delayed allocated) | ||
162 | * cluster. We use BH_AllocFromCluster only for this flag. BH_AllocFromCluster | ||
163 | * should never appear on buffer_head's state flags. | ||
164 | */ | ||
165 | #define EXT4_MAP_FROM_CLUSTER (1 << BH_AllocFromCluster) | ||
166 | #define EXT4_MAP_FLAGS (EXT4_MAP_NEW | EXT4_MAP_MAPPED |\ | 147 | #define EXT4_MAP_FLAGS (EXT4_MAP_NEW | EXT4_MAP_MAPPED |\ |
167 | EXT4_MAP_UNWRITTEN | EXT4_MAP_BOUNDARY |\ | 148 | EXT4_MAP_UNWRITTEN | EXT4_MAP_BOUNDARY |\ |
168 | EXT4_MAP_UNINIT | EXT4_MAP_FROM_CLUSTER) | 149 | EXT4_MAP_UNINIT) |
169 | 150 | ||
170 | struct ext4_map_blocks { | 151 | struct ext4_map_blocks { |
171 | ext4_fsblk_t m_pblk; | 152 | ext4_fsblk_t m_pblk; |
@@ -195,7 +176,6 @@ struct mpage_da_data { | |||
195 | #define EXT4_IO_END_UNWRITTEN 0x0001 | 176 | #define EXT4_IO_END_UNWRITTEN 0x0001 |
196 | #define EXT4_IO_END_ERROR 0x0002 | 177 | #define EXT4_IO_END_ERROR 0x0002 |
197 | #define EXT4_IO_END_QUEUED 0x0004 | 178 | #define EXT4_IO_END_QUEUED 0x0004 |
198 | #define EXT4_IO_END_DIRECT 0x0008 | ||
199 | 179 | ||
200 | struct ext4_io_page { | 180 | struct ext4_io_page { |
201 | struct page *p_page; | 181 | struct page *p_page; |
@@ -204,25 +184,18 @@ struct ext4_io_page { | |||
204 | 184 | ||
205 | #define MAX_IO_PAGES 128 | 185 | #define MAX_IO_PAGES 128 |
206 | 186 | ||
207 | /* | ||
208 | * For converting uninitialized extents on a work queue. | ||
209 | * | ||
210 | * 'page' is only used from the writepage() path; 'pages' is only used for | ||
211 | * buffered writes; they are used to keep page references until conversion | ||
212 | * takes place. For AIO/DIO, neither field is filled in. | ||
213 | */ | ||
214 | typedef struct ext4_io_end { | 187 | typedef struct ext4_io_end { |
215 | struct list_head list; /* per-file finished IO list */ | 188 | struct list_head list; /* per-file finished IO list */ |
216 | struct inode *inode; /* file being written to */ | 189 | struct inode *inode; /* file being written to */ |
217 | unsigned int flag; /* unwritten or not */ | 190 | unsigned int flag; /* unwritten or not */ |
218 | struct page *page; /* for writepage() path */ | 191 | struct page *page; /* page struct for buffer write */ |
219 | loff_t offset; /* offset in the file */ | 192 | loff_t offset; /* offset in the file */ |
220 | ssize_t size; /* size of the extent */ | 193 | ssize_t size; /* size of the extent */ |
221 | struct work_struct work; /* data work queue */ | 194 | struct work_struct work; /* data work queue */ |
222 | struct kiocb *iocb; /* iocb struct for AIO */ | 195 | struct kiocb *iocb; /* iocb struct for AIO */ |
223 | int result; /* error value for AIO */ | 196 | int result; /* error value for AIO */ |
224 | int num_io_pages; /* for writepages() */ | 197 | int num_io_pages; |
225 | struct ext4_io_page *pages[MAX_IO_PAGES]; /* for writepages() */ | 198 | struct ext4_io_page *pages[MAX_IO_PAGES]; |
226 | } ext4_io_end_t; | 199 | } ext4_io_end_t; |
227 | 200 | ||
228 | struct ext4_io_submit { | 201 | struct ext4_io_submit { |
@@ -266,11 +239,8 @@ struct ext4_io_submit { | |||
266 | # define EXT4_BLOCK_SIZE(s) (EXT4_MIN_BLOCK_SIZE << (s)->s_log_block_size) | 239 | # define EXT4_BLOCK_SIZE(s) (EXT4_MIN_BLOCK_SIZE << (s)->s_log_block_size) |
267 | #endif | 240 | #endif |
268 | #define EXT4_ADDR_PER_BLOCK(s) (EXT4_BLOCK_SIZE(s) / sizeof(__u32)) | 241 | #define EXT4_ADDR_PER_BLOCK(s) (EXT4_BLOCK_SIZE(s) / sizeof(__u32)) |
269 | #define EXT4_CLUSTER_SIZE(s) (EXT4_BLOCK_SIZE(s) << \ | ||
270 | EXT4_SB(s)->s_cluster_bits) | ||
271 | #ifdef __KERNEL__ | 242 | #ifdef __KERNEL__ |
272 | # define EXT4_BLOCK_SIZE_BITS(s) ((s)->s_blocksize_bits) | 243 | # define EXT4_BLOCK_SIZE_BITS(s) ((s)->s_blocksize_bits) |
273 | # define EXT4_CLUSTER_BITS(s) (EXT4_SB(s)->s_cluster_bits) | ||
274 | #else | 244 | #else |
275 | # define EXT4_BLOCK_SIZE_BITS(s) ((s)->s_log_block_size + 10) | 245 | # define EXT4_BLOCK_SIZE_BITS(s) ((s)->s_log_block_size + 10) |
276 | #endif | 246 | #endif |
@@ -288,14 +258,6 @@ struct ext4_io_submit { | |||
288 | #endif | 258 | #endif |
289 | #define EXT4_BLOCK_ALIGN(size, blkbits) ALIGN((size), (1 << (blkbits))) | 259 | #define EXT4_BLOCK_ALIGN(size, blkbits) ALIGN((size), (1 << (blkbits))) |
290 | 260 | ||
291 | /* Translate a block number to a cluster number */ | ||
292 | #define EXT4_B2C(sbi, blk) ((blk) >> (sbi)->s_cluster_bits) | ||
293 | /* Translate a cluster number to a block number */ | ||
294 | #define EXT4_C2B(sbi, cluster) ((cluster) << (sbi)->s_cluster_bits) | ||
295 | /* Translate # of blks to # of clusters */ | ||
296 | #define EXT4_NUM_B2C(sbi, blks) (((blks) + (sbi)->s_cluster_ratio - 1) >> \ | ||
297 | (sbi)->s_cluster_bits) | ||
298 | |||
299 | /* | 261 | /* |
300 | * Structure of a blocks group descriptor | 262 | * Structure of a blocks group descriptor |
301 | */ | 263 | */ |
@@ -308,9 +270,7 @@ struct ext4_group_desc | |||
308 | __le16 bg_free_inodes_count_lo;/* Free inodes count */ | 270 | __le16 bg_free_inodes_count_lo;/* Free inodes count */ |
309 | __le16 bg_used_dirs_count_lo; /* Directories count */ | 271 | __le16 bg_used_dirs_count_lo; /* Directories count */ |
310 | __le16 bg_flags; /* EXT4_BG_flags (INODE_UNINIT, etc) */ | 272 | __le16 bg_flags; /* EXT4_BG_flags (INODE_UNINIT, etc) */ |
311 | __le32 bg_exclude_bitmap_lo; /* Exclude bitmap for snapshots */ | 273 | __u32 bg_reserved[2]; /* Likely block/inode bitmap checksum */ |
312 | __le16 bg_block_bitmap_csum_lo;/* crc32c(s_uuid+grp_num+bbitmap) LE */ | ||
313 | __le16 bg_inode_bitmap_csum_lo;/* crc32c(s_uuid+grp_num+ibitmap) LE */ | ||
314 | __le16 bg_itable_unused_lo; /* Unused inodes count */ | 274 | __le16 bg_itable_unused_lo; /* Unused inodes count */ |
315 | __le16 bg_checksum; /* crc16(sb_uuid+group+desc) */ | 275 | __le16 bg_checksum; /* crc16(sb_uuid+group+desc) */ |
316 | __le32 bg_block_bitmap_hi; /* Blocks bitmap block MSB */ | 276 | __le32 bg_block_bitmap_hi; /* Blocks bitmap block MSB */ |
@@ -320,26 +280,16 @@ struct ext4_group_desc | |||
320 | __le16 bg_free_inodes_count_hi;/* Free inodes count MSB */ | 280 | __le16 bg_free_inodes_count_hi;/* Free inodes count MSB */ |
321 | __le16 bg_used_dirs_count_hi; /* Directories count MSB */ | 281 | __le16 bg_used_dirs_count_hi; /* Directories count MSB */ |
322 | __le16 bg_itable_unused_hi; /* Unused inodes count MSB */ | 282 | __le16 bg_itable_unused_hi; /* Unused inodes count MSB */ |
323 | __le32 bg_exclude_bitmap_hi; /* Exclude bitmap block MSB */ | 283 | __u32 bg_reserved2[3]; |
324 | __le16 bg_block_bitmap_csum_hi;/* crc32c(s_uuid+grp_num+bbitmap) BE */ | ||
325 | __le16 bg_inode_bitmap_csum_hi;/* crc32c(s_uuid+grp_num+ibitmap) BE */ | ||
326 | __u32 bg_reserved; | ||
327 | }; | 284 | }; |
328 | 285 | ||
329 | #define EXT4_BG_INODE_BITMAP_CSUM_HI_END \ | ||
330 | (offsetof(struct ext4_group_desc, bg_inode_bitmap_csum_hi) + \ | ||
331 | sizeof(__le16)) | ||
332 | #define EXT4_BG_BLOCK_BITMAP_CSUM_HI_END \ | ||
333 | (offsetof(struct ext4_group_desc, bg_block_bitmap_csum_hi) + \ | ||
334 | sizeof(__le16)) | ||
335 | |||
336 | /* | 286 | /* |
337 | * Structure of a flex block group info | 287 | * Structure of a flex block group info |
338 | */ | 288 | */ |
339 | 289 | ||
340 | struct flex_groups { | 290 | struct flex_groups { |
341 | atomic_t free_inodes; | 291 | atomic_t free_inodes; |
342 | atomic_t free_clusters; | 292 | atomic_t free_blocks; |
343 | atomic_t used_dirs; | 293 | atomic_t used_dirs; |
344 | }; | 294 | }; |
345 | 295 | ||
@@ -356,7 +306,6 @@ struct flex_groups { | |||
356 | #define EXT4_DESC_SIZE(s) (EXT4_SB(s)->s_desc_size) | 306 | #define EXT4_DESC_SIZE(s) (EXT4_SB(s)->s_desc_size) |
357 | #ifdef __KERNEL__ | 307 | #ifdef __KERNEL__ |
358 | # define EXT4_BLOCKS_PER_GROUP(s) (EXT4_SB(s)->s_blocks_per_group) | 308 | # define EXT4_BLOCKS_PER_GROUP(s) (EXT4_SB(s)->s_blocks_per_group) |
359 | # define EXT4_CLUSTERS_PER_GROUP(s) (EXT4_SB(s)->s_clusters_per_group) | ||
360 | # define EXT4_DESC_PER_BLOCK(s) (EXT4_SB(s)->s_desc_per_block) | 309 | # define EXT4_DESC_PER_BLOCK(s) (EXT4_SB(s)->s_desc_per_block) |
361 | # define EXT4_INODES_PER_GROUP(s) (EXT4_SB(s)->s_inodes_per_group) | 310 | # define EXT4_INODES_PER_GROUP(s) (EXT4_SB(s)->s_inodes_per_group) |
362 | # define EXT4_DESC_PER_BLOCK_BITS(s) (EXT4_SB(s)->s_desc_per_block_bits) | 311 | # define EXT4_DESC_PER_BLOCK_BITS(s) (EXT4_SB(s)->s_desc_per_block_bits) |
@@ -402,7 +351,6 @@ struct flex_groups { | |||
402 | #define EXT4_EXTENTS_FL 0x00080000 /* Inode uses extents */ | 351 | #define EXT4_EXTENTS_FL 0x00080000 /* Inode uses extents */ |
403 | #define EXT4_EA_INODE_FL 0x00200000 /* Inode used for large EA */ | 352 | #define EXT4_EA_INODE_FL 0x00200000 /* Inode used for large EA */ |
404 | #define EXT4_EOFBLOCKS_FL 0x00400000 /* Blocks allocated beyond EOF */ | 353 | #define EXT4_EOFBLOCKS_FL 0x00400000 /* Blocks allocated beyond EOF */ |
405 | #define EXT4_INLINE_DATA_FL 0x10000000 /* Inode has inline data. */ | ||
406 | #define EXT4_RESERVED_FL 0x80000000 /* reserved for ext4 lib */ | 354 | #define EXT4_RESERVED_FL 0x80000000 /* reserved for ext4 lib */ |
407 | 355 | ||
408 | #define EXT4_FL_USER_VISIBLE 0x004BDFFF /* User visible flags */ | 356 | #define EXT4_FL_USER_VISIBLE 0x004BDFFF /* User visible flags */ |
@@ -459,26 +407,28 @@ enum { | |||
459 | EXT4_INODE_EXTENTS = 19, /* Inode uses extents */ | 407 | EXT4_INODE_EXTENTS = 19, /* Inode uses extents */ |
460 | EXT4_INODE_EA_INODE = 21, /* Inode used for large EA */ | 408 | EXT4_INODE_EA_INODE = 21, /* Inode used for large EA */ |
461 | EXT4_INODE_EOFBLOCKS = 22, /* Blocks allocated beyond EOF */ | 409 | EXT4_INODE_EOFBLOCKS = 22, /* Blocks allocated beyond EOF */ |
462 | EXT4_INODE_INLINE_DATA = 28, /* Data in inode. */ | ||
463 | EXT4_INODE_RESERVED = 31, /* reserved for ext4 lib */ | 410 | EXT4_INODE_RESERVED = 31, /* reserved for ext4 lib */ |
464 | }; | 411 | }; |
465 | 412 | ||
466 | /* | 413 | #define TEST_FLAG_VALUE(FLAG) (EXT4_##FLAG##_FL == (1 << EXT4_INODE_##FLAG)) |
467 | * Since it's pretty easy to mix up bit numbers and hex values, we use a | 414 | #define CHECK_FLAG_VALUE(FLAG) if (!TEST_FLAG_VALUE(FLAG)) { \ |
468 | * build-time check to make sure that EXT4_XXX_FL is consistent with respect to | 415 | printk(KERN_EMERG "EXT4 flag fail: " #FLAG ": %d %d\n", \ |
469 | * EXT4_INODE_XXX. If all is well, the macros will be dropped, so, it won't cost | 416 | EXT4_##FLAG##_FL, EXT4_INODE_##FLAG); BUG_ON(1); } |
470 | * any extra space in the compiled kernel image, otherwise, the build will fail. | 417 | |
471 | * It's important that these values are the same, since we are using | 418 | /* |
472 | * EXT4_INODE_XXX to test for flag values, but EXT4_XXX_FL must be consistent | 419 | * Since it's pretty easy to mix up bit numbers and hex values, and we |
473 | * with the values of FS_XXX_FL defined in include/linux/fs.h and the on-disk | 420 | * can't do a compile-time test for ENUM values, we use a run-time |
474 | * values found in ext2, ext3 and ext4 filesystems, and of course the values | 421 | * test to make sure that EXT4_XXX_FL is consistent with respect to |
475 | * defined in e2fsprogs. | 422 | * EXT4_INODE_XXX. If all is well the printk and BUG_ON will all drop |
423 | * out so it won't cost any extra space in the compiled kernel image. | ||
424 | * But it's important that these values are the same, since we are | ||
425 | * using EXT4_INODE_XXX to test for the flag values, but EXT4_XX_FL | ||
426 | * must be consistent with the values of FS_XXX_FL defined in | ||
427 | * include/linux/fs.h and the on-disk values found in ext2, ext3, and | ||
428 | * ext4 filesystems, and of course the values defined in e2fsprogs. | ||
476 | * | 429 | * |
477 | * It's not paranoia if the Murphy's Law really *is* out to get you. :-) | 430 | * It's not paranoia if the Murphy's Law really *is* out to get you. :-) |
478 | */ | 431 | */ |
479 | #define TEST_FLAG_VALUE(FLAG) (EXT4_##FLAG##_FL == (1 << EXT4_INODE_##FLAG)) | ||
480 | #define CHECK_FLAG_VALUE(FLAG) BUILD_BUG_ON(!TEST_FLAG_VALUE(FLAG)) | ||
481 | |||
482 | static inline void ext4_check_flag_values(void) | 432 | static inline void ext4_check_flag_values(void) |
483 | { | 433 | { |
484 | CHECK_FLAG_VALUE(SECRM); | 434 | CHECK_FLAG_VALUE(SECRM); |
@@ -503,7 +453,6 @@ static inline void ext4_check_flag_values(void) | |||
503 | CHECK_FLAG_VALUE(EXTENTS); | 453 | CHECK_FLAG_VALUE(EXTENTS); |
504 | CHECK_FLAG_VALUE(EA_INODE); | 454 | CHECK_FLAG_VALUE(EA_INODE); |
505 | CHECK_FLAG_VALUE(EOFBLOCKS); | 455 | CHECK_FLAG_VALUE(EOFBLOCKS); |
506 | CHECK_FLAG_VALUE(INLINE_DATA); | ||
507 | CHECK_FLAG_VALUE(RESERVED); | 456 | CHECK_FLAG_VALUE(RESERVED); |
508 | } | 457 | } |
509 | 458 | ||
@@ -542,14 +491,6 @@ struct ext4_new_group_data { | |||
542 | __u32 free_blocks_count; | 491 | __u32 free_blocks_count; |
543 | }; | 492 | }; |
544 | 493 | ||
545 | /* Indexes used to index group tables in ext4_new_group_data */ | ||
546 | enum { | ||
547 | BLOCK_BITMAP = 0, /* block bitmap */ | ||
548 | INODE_BITMAP, /* inode bitmap */ | ||
549 | INODE_TABLE, /* inode tables */ | ||
550 | GROUP_TABLE_COUNT, | ||
551 | }; | ||
552 | |||
553 | /* | 494 | /* |
554 | * Flags used by ext4_map_blocks() | 495 | * Flags used by ext4_map_blocks() |
555 | */ | 496 | */ |
@@ -578,10 +519,6 @@ enum { | |||
578 | #define EXT4_GET_BLOCKS_PUNCH_OUT_EXT 0x0020 | 519 | #define EXT4_GET_BLOCKS_PUNCH_OUT_EXT 0x0020 |
579 | /* Don't normalize allocation size (used for fallocate) */ | 520 | /* Don't normalize allocation size (used for fallocate) */ |
580 | #define EXT4_GET_BLOCKS_NO_NORMALIZE 0x0040 | 521 | #define EXT4_GET_BLOCKS_NO_NORMALIZE 0x0040 |
581 | /* Request will not result in inode size update (user for fallocate) */ | ||
582 | #define EXT4_GET_BLOCKS_KEEP_SIZE 0x0080 | ||
583 | /* Do not take i_data_sem locking in ext4_map_blocks */ | ||
584 | #define EXT4_GET_BLOCKS_NO_LOCK 0x0100 | ||
585 | 522 | ||
586 | /* | 523 | /* |
587 | * Flags used by ext4_free_blocks | 524 | * Flags used by ext4_free_blocks |
@@ -590,13 +527,6 @@ enum { | |||
590 | #define EXT4_FREE_BLOCKS_FORGET 0x0002 | 527 | #define EXT4_FREE_BLOCKS_FORGET 0x0002 |
591 | #define EXT4_FREE_BLOCKS_VALIDATED 0x0004 | 528 | #define EXT4_FREE_BLOCKS_VALIDATED 0x0004 |
592 | #define EXT4_FREE_BLOCKS_NO_QUOT_UPDATE 0x0008 | 529 | #define EXT4_FREE_BLOCKS_NO_QUOT_UPDATE 0x0008 |
593 | #define EXT4_FREE_BLOCKS_NOFREE_FIRST_CLUSTER 0x0010 | ||
594 | #define EXT4_FREE_BLOCKS_NOFREE_LAST_CLUSTER 0x0020 | ||
595 | |||
596 | /* | ||
597 | * Flags used by ext4_discard_partial_page_buffers | ||
598 | */ | ||
599 | #define EXT4_DISCARD_PARTIAL_PG_ZERO_UNMAPPED 0x0001 | ||
600 | 530 | ||
601 | /* | 531 | /* |
602 | * ioctl commands | 532 | * ioctl commands |
@@ -607,6 +537,9 @@ enum { | |||
607 | #define EXT4_IOC_SETVERSION _IOW('f', 4, long) | 537 | #define EXT4_IOC_SETVERSION _IOW('f', 4, long) |
608 | #define EXT4_IOC_GETVERSION_OLD FS_IOC_GETVERSION | 538 | #define EXT4_IOC_GETVERSION_OLD FS_IOC_GETVERSION |
609 | #define EXT4_IOC_SETVERSION_OLD FS_IOC_SETVERSION | 539 | #define EXT4_IOC_SETVERSION_OLD FS_IOC_SETVERSION |
540 | #ifdef CONFIG_JBD2_DEBUG | ||
541 | #define EXT4_IOC_WAIT_FOR_READONLY _IOR('f', 99, long) | ||
542 | #endif | ||
610 | #define EXT4_IOC_GETRSVSZ _IOR('f', 5, long) | 543 | #define EXT4_IOC_GETRSVSZ _IOR('f', 5, long) |
611 | #define EXT4_IOC_SETRSVSZ _IOW('f', 6, long) | 544 | #define EXT4_IOC_SETRSVSZ _IOW('f', 6, long) |
612 | #define EXT4_IOC_GROUP_EXTEND _IOW('f', 7, unsigned long) | 545 | #define EXT4_IOC_GROUP_EXTEND _IOW('f', 7, unsigned long) |
@@ -616,7 +549,6 @@ enum { | |||
616 | /* note ioctl 11 reserved for filesystem-independent FIEMAP ioctl */ | 549 | /* note ioctl 11 reserved for filesystem-independent FIEMAP ioctl */ |
617 | #define EXT4_IOC_ALLOC_DA_BLKS _IO('f', 12) | 550 | #define EXT4_IOC_ALLOC_DA_BLKS _IO('f', 12) |
618 | #define EXT4_IOC_MOVE_EXT _IOWR('f', 15, struct move_extent) | 551 | #define EXT4_IOC_MOVE_EXT _IOWR('f', 15, struct move_extent) |
619 | #define EXT4_IOC_RESIZE_FS _IOW('f', 16, __u64) | ||
620 | 552 | ||
621 | #if defined(__KERNEL__) && defined(CONFIG_COMPAT) | 553 | #if defined(__KERNEL__) && defined(CONFIG_COMPAT) |
622 | /* | 554 | /* |
@@ -630,6 +562,9 @@ enum { | |||
630 | #define EXT4_IOC32_SETRSVSZ _IOW('f', 6, int) | 562 | #define EXT4_IOC32_SETRSVSZ _IOW('f', 6, int) |
631 | #define EXT4_IOC32_GROUP_EXTEND _IOW('f', 7, unsigned int) | 563 | #define EXT4_IOC32_GROUP_EXTEND _IOW('f', 7, unsigned int) |
632 | #define EXT4_IOC32_GROUP_ADD _IOW('f', 8, struct compat_ext4_new_group_input) | 564 | #define EXT4_IOC32_GROUP_ADD _IOW('f', 8, struct compat_ext4_new_group_input) |
565 | #ifdef CONFIG_JBD2_DEBUG | ||
566 | #define EXT4_IOC32_WAIT_FOR_READONLY _IOR('f', 99, int) | ||
567 | #endif | ||
633 | #define EXT4_IOC32_GETVERSION_OLD FS_IOC32_GETVERSION | 568 | #define EXT4_IOC32_GETVERSION_OLD FS_IOC32_GETVERSION |
634 | #define EXT4_IOC32_SETVERSION_OLD FS_IOC32_SETVERSION | 569 | #define EXT4_IOC32_SETVERSION_OLD FS_IOC32_SETVERSION |
635 | #endif | 570 | #endif |
@@ -674,8 +609,7 @@ struct ext4_inode { | |||
674 | __le16 l_i_file_acl_high; | 609 | __le16 l_i_file_acl_high; |
675 | __le16 l_i_uid_high; /* these 2 fields */ | 610 | __le16 l_i_uid_high; /* these 2 fields */ |
676 | __le16 l_i_gid_high; /* were reserved2[0] */ | 611 | __le16 l_i_gid_high; /* were reserved2[0] */ |
677 | __le16 l_i_checksum_lo;/* crc32c(uuid+inum+inode) LE */ | 612 | __u32 l_i_reserved2; |
678 | __le16 l_i_reserved; | ||
679 | } linux2; | 613 | } linux2; |
680 | struct { | 614 | struct { |
681 | __le16 h_i_reserved1; /* Obsoleted fragment number/size which are removed in ext4 */ | 615 | __le16 h_i_reserved1; /* Obsoleted fragment number/size which are removed in ext4 */ |
@@ -691,7 +625,7 @@ struct ext4_inode { | |||
691 | } masix2; | 625 | } masix2; |
692 | } osd2; /* OS dependent 2 */ | 626 | } osd2; /* OS dependent 2 */ |
693 | __le16 i_extra_isize; | 627 | __le16 i_extra_isize; |
694 | __le16 i_checksum_hi; /* crc32c(uuid+inum+inode) BE */ | 628 | __le16 i_pad1; |
695 | __le32 i_ctime_extra; /* extra Change time (nsec << 2 | epoch) */ | 629 | __le32 i_ctime_extra; /* extra Change time (nsec << 2 | epoch) */ |
696 | __le32 i_mtime_extra; /* extra Modification time(nsec << 2 | epoch) */ | 630 | __le32 i_mtime_extra; /* extra Modification time(nsec << 2 | epoch) */ |
697 | __le32 i_atime_extra; /* extra Access time (nsec << 2 | epoch) */ | 631 | __le32 i_atime_extra; /* extra Access time (nsec << 2 | epoch) */ |
@@ -793,7 +727,7 @@ do { \ | |||
793 | #define i_gid_low i_gid | 727 | #define i_gid_low i_gid |
794 | #define i_uid_high osd2.linux2.l_i_uid_high | 728 | #define i_uid_high osd2.linux2.l_i_uid_high |
795 | #define i_gid_high osd2.linux2.l_i_gid_high | 729 | #define i_gid_high osd2.linux2.l_i_gid_high |
796 | #define i_checksum_lo osd2.linux2.l_i_checksum_lo | 730 | #define i_reserved2 osd2.linux2.l_i_reserved2 |
797 | 731 | ||
798 | #elif defined(__GNU__) | 732 | #elif defined(__GNU__) |
799 | 733 | ||
@@ -821,8 +755,6 @@ struct ext4_ext_cache { | |||
821 | __u32 ec_len; /* must be 32bit to return holes */ | 755 | __u32 ec_len; /* must be 32bit to return holes */ |
822 | }; | 756 | }; |
823 | 757 | ||
824 | #include "extents_status.h" | ||
825 | |||
826 | /* | 758 | /* |
827 | * fourth extended file system inode data in memory | 759 | * fourth extended file system inode data in memory |
828 | */ | 760 | */ |
@@ -845,6 +777,7 @@ struct ext4_inode_info { | |||
845 | #endif | 777 | #endif |
846 | unsigned long i_flags; | 778 | unsigned long i_flags; |
847 | 779 | ||
780 | #ifdef CONFIG_EXT4_FS_XATTR | ||
848 | /* | 781 | /* |
849 | * Extended attributes can be read independently of the main file | 782 | * Extended attributes can be read independently of the main file |
850 | * data. Taking i_mutex even when reading would cause contention | 783 | * data. Taking i_mutex even when reading would cause contention |
@@ -853,6 +786,7 @@ struct ext4_inode_info { | |||
853 | * EAs. | 786 | * EAs. |
854 | */ | 787 | */ |
855 | struct rw_semaphore xattr_sem; | 788 | struct rw_semaphore xattr_sem; |
789 | #endif | ||
856 | 790 | ||
857 | struct list_head i_orphan; /* unlinked but open inodes */ | 791 | struct list_head i_orphan; /* unlinked but open inodes */ |
858 | 792 | ||
@@ -898,15 +832,10 @@ struct ext4_inode_info { | |||
898 | struct list_head i_prealloc_list; | 832 | struct list_head i_prealloc_list; |
899 | spinlock_t i_prealloc_lock; | 833 | spinlock_t i_prealloc_lock; |
900 | 834 | ||
901 | /* extents status tree */ | ||
902 | struct ext4_es_tree i_es_tree; | ||
903 | rwlock_t i_es_lock; | ||
904 | |||
905 | /* ialloc */ | 835 | /* ialloc */ |
906 | ext4_group_t i_last_alloc_group; | 836 | ext4_group_t i_last_alloc_group; |
907 | 837 | ||
908 | /* allocation reservation info for delalloc */ | 838 | /* allocation reservation info for delalloc */ |
909 | /* In case of bigalloc, these refer to clusters rather than blocks */ | ||
910 | unsigned int i_reserved_data_blocks; | 839 | unsigned int i_reserved_data_blocks; |
911 | unsigned int i_reserved_meta_blocks; | 840 | unsigned int i_reserved_meta_blocks; |
912 | unsigned int i_allocated_meta_blocks; | 841 | unsigned int i_allocated_meta_blocks; |
@@ -916,10 +845,6 @@ struct ext4_inode_info { | |||
916 | /* on-disk additional length */ | 845 | /* on-disk additional length */ |
917 | __u16 i_extra_isize; | 846 | __u16 i_extra_isize; |
918 | 847 | ||
919 | /* Indicate the inline data space. */ | ||
920 | u16 i_inline_off; | ||
921 | u16 i_inline_size; | ||
922 | |||
923 | #ifdef CONFIG_QUOTA | 848 | #ifdef CONFIG_QUOTA |
924 | /* quota space reservation, managed internally by quota code */ | 849 | /* quota space reservation, managed internally by quota code */ |
925 | qsize_t i_reserved_quota; | 850 | qsize_t i_reserved_quota; |
@@ -929,7 +854,9 @@ struct ext4_inode_info { | |||
929 | struct list_head i_completed_io_list; | 854 | struct list_head i_completed_io_list; |
930 | spinlock_t i_completed_io_lock; | 855 | spinlock_t i_completed_io_lock; |
931 | atomic_t i_ioend_count; /* Number of outstanding io_end structs */ | 856 | atomic_t i_ioend_count; /* Number of outstanding io_end structs */ |
932 | atomic_t i_unwritten; /* Nr. of inflight conversions pending */ | 857 | /* current io_end structure for async DIO write*/ |
858 | ext4_io_end_t *cur_aio_dio; | ||
859 | atomic_t i_aiodio_unwritten; /* Nr. of inflight conversions pending */ | ||
933 | 860 | ||
934 | spinlock_t i_block_reservation_lock; | 861 | spinlock_t i_block_reservation_lock; |
935 | 862 | ||
@@ -939,9 +866,6 @@ struct ext4_inode_info { | |||
939 | */ | 866 | */ |
940 | tid_t i_sync_tid; | 867 | tid_t i_sync_tid; |
941 | tid_t i_datasync_tid; | 868 | tid_t i_datasync_tid; |
942 | |||
943 | /* Precomputed uuid+inum+igen checksum for seeding inode checksums */ | ||
944 | __u32 i_csum_seed; | ||
945 | }; | 869 | }; |
946 | 870 | ||
947 | /* | 871 | /* |
@@ -961,12 +885,12 @@ struct ext4_inode_info { | |||
961 | /* | 885 | /* |
962 | * Mount flags | 886 | * Mount flags |
963 | */ | 887 | */ |
888 | #define EXT4_MOUNT_OLDALLOC 0x00002 /* Don't use the new Orlov allocator */ | ||
964 | #define EXT4_MOUNT_GRPID 0x00004 /* Create files with directory's group */ | 889 | #define EXT4_MOUNT_GRPID 0x00004 /* Create files with directory's group */ |
965 | #define EXT4_MOUNT_DEBUG 0x00008 /* Some debugging messages */ | 890 | #define EXT4_MOUNT_DEBUG 0x00008 /* Some debugging messages */ |
966 | #define EXT4_MOUNT_ERRORS_CONT 0x00010 /* Continue on errors */ | 891 | #define EXT4_MOUNT_ERRORS_CONT 0x00010 /* Continue on errors */ |
967 | #define EXT4_MOUNT_ERRORS_RO 0x00020 /* Remount fs ro on errors */ | 892 | #define EXT4_MOUNT_ERRORS_RO 0x00020 /* Remount fs ro on errors */ |
968 | #define EXT4_MOUNT_ERRORS_PANIC 0x00040 /* Panic on errors */ | 893 | #define EXT4_MOUNT_ERRORS_PANIC 0x00040 /* Panic on errors */ |
969 | #define EXT4_MOUNT_ERRORS_MASK 0x00070 | ||
970 | #define EXT4_MOUNT_MINIX_DF 0x00080 /* Mimics the Minix statfs */ | 894 | #define EXT4_MOUNT_MINIX_DF 0x00080 /* Mimics the Minix statfs */ |
971 | #define EXT4_MOUNT_NOLOAD 0x00100 /* Don't use existing journal*/ | 895 | #define EXT4_MOUNT_NOLOAD 0x00100 /* Don't use existing journal*/ |
972 | #define EXT4_MOUNT_DATA_FLAGS 0x00C00 /* Mode for data writes: */ | 896 | #define EXT4_MOUNT_DATA_FLAGS 0x00C00 /* Mode for data writes: */ |
@@ -985,6 +909,7 @@ struct ext4_inode_info { | |||
985 | #define EXT4_MOUNT_DIOREAD_NOLOCK 0x400000 /* Enable support for dio read nolocking */ | 909 | #define EXT4_MOUNT_DIOREAD_NOLOCK 0x400000 /* Enable support for dio read nolocking */ |
986 | #define EXT4_MOUNT_JOURNAL_CHECKSUM 0x800000 /* Journal checksums */ | 910 | #define EXT4_MOUNT_JOURNAL_CHECKSUM 0x800000 /* Journal checksums */ |
987 | #define EXT4_MOUNT_JOURNAL_ASYNC_COMMIT 0x1000000 /* Journal Async Commit */ | 911 | #define EXT4_MOUNT_JOURNAL_ASYNC_COMMIT 0x1000000 /* Journal Async Commit */ |
912 | #define EXT4_MOUNT_I_VERSION 0x2000000 /* i_version support */ | ||
988 | #define EXT4_MOUNT_MBLK_IO_SUBMIT 0x4000000 /* multi-block io submits */ | 913 | #define EXT4_MOUNT_MBLK_IO_SUBMIT 0x4000000 /* multi-block io submits */ |
989 | #define EXT4_MOUNT_DELALLOC 0x8000000 /* Delalloc support */ | 914 | #define EXT4_MOUNT_DELALLOC 0x8000000 /* Delalloc support */ |
990 | #define EXT4_MOUNT_DATA_ERR_ABORT 0x10000000 /* Abort on file data write */ | 915 | #define EXT4_MOUNT_DATA_ERR_ABORT 0x10000000 /* Abort on file data write */ |
@@ -992,9 +917,6 @@ struct ext4_inode_info { | |||
992 | #define EXT4_MOUNT_DISCARD 0x40000000 /* Issue DISCARD requests */ | 917 | #define EXT4_MOUNT_DISCARD 0x40000000 /* Issue DISCARD requests */ |
993 | #define EXT4_MOUNT_INIT_INODE_TABLE 0x80000000 /* Initialize uninitialized itables */ | 918 | #define EXT4_MOUNT_INIT_INODE_TABLE 0x80000000 /* Initialize uninitialized itables */ |
994 | 919 | ||
995 | #define EXT4_MOUNT2_EXPLICIT_DELALLOC 0x00000001 /* User explicitly | ||
996 | specified delalloc */ | ||
997 | |||
998 | #define clear_opt(sb, opt) EXT4_SB(sb)->s_mount_opt &= \ | 920 | #define clear_opt(sb, opt) EXT4_SB(sb)->s_mount_opt &= \ |
999 | ~EXT4_MOUNT_##opt | 921 | ~EXT4_MOUNT_##opt |
1000 | #define set_opt(sb, opt) EXT4_SB(sb)->s_mount_opt |= \ | 922 | #define set_opt(sb, opt) EXT4_SB(sb)->s_mount_opt |= \ |
@@ -1009,13 +931,12 @@ struct ext4_inode_info { | |||
1009 | #define test_opt2(sb, opt) (EXT4_SB(sb)->s_mount_opt2 & \ | 931 | #define test_opt2(sb, opt) (EXT4_SB(sb)->s_mount_opt2 & \ |
1010 | EXT4_MOUNT2_##opt) | 932 | EXT4_MOUNT2_##opt) |
1011 | 933 | ||
1012 | #define ext4_test_and_set_bit __test_and_set_bit_le | 934 | #define ext4_set_bit __test_and_set_bit_le |
1013 | #define ext4_set_bit __set_bit_le | ||
1014 | #define ext4_set_bit_atomic ext2_set_bit_atomic | 935 | #define ext4_set_bit_atomic ext2_set_bit_atomic |
1015 | #define ext4_test_and_clear_bit __test_and_clear_bit_le | 936 | #define ext4_clear_bit __test_and_clear_bit_le |
1016 | #define ext4_clear_bit __clear_bit_le | ||
1017 | #define ext4_clear_bit_atomic ext2_clear_bit_atomic | 937 | #define ext4_clear_bit_atomic ext2_clear_bit_atomic |
1018 | #define ext4_test_bit test_bit_le | 938 | #define ext4_test_bit test_bit_le |
939 | #define ext4_find_first_zero_bit find_first_zero_bit_le | ||
1019 | #define ext4_find_next_zero_bit find_next_zero_bit_le | 940 | #define ext4_find_next_zero_bit find_next_zero_bit_le |
1020 | #define ext4_find_next_bit find_next_bit_le | 941 | #define ext4_find_next_bit find_next_bit_le |
1021 | 942 | ||
@@ -1035,9 +956,6 @@ extern void ext4_set_bits(void *bm, int cur, int len); | |||
1035 | #define EXT4_ERRORS_PANIC 3 /* Panic */ | 956 | #define EXT4_ERRORS_PANIC 3 /* Panic */ |
1036 | #define EXT4_ERRORS_DEFAULT EXT4_ERRORS_CONTINUE | 957 | #define EXT4_ERRORS_DEFAULT EXT4_ERRORS_CONTINUE |
1037 | 958 | ||
1038 | /* Metadata checksum algorithm codes */ | ||
1039 | #define EXT4_CRC32C_CHKSUM 1 | ||
1040 | |||
1041 | /* | 959 | /* |
1042 | * Structure of the super block | 960 | * Structure of the super block |
1043 | */ | 961 | */ |
@@ -1049,9 +967,9 @@ struct ext4_super_block { | |||
1049 | /*10*/ __le32 s_free_inodes_count; /* Free inodes count */ | 967 | /*10*/ __le32 s_free_inodes_count; /* Free inodes count */ |
1050 | __le32 s_first_data_block; /* First Data Block */ | 968 | __le32 s_first_data_block; /* First Data Block */ |
1051 | __le32 s_log_block_size; /* Block size */ | 969 | __le32 s_log_block_size; /* Block size */ |
1052 | __le32 s_log_cluster_size; /* Allocation cluster size */ | 970 | __le32 s_obso_log_frag_size; /* Obsoleted fragment size */ |
1053 | /*20*/ __le32 s_blocks_per_group; /* # Blocks per group */ | 971 | /*20*/ __le32 s_blocks_per_group; /* # Blocks per group */ |
1054 | __le32 s_clusters_per_group; /* # Clusters per group */ | 972 | __le32 s_obso_frags_per_group; /* Obsoleted fragments per group */ |
1055 | __le32 s_inodes_per_group; /* # Inodes per group */ | 973 | __le32 s_inodes_per_group; /* # Inodes per group */ |
1056 | __le32 s_mtime; /* Mount time */ | 974 | __le32 s_mtime; /* Mount time */ |
1057 | /*30*/ __le32 s_wtime; /* Write time */ | 975 | /*30*/ __le32 s_wtime; /* Write time */ |
@@ -1124,7 +1042,7 @@ struct ext4_super_block { | |||
1124 | __le64 s_mmp_block; /* Block for multi-mount protection */ | 1042 | __le64 s_mmp_block; /* Block for multi-mount protection */ |
1125 | __le32 s_raid_stripe_width; /* blocks on all data disks (N*stride)*/ | 1043 | __le32 s_raid_stripe_width; /* blocks on all data disks (N*stride)*/ |
1126 | __u8 s_log_groups_per_flex; /* FLEX_BG group size */ | 1044 | __u8 s_log_groups_per_flex; /* FLEX_BG group size */ |
1127 | __u8 s_checksum_type; /* metadata checksum algorithm used */ | 1045 | __u8 s_reserved_char_pad; |
1128 | __le16 s_reserved_pad; | 1046 | __le16 s_reserved_pad; |
1129 | __le64 s_kbytes_written; /* nr of lifetime kilobytes written */ | 1047 | __le64 s_kbytes_written; /* nr of lifetime kilobytes written */ |
1130 | __le32 s_snapshot_inum; /* Inode number of active snapshot */ | 1048 | __le32 s_snapshot_inum; /* Inode number of active snapshot */ |
@@ -1147,11 +1065,7 @@ struct ext4_super_block { | |||
1147 | __u8 s_last_error_func[32]; /* function where the error happened */ | 1065 | __u8 s_last_error_func[32]; /* function where the error happened */ |
1148 | #define EXT4_S_ERR_END offsetof(struct ext4_super_block, s_mount_opts) | 1066 | #define EXT4_S_ERR_END offsetof(struct ext4_super_block, s_mount_opts) |
1149 | __u8 s_mount_opts[64]; | 1067 | __u8 s_mount_opts[64]; |
1150 | __le32 s_usr_quota_inum; /* inode for tracking user quota */ | 1068 | __le32 s_reserved[112]; /* Padding to the end of the block */ |
1151 | __le32 s_grp_quota_inum; /* inode for tracking group quota */ | ||
1152 | __le32 s_overhead_clusters; /* overhead blocks/clusters in fs */ | ||
1153 | __le32 s_reserved[108]; /* Padding to the end of the block */ | ||
1154 | __le32 s_checksum; /* crc32c(superblock) */ | ||
1155 | }; | 1069 | }; |
1156 | 1070 | ||
1157 | #define EXT4_S_ERR_LEN (EXT4_S_ERR_END - EXT4_S_ERR_START) | 1071 | #define EXT4_S_ERR_LEN (EXT4_S_ERR_END - EXT4_S_ERR_START) |
@@ -1171,16 +1085,14 @@ struct ext4_sb_info { | |||
1171 | unsigned long s_desc_size; /* Size of a group descriptor in bytes */ | 1085 | unsigned long s_desc_size; /* Size of a group descriptor in bytes */ |
1172 | unsigned long s_inodes_per_block;/* Number of inodes per block */ | 1086 | unsigned long s_inodes_per_block;/* Number of inodes per block */ |
1173 | unsigned long s_blocks_per_group;/* Number of blocks in a group */ | 1087 | unsigned long s_blocks_per_group;/* Number of blocks in a group */ |
1174 | unsigned long s_clusters_per_group; /* Number of clusters in a group */ | ||
1175 | unsigned long s_inodes_per_group;/* Number of inodes in a group */ | 1088 | unsigned long s_inodes_per_group;/* Number of inodes in a group */ |
1176 | unsigned long s_itb_per_group; /* Number of inode table blocks per group */ | 1089 | unsigned long s_itb_per_group; /* Number of inode table blocks per group */ |
1177 | unsigned long s_gdb_count; /* Number of group descriptor blocks */ | 1090 | unsigned long s_gdb_count; /* Number of group descriptor blocks */ |
1178 | unsigned long s_desc_per_block; /* Number of group descriptors per block */ | 1091 | unsigned long s_desc_per_block; /* Number of group descriptors per block */ |
1179 | ext4_group_t s_groups_count; /* Number of groups in the fs */ | 1092 | ext4_group_t s_groups_count; /* Number of groups in the fs */ |
1180 | ext4_group_t s_blockfile_groups;/* Groups acceptable for non-extent files */ | 1093 | ext4_group_t s_blockfile_groups;/* Groups acceptable for non-extent files */ |
1181 | unsigned long s_overhead; /* # of fs overhead clusters */ | 1094 | unsigned long s_overhead_last; /* Last calculated overhead */ |
1182 | unsigned int s_cluster_ratio; /* Number of blocks per cluster */ | 1095 | unsigned long s_blocks_last; /* Last seen block count */ |
1183 | unsigned int s_cluster_bits; /* log2 of s_cluster_ratio */ | ||
1184 | loff_t s_bitmap_maxbytes; /* max bytes for bitmap files */ | 1096 | loff_t s_bitmap_maxbytes; /* max bytes for bitmap files */ |
1185 | struct buffer_head * s_sbh; /* Buffer containing the super block */ | 1097 | struct buffer_head * s_sbh; /* Buffer containing the super block */ |
1186 | struct ext4_super_block *s_es; /* Pointer to the super block in the buffer */ | 1098 | struct ext4_super_block *s_es; /* Pointer to the super block in the buffer */ |
@@ -1188,10 +1100,9 @@ struct ext4_sb_info { | |||
1188 | unsigned int s_mount_opt; | 1100 | unsigned int s_mount_opt; |
1189 | unsigned int s_mount_opt2; | 1101 | unsigned int s_mount_opt2; |
1190 | unsigned int s_mount_flags; | 1102 | unsigned int s_mount_flags; |
1191 | unsigned int s_def_mount_opt; | ||
1192 | ext4_fsblk_t s_sb_block; | 1103 | ext4_fsblk_t s_sb_block; |
1193 | kuid_t s_resuid; | 1104 | uid_t s_resuid; |
1194 | kgid_t s_resgid; | 1105 | gid_t s_resgid; |
1195 | unsigned short s_mount_state; | 1106 | unsigned short s_mount_state; |
1196 | unsigned short s_pad; | 1107 | unsigned short s_pad; |
1197 | int s_addr_per_block_bits; | 1108 | int s_addr_per_block_bits; |
@@ -1205,15 +1116,14 @@ struct ext4_sb_info { | |||
1205 | u32 s_hash_seed[4]; | 1116 | u32 s_hash_seed[4]; |
1206 | int s_def_hash_version; | 1117 | int s_def_hash_version; |
1207 | int s_hash_unsigned; /* 3 if hash should be signed, 0 if not */ | 1118 | int s_hash_unsigned; /* 3 if hash should be signed, 0 if not */ |
1208 | struct percpu_counter s_freeclusters_counter; | 1119 | struct percpu_counter s_freeblocks_counter; |
1209 | struct percpu_counter s_freeinodes_counter; | 1120 | struct percpu_counter s_freeinodes_counter; |
1210 | struct percpu_counter s_dirs_counter; | 1121 | struct percpu_counter s_dirs_counter; |
1211 | struct percpu_counter s_dirtyclusters_counter; | 1122 | struct percpu_counter s_dirtyblocks_counter; |
1212 | struct blockgroup_lock *s_blockgroup_lock; | 1123 | struct blockgroup_lock *s_blockgroup_lock; |
1213 | struct proc_dir_entry *s_proc; | 1124 | struct proc_dir_entry *s_proc; |
1214 | struct kobject s_kobj; | 1125 | struct kobject s_kobj; |
1215 | struct completion s_kobj_unregister; | 1126 | struct completion s_kobj_unregister; |
1216 | struct super_block *s_sb; | ||
1217 | 1127 | ||
1218 | /* Journaling */ | 1128 | /* Journaling */ |
1219 | struct journal_s *s_journal; | 1129 | struct journal_s *s_journal; |
@@ -1225,6 +1135,10 @@ struct ext4_sb_info { | |||
1225 | u32 s_max_batch_time; | 1135 | u32 s_max_batch_time; |
1226 | u32 s_min_batch_time; | 1136 | u32 s_min_batch_time; |
1227 | struct block_device *journal_bdev; | 1137 | struct block_device *journal_bdev; |
1138 | #ifdef CONFIG_JBD2_DEBUG | ||
1139 | struct timer_list turn_ro_timer; /* For turning read-only (crash simulation) */ | ||
1140 | wait_queue_head_t ro_wait_queue; /* For people waiting for the fs to go read-only */ | ||
1141 | #endif | ||
1228 | #ifdef CONFIG_QUOTA | 1142 | #ifdef CONFIG_QUOTA |
1229 | char *s_qf_names[MAXQUOTAS]; /* Names of quota files with journalled quota */ | 1143 | char *s_qf_names[MAXQUOTAS]; /* Names of quota files with journalled quota */ |
1230 | int s_jquota_fmt; /* Format of quota to use */ | 1144 | int s_jquota_fmt; /* Format of quota to use */ |
@@ -1241,6 +1155,9 @@ struct ext4_sb_info { | |||
1241 | unsigned long s_ext_blocks; | 1155 | unsigned long s_ext_blocks; |
1242 | unsigned long s_ext_extents; | 1156 | unsigned long s_ext_extents; |
1243 | #endif | 1157 | #endif |
1158 | /* ext4 extent cache stats */ | ||
1159 | unsigned long extent_cache_hits; | ||
1160 | unsigned long extent_cache_misses; | ||
1244 | 1161 | ||
1245 | /* for buddy allocator */ | 1162 | /* for buddy allocator */ |
1246 | struct ext4_group_info ***s_group_info; | 1163 | struct ext4_group_info ***s_group_info; |
@@ -1248,7 +1165,6 @@ struct ext4_sb_info { | |||
1248 | spinlock_t s_md_lock; | 1165 | spinlock_t s_md_lock; |
1249 | unsigned short *s_mb_offsets; | 1166 | unsigned short *s_mb_offsets; |
1250 | unsigned int *s_mb_maxs; | 1167 | unsigned int *s_mb_maxs; |
1251 | unsigned int s_group_info_size; | ||
1252 | 1168 | ||
1253 | /* tunables */ | 1169 | /* tunables */ |
1254 | unsigned long s_stripe; | 1170 | unsigned long s_stripe; |
@@ -1259,7 +1175,6 @@ struct ext4_sb_info { | |||
1259 | unsigned int s_mb_order2_reqs; | 1175 | unsigned int s_mb_order2_reqs; |
1260 | unsigned int s_mb_group_prealloc; | 1176 | unsigned int s_mb_group_prealloc; |
1261 | unsigned int s_max_writeback_mb_bump; | 1177 | unsigned int s_max_writeback_mb_bump; |
1262 | unsigned int s_max_dir_size_kb; | ||
1263 | /* where last allocation was done - for stream allocation */ | 1178 | /* where last allocation was done - for stream allocation */ |
1264 | unsigned long s_mb_last_group; | 1179 | unsigned long s_mb_last_group; |
1265 | unsigned long s_mb_last_start; | 1180 | unsigned long s_mb_last_start; |
@@ -1287,12 +1202,8 @@ struct ext4_sb_info { | |||
1287 | unsigned long s_sectors_written_start; | 1202 | unsigned long s_sectors_written_start; |
1288 | u64 s_kbytes_written; | 1203 | u64 s_kbytes_written; |
1289 | 1204 | ||
1290 | /* the size of zero-out chunk */ | ||
1291 | unsigned int s_extent_max_zeroout_kb; | ||
1292 | |||
1293 | unsigned int s_log_groups_per_flex; | 1205 | unsigned int s_log_groups_per_flex; |
1294 | struct flex_groups *s_flex_groups; | 1206 | struct flex_groups *s_flex_groups; |
1295 | ext4_group_t s_flex_groups_allocated; | ||
1296 | 1207 | ||
1297 | /* workqueue for dio unwritten */ | 1208 | /* workqueue for dio unwritten */ |
1298 | struct workqueue_struct *dio_unwritten_wq; | 1209 | struct workqueue_struct *dio_unwritten_wq; |
@@ -1310,12 +1221,6 @@ struct ext4_sb_info { | |||
1310 | 1221 | ||
1311 | /* record the last minlen when FITRIM is called. */ | 1222 | /* record the last minlen when FITRIM is called. */ |
1312 | atomic_t s_last_trim_minblks; | 1223 | atomic_t s_last_trim_minblks; |
1313 | |||
1314 | /* Reference to checksum algorithm driver via cryptoapi */ | ||
1315 | struct crypto_shash *s_chksum_driver; | ||
1316 | |||
1317 | /* Precomputed FS UUID checksum for seeding other checksums */ | ||
1318 | __u32 s_csum_seed; | ||
1319 | }; | 1224 | }; |
1320 | 1225 | ||
1321 | static inline struct ext4_sb_info *EXT4_SB(struct super_block *sb) | 1226 | static inline struct ext4_sb_info *EXT4_SB(struct super_block *sb) |
@@ -1336,33 +1241,12 @@ static inline struct timespec ext4_current_time(struct inode *inode) | |||
1336 | static inline int ext4_valid_inum(struct super_block *sb, unsigned long ino) | 1241 | static inline int ext4_valid_inum(struct super_block *sb, unsigned long ino) |
1337 | { | 1242 | { |
1338 | return ino == EXT4_ROOT_INO || | 1243 | return ino == EXT4_ROOT_INO || |
1339 | ino == EXT4_USR_QUOTA_INO || | ||
1340 | ino == EXT4_GRP_QUOTA_INO || | ||
1341 | ino == EXT4_JOURNAL_INO || | 1244 | ino == EXT4_JOURNAL_INO || |
1342 | ino == EXT4_RESIZE_INO || | 1245 | ino == EXT4_RESIZE_INO || |
1343 | (ino >= EXT4_FIRST_INO(sb) && | 1246 | (ino >= EXT4_FIRST_INO(sb) && |
1344 | ino <= le32_to_cpu(EXT4_SB(sb)->s_es->s_inodes_count)); | 1247 | ino <= le32_to_cpu(EXT4_SB(sb)->s_es->s_inodes_count)); |
1345 | } | 1248 | } |
1346 | 1249 | ||
1347 | static inline void ext4_set_io_unwritten_flag(struct inode *inode, | ||
1348 | struct ext4_io_end *io_end) | ||
1349 | { | ||
1350 | if (!(io_end->flag & EXT4_IO_END_UNWRITTEN)) { | ||
1351 | io_end->flag |= EXT4_IO_END_UNWRITTEN; | ||
1352 | atomic_inc(&EXT4_I(inode)->i_unwritten); | ||
1353 | } | ||
1354 | } | ||
1355 | |||
1356 | static inline ext4_io_end_t *ext4_inode_aio(struct inode *inode) | ||
1357 | { | ||
1358 | return inode->i_private; | ||
1359 | } | ||
1360 | |||
1361 | static inline void ext4_inode_aio_set(struct inode *inode, ext4_io_end_t *io) | ||
1362 | { | ||
1363 | inode->i_private = io; | ||
1364 | } | ||
1365 | |||
1366 | /* | 1250 | /* |
1367 | * Inode dynamic state flags | 1251 | * Inode dynamic state flags |
1368 | */ | 1252 | */ |
@@ -1376,9 +1260,6 @@ enum { | |||
1376 | EXT4_STATE_DIO_UNWRITTEN, /* need convert on dio done*/ | 1260 | EXT4_STATE_DIO_UNWRITTEN, /* need convert on dio done*/ |
1377 | EXT4_STATE_NEWENTRY, /* File just added to dir */ | 1261 | EXT4_STATE_NEWENTRY, /* File just added to dir */ |
1378 | EXT4_STATE_DELALLOC_RESERVED, /* blks already reserved for delalloc */ | 1262 | EXT4_STATE_DELALLOC_RESERVED, /* blks already reserved for delalloc */ |
1379 | EXT4_STATE_DIOREAD_LOCK, /* Disable support for dio read | ||
1380 | nolocking */ | ||
1381 | EXT4_STATE_MAY_INLINE_DATA, /* may have in-inode data */ | ||
1382 | }; | 1263 | }; |
1383 | 1264 | ||
1384 | #define EXT4_INODE_BIT_FNS(name, field, offset) \ | 1265 | #define EXT4_INODE_BIT_FNS(name, field, offset) \ |
@@ -1478,14 +1359,6 @@ static inline void ext4_clear_state_flags(struct ext4_inode_info *ei) | |||
1478 | #define EXT4_FEATURE_RO_COMPAT_DIR_NLINK 0x0020 | 1359 | #define EXT4_FEATURE_RO_COMPAT_DIR_NLINK 0x0020 |
1479 | #define EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE 0x0040 | 1360 | #define EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE 0x0040 |
1480 | #define EXT4_FEATURE_RO_COMPAT_QUOTA 0x0100 | 1361 | #define EXT4_FEATURE_RO_COMPAT_QUOTA 0x0100 |
1481 | #define EXT4_FEATURE_RO_COMPAT_BIGALLOC 0x0200 | ||
1482 | /* | ||
1483 | * METADATA_CSUM also enables group descriptor checksums (GDT_CSUM). When | ||
1484 | * METADATA_CSUM is set, group descriptor checksums use the same algorithm as | ||
1485 | * all other data structures' checksums. However, the METADATA_CSUM and | ||
1486 | * GDT_CSUM bits are mutually exclusive. | ||
1487 | */ | ||
1488 | #define EXT4_FEATURE_RO_COMPAT_METADATA_CSUM 0x0400 | ||
1489 | 1362 | ||
1490 | #define EXT4_FEATURE_INCOMPAT_COMPRESSION 0x0001 | 1363 | #define EXT4_FEATURE_INCOMPAT_COMPRESSION 0x0001 |
1491 | #define EXT4_FEATURE_INCOMPAT_FILETYPE 0x0002 | 1364 | #define EXT4_FEATURE_INCOMPAT_FILETYPE 0x0002 |
@@ -1498,9 +1371,6 @@ static inline void ext4_clear_state_flags(struct ext4_inode_info *ei) | |||
1498 | #define EXT4_FEATURE_INCOMPAT_FLEX_BG 0x0200 | 1371 | #define EXT4_FEATURE_INCOMPAT_FLEX_BG 0x0200 |
1499 | #define EXT4_FEATURE_INCOMPAT_EA_INODE 0x0400 /* EA in inode */ | 1372 | #define EXT4_FEATURE_INCOMPAT_EA_INODE 0x0400 /* EA in inode */ |
1500 | #define EXT4_FEATURE_INCOMPAT_DIRDATA 0x1000 /* data in dirent */ | 1373 | #define EXT4_FEATURE_INCOMPAT_DIRDATA 0x1000 /* data in dirent */ |
1501 | #define EXT4_FEATURE_INCOMPAT_BG_USE_META_CSUM 0x2000 /* use crc32c for bg */ | ||
1502 | #define EXT4_FEATURE_INCOMPAT_LARGEDIR 0x4000 /* >2GB or 3-lvl htree */ | ||
1503 | #define EXT4_FEATURE_INCOMPAT_INLINE_DATA 0x8000 /* data in inode */ | ||
1504 | 1374 | ||
1505 | #define EXT2_FEATURE_COMPAT_SUPP EXT4_FEATURE_COMPAT_EXT_ATTR | 1375 | #define EXT2_FEATURE_COMPAT_SUPP EXT4_FEATURE_COMPAT_EXT_ATTR |
1506 | #define EXT2_FEATURE_INCOMPAT_SUPP (EXT4_FEATURE_INCOMPAT_FILETYPE| \ | 1376 | #define EXT2_FEATURE_INCOMPAT_SUPP (EXT4_FEATURE_INCOMPAT_FILETYPE| \ |
@@ -1524,18 +1394,14 @@ static inline void ext4_clear_state_flags(struct ext4_inode_info *ei) | |||
1524 | EXT4_FEATURE_INCOMPAT_EXTENTS| \ | 1394 | EXT4_FEATURE_INCOMPAT_EXTENTS| \ |
1525 | EXT4_FEATURE_INCOMPAT_64BIT| \ | 1395 | EXT4_FEATURE_INCOMPAT_64BIT| \ |
1526 | EXT4_FEATURE_INCOMPAT_FLEX_BG| \ | 1396 | EXT4_FEATURE_INCOMPAT_FLEX_BG| \ |
1527 | EXT4_FEATURE_INCOMPAT_MMP | \ | 1397 | EXT4_FEATURE_INCOMPAT_MMP) |
1528 | EXT4_FEATURE_INCOMPAT_INLINE_DATA) | ||
1529 | #define EXT4_FEATURE_RO_COMPAT_SUPP (EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER| \ | 1398 | #define EXT4_FEATURE_RO_COMPAT_SUPP (EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER| \ |
1530 | EXT4_FEATURE_RO_COMPAT_LARGE_FILE| \ | 1399 | EXT4_FEATURE_RO_COMPAT_LARGE_FILE| \ |
1531 | EXT4_FEATURE_RO_COMPAT_GDT_CSUM| \ | 1400 | EXT4_FEATURE_RO_COMPAT_GDT_CSUM| \ |
1532 | EXT4_FEATURE_RO_COMPAT_DIR_NLINK | \ | 1401 | EXT4_FEATURE_RO_COMPAT_DIR_NLINK | \ |
1533 | EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE | \ | 1402 | EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE | \ |
1534 | EXT4_FEATURE_RO_COMPAT_BTREE_DIR |\ | 1403 | EXT4_FEATURE_RO_COMPAT_BTREE_DIR |\ |
1535 | EXT4_FEATURE_RO_COMPAT_HUGE_FILE |\ | 1404 | EXT4_FEATURE_RO_COMPAT_HUGE_FILE) |
1536 | EXT4_FEATURE_RO_COMPAT_BIGALLOC |\ | ||
1537 | EXT4_FEATURE_RO_COMPAT_METADATA_CSUM|\ | ||
1538 | EXT4_FEATURE_RO_COMPAT_QUOTA) | ||
1539 | 1405 | ||
1540 | /* | 1406 | /* |
1541 | * Default values for user and/or group using reserved blocks | 1407 | * Default values for user and/or group using reserved blocks |
@@ -1601,23 +1467,6 @@ struct ext4_dir_entry_2 { | |||
1601 | }; | 1467 | }; |
1602 | 1468 | ||
1603 | /* | 1469 | /* |
1604 | * This is a bogus directory entry at the end of each leaf block that | ||
1605 | * records checksums. | ||
1606 | */ | ||
1607 | struct ext4_dir_entry_tail { | ||
1608 | __le32 det_reserved_zero1; /* Pretend to be unused */ | ||
1609 | __le16 det_rec_len; /* 12 */ | ||
1610 | __u8 det_reserved_zero2; /* Zero name length */ | ||
1611 | __u8 det_reserved_ft; /* 0xDE, fake file type */ | ||
1612 | __le32 det_checksum; /* crc32c(uuid+inum+dirblock) */ | ||
1613 | }; | ||
1614 | |||
1615 | #define EXT4_DIRENT_TAIL(block, blocksize) \ | ||
1616 | ((struct ext4_dir_entry_tail *)(((void *)(block)) + \ | ||
1617 | ((blocksize) - \ | ||
1618 | sizeof(struct ext4_dir_entry_tail)))) | ||
1619 | |||
1620 | /* | ||
1621 | * Ext4 directory file types. Only the low 3 bits are used. The | 1470 | * Ext4 directory file types. Only the low 3 bits are used. The |
1622 | * other bits are reserved for now. | 1471 | * other bits are reserved for now. |
1623 | */ | 1472 | */ |
@@ -1632,8 +1481,6 @@ struct ext4_dir_entry_tail { | |||
1632 | 1481 | ||
1633 | #define EXT4_FT_MAX 8 | 1482 | #define EXT4_FT_MAX 8 |
1634 | 1483 | ||
1635 | #define EXT4_FT_DIR_CSUM 0xDE | ||
1636 | |||
1637 | /* | 1484 | /* |
1638 | * EXT4_DIR_PAD defines the directory entries boundaries | 1485 | * EXT4_DIR_PAD defines the directory entries boundaries |
1639 | * | 1486 | * |
@@ -1702,27 +1549,6 @@ static inline __le16 ext4_rec_len_to_disk(unsigned len, unsigned blocksize) | |||
1702 | #define DX_HASH_HALF_MD4_UNSIGNED 4 | 1549 | #define DX_HASH_HALF_MD4_UNSIGNED 4 |
1703 | #define DX_HASH_TEA_UNSIGNED 5 | 1550 | #define DX_HASH_TEA_UNSIGNED 5 |
1704 | 1551 | ||
1705 | static inline u32 ext4_chksum(struct ext4_sb_info *sbi, u32 crc, | ||
1706 | const void *address, unsigned int length) | ||
1707 | { | ||
1708 | struct { | ||
1709 | struct shash_desc shash; | ||
1710 | char ctx[4]; | ||
1711 | } desc; | ||
1712 | int err; | ||
1713 | |||
1714 | BUG_ON(crypto_shash_descsize(sbi->s_chksum_driver)!=sizeof(desc.ctx)); | ||
1715 | |||
1716 | desc.shash.tfm = sbi->s_chksum_driver; | ||
1717 | desc.shash.flags = 0; | ||
1718 | *(u32 *)desc.ctx = crc; | ||
1719 | |||
1720 | err = crypto_shash_update(&desc.shash, address, length); | ||
1721 | BUG_ON(err); | ||
1722 | |||
1723 | return *(u32 *)desc.ctx; | ||
1724 | } | ||
1725 | |||
1726 | #ifdef __KERNEL__ | 1552 | #ifdef __KERNEL__ |
1727 | 1553 | ||
1728 | /* hash info structure used by the directory hash */ | 1554 | /* hash info structure used by the directory hash */ |
@@ -1734,11 +1560,7 @@ struct dx_hash_info | |||
1734 | u32 *seed; | 1560 | u32 *seed; |
1735 | }; | 1561 | }; |
1736 | 1562 | ||
1737 | 1563 | #define EXT4_HTREE_EOF 0x7fffffff | |
1738 | /* 32 and 64 bit signed EOF for dx directories */ | ||
1739 | #define EXT4_HTREE_EOF_32BIT ((1UL << (32 - 1)) - 1) | ||
1740 | #define EXT4_HTREE_EOF_64BIT ((1ULL << (64 - 1)) - 1) | ||
1741 | |||
1742 | 1564 | ||
1743 | /* | 1565 | /* |
1744 | * Control parameters used by ext4_htree_next_block | 1566 | * Control parameters used by ext4_htree_next_block |
@@ -1855,8 +1677,7 @@ struct mmp_struct { | |||
1855 | __le16 mmp_check_interval; | 1677 | __le16 mmp_check_interval; |
1856 | 1678 | ||
1857 | __le16 mmp_pad1; | 1679 | __le16 mmp_pad1; |
1858 | __le32 mmp_pad2[226]; | 1680 | __le32 mmp_pad2[227]; |
1859 | __le32 mmp_checksum; /* crc32c(uuid+mmp_block) */ | ||
1860 | }; | 1681 | }; |
1861 | 1682 | ||
1862 | /* arguments passed to the mmp thread */ | 1683 | /* arguments passed to the mmp thread */ |
@@ -1898,25 +1719,9 @@ struct mmpd_data { | |||
1898 | # define NORET_AND noreturn, | 1719 | # define NORET_AND noreturn, |
1899 | 1720 | ||
1900 | /* bitmap.c */ | 1721 | /* bitmap.c */ |
1901 | extern unsigned int ext4_count_free(char *bitmap, unsigned numchars); | 1722 | extern unsigned int ext4_count_free(struct buffer_head *, unsigned); |
1902 | void ext4_inode_bitmap_csum_set(struct super_block *sb, ext4_group_t group, | ||
1903 | struct ext4_group_desc *gdp, | ||
1904 | struct buffer_head *bh, int sz); | ||
1905 | int ext4_inode_bitmap_csum_verify(struct super_block *sb, ext4_group_t group, | ||
1906 | struct ext4_group_desc *gdp, | ||
1907 | struct buffer_head *bh, int sz); | ||
1908 | void ext4_block_bitmap_csum_set(struct super_block *sb, ext4_group_t group, | ||
1909 | struct ext4_group_desc *gdp, | ||
1910 | struct buffer_head *bh); | ||
1911 | int ext4_block_bitmap_csum_verify(struct super_block *sb, ext4_group_t group, | ||
1912 | struct ext4_group_desc *gdp, | ||
1913 | struct buffer_head *bh); | ||
1914 | 1723 | ||
1915 | /* balloc.c */ | 1724 | /* balloc.c */ |
1916 | extern void ext4_validate_block_bitmap(struct super_block *sb, | ||
1917 | struct ext4_group_desc *desc, | ||
1918 | unsigned int block_group, | ||
1919 | struct buffer_head *bh); | ||
1920 | extern unsigned int ext4_block_group(struct super_block *sb, | 1725 | extern unsigned int ext4_block_group(struct super_block *sb, |
1921 | ext4_fsblk_t blocknr); | 1726 | ext4_fsblk_t blocknr); |
1922 | extern ext4_grpblk_t ext4_block_group_offset(struct super_block *sb, | 1727 | extern ext4_grpblk_t ext4_block_group_offset(struct super_block *sb, |
@@ -1929,87 +1734,48 @@ extern ext4_fsblk_t ext4_new_meta_blocks(handle_t *handle, struct inode *inode, | |||
1929 | unsigned int flags, | 1734 | unsigned int flags, |
1930 | unsigned long *count, | 1735 | unsigned long *count, |
1931 | int *errp); | 1736 | int *errp); |
1932 | extern int ext4_claim_free_clusters(struct ext4_sb_info *sbi, | 1737 | extern int ext4_claim_free_blocks(struct ext4_sb_info *sbi, |
1933 | s64 nclusters, unsigned int flags); | 1738 | s64 nblocks, unsigned int flags); |
1934 | extern ext4_fsblk_t ext4_count_free_clusters(struct super_block *); | 1739 | extern ext4_fsblk_t ext4_count_free_blocks(struct super_block *); |
1935 | extern void ext4_check_blocks_bitmap(struct super_block *); | 1740 | extern void ext4_check_blocks_bitmap(struct super_block *); |
1936 | extern struct ext4_group_desc * ext4_get_group_desc(struct super_block * sb, | 1741 | extern struct ext4_group_desc * ext4_get_group_desc(struct super_block * sb, |
1937 | ext4_group_t block_group, | 1742 | ext4_group_t block_group, |
1938 | struct buffer_head ** bh); | 1743 | struct buffer_head ** bh); |
1939 | extern int ext4_should_retry_alloc(struct super_block *sb, int *retries); | 1744 | extern int ext4_should_retry_alloc(struct super_block *sb, int *retries); |
1940 | 1745 | struct buffer_head *ext4_read_block_bitmap(struct super_block *sb, | |
1941 | extern struct buffer_head *ext4_read_block_bitmap_nowait(struct super_block *sb, | 1746 | ext4_group_t block_group); |
1942 | ext4_group_t block_group); | 1747 | extern unsigned ext4_init_block_bitmap(struct super_block *sb, |
1943 | extern int ext4_wait_block_bitmap(struct super_block *sb, | 1748 | struct buffer_head *bh, |
1944 | ext4_group_t block_group, | 1749 | ext4_group_t group, |
1945 | struct buffer_head *bh); | 1750 | struct ext4_group_desc *desc); |
1946 | extern struct buffer_head *ext4_read_block_bitmap(struct super_block *sb, | 1751 | #define ext4_free_blocks_after_init(sb, group, desc) \ |
1947 | ext4_group_t block_group); | 1752 | ext4_init_block_bitmap(sb, NULL, group, desc) |
1948 | extern void ext4_init_block_bitmap(struct super_block *sb, | ||
1949 | struct buffer_head *bh, | ||
1950 | ext4_group_t group, | ||
1951 | struct ext4_group_desc *desc); | ||
1952 | extern unsigned ext4_free_clusters_after_init(struct super_block *sb, | ||
1953 | ext4_group_t block_group, | ||
1954 | struct ext4_group_desc *gdp); | ||
1955 | extern unsigned ext4_num_overhead_clusters(struct super_block *sb, | ||
1956 | ext4_group_t block_group, | ||
1957 | struct ext4_group_desc *gdp); | ||
1958 | ext4_fsblk_t ext4_inode_to_goal_block(struct inode *); | 1753 | ext4_fsblk_t ext4_inode_to_goal_block(struct inode *); |
1959 | 1754 | ||
1960 | /* dir.c */ | 1755 | /* dir.c */ |
1961 | extern int __ext4_check_dir_entry(const char *, unsigned int, struct inode *, | 1756 | extern int __ext4_check_dir_entry(const char *, unsigned int, struct inode *, |
1962 | struct file *, | 1757 | struct file *, |
1963 | struct ext4_dir_entry_2 *, | 1758 | struct ext4_dir_entry_2 *, |
1964 | struct buffer_head *, char *, int, | 1759 | struct buffer_head *, unsigned int); |
1965 | unsigned int); | 1760 | #define ext4_check_dir_entry(dir, filp, de, bh, offset) \ |
1966 | #define ext4_check_dir_entry(dir, filp, de, bh, buf, size, offset) \ | ||
1967 | unlikely(__ext4_check_dir_entry(__func__, __LINE__, (dir), (filp), \ | 1761 | unlikely(__ext4_check_dir_entry(__func__, __LINE__, (dir), (filp), \ |
1968 | (de), (bh), (buf), (size), (offset))) | 1762 | (de), (bh), (offset))) |
1969 | extern int ext4_htree_store_dirent(struct file *dir_file, __u32 hash, | 1763 | extern int ext4_htree_store_dirent(struct file *dir_file, __u32 hash, |
1970 | __u32 minor_hash, | 1764 | __u32 minor_hash, |
1971 | struct ext4_dir_entry_2 *dirent); | 1765 | struct ext4_dir_entry_2 *dirent); |
1972 | extern void ext4_htree_free_dir_info(struct dir_private_info *p); | 1766 | extern void ext4_htree_free_dir_info(struct dir_private_info *p); |
1973 | extern int ext4_find_dest_de(struct inode *dir, struct inode *inode, | ||
1974 | struct buffer_head *bh, | ||
1975 | void *buf, int buf_size, | ||
1976 | const char *name, int namelen, | ||
1977 | struct ext4_dir_entry_2 **dest_de); | ||
1978 | void ext4_insert_dentry(struct inode *inode, | ||
1979 | struct ext4_dir_entry_2 *de, | ||
1980 | int buf_size, | ||
1981 | const char *name, int namelen); | ||
1982 | static inline void ext4_update_dx_flag(struct inode *inode) | ||
1983 | { | ||
1984 | if (!EXT4_HAS_COMPAT_FEATURE(inode->i_sb, | ||
1985 | EXT4_FEATURE_COMPAT_DIR_INDEX)) | ||
1986 | ext4_clear_inode_flag(inode, EXT4_INODE_INDEX); | ||
1987 | } | ||
1988 | static unsigned char ext4_filetype_table[] = { | ||
1989 | DT_UNKNOWN, DT_REG, DT_DIR, DT_CHR, DT_BLK, DT_FIFO, DT_SOCK, DT_LNK | ||
1990 | }; | ||
1991 | |||
1992 | static inline unsigned char get_dtype(struct super_block *sb, int filetype) | ||
1993 | { | ||
1994 | if (!EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_FILETYPE) || | ||
1995 | (filetype >= EXT4_FT_MAX)) | ||
1996 | return DT_UNKNOWN; | ||
1997 | |||
1998 | return ext4_filetype_table[filetype]; | ||
1999 | } | ||
2000 | 1767 | ||
2001 | /* fsync.c */ | 1768 | /* fsync.c */ |
2002 | extern int ext4_sync_file(struct file *, loff_t, loff_t, int); | 1769 | extern int ext4_sync_file(struct file *, loff_t, loff_t, int); |
2003 | extern int ext4_flush_unwritten_io(struct inode *); | 1770 | extern int ext4_flush_completed_IO(struct inode *); |
2004 | 1771 | ||
2005 | /* hash.c */ | 1772 | /* hash.c */ |
2006 | extern int ext4fs_dirhash(const char *name, int len, struct | 1773 | extern int ext4fs_dirhash(const char *name, int len, struct |
2007 | dx_hash_info *hinfo); | 1774 | dx_hash_info *hinfo); |
2008 | 1775 | ||
2009 | /* ialloc.c */ | 1776 | /* ialloc.c */ |
2010 | extern struct inode *ext4_new_inode(handle_t *, struct inode *, umode_t, | 1777 | extern struct inode *ext4_new_inode(handle_t *, struct inode *, int, |
2011 | const struct qstr *qstr, __u32 goal, | 1778 | const struct qstr *qstr, __u32 goal); |
2012 | uid_t *owner); | ||
2013 | extern void ext4_free_inode(handle_t *, struct inode *); | 1779 | extern void ext4_free_inode(handle_t *, struct inode *); |
2014 | extern struct inode * ext4_orphan_get(struct super_block *, unsigned long); | 1780 | extern struct inode * ext4_orphan_get(struct super_block *, unsigned long); |
2015 | extern unsigned long ext4_count_free_inodes(struct super_block *); | 1781 | extern unsigned long ext4_count_free_inodes(struct super_block *); |
@@ -2018,12 +1784,11 @@ extern void ext4_check_inodes_bitmap(struct super_block *); | |||
2018 | extern void ext4_mark_bitmap_end(int start_bit, int end_bit, char *bitmap); | 1784 | extern void ext4_mark_bitmap_end(int start_bit, int end_bit, char *bitmap); |
2019 | extern int ext4_init_inode_table(struct super_block *sb, | 1785 | extern int ext4_init_inode_table(struct super_block *sb, |
2020 | ext4_group_t group, int barrier); | 1786 | ext4_group_t group, int barrier); |
2021 | extern void ext4_end_bitmap_read(struct buffer_head *bh, int uptodate); | ||
2022 | 1787 | ||
2023 | /* mballoc.c */ | 1788 | /* mballoc.c */ |
2024 | extern long ext4_mb_stats; | 1789 | extern long ext4_mb_stats; |
2025 | extern long ext4_mb_max_to_scan; | 1790 | extern long ext4_mb_max_to_scan; |
2026 | extern int ext4_mb_init(struct super_block *); | 1791 | extern int ext4_mb_init(struct super_block *, int); |
2027 | extern int ext4_mb_release(struct super_block *); | 1792 | extern int ext4_mb_release(struct super_block *); |
2028 | extern ext4_fsblk_t ext4_mb_new_blocks(handle_t *, | 1793 | extern ext4_fsblk_t ext4_mb_new_blocks(handle_t *, |
2029 | struct ext4_allocation_request *, int *); | 1794 | struct ext4_allocation_request *, int *); |
@@ -2034,8 +1799,6 @@ extern void ext4_exit_mballoc(void); | |||
2034 | extern void ext4_free_blocks(handle_t *handle, struct inode *inode, | 1799 | extern void ext4_free_blocks(handle_t *handle, struct inode *inode, |
2035 | struct buffer_head *bh, ext4_fsblk_t block, | 1800 | struct buffer_head *bh, ext4_fsblk_t block, |
2036 | unsigned long count, int flags); | 1801 | unsigned long count, int flags); |
2037 | extern int ext4_mb_alloc_groupinfo(struct super_block *sb, | ||
2038 | ext4_group_t ngroups); | ||
2039 | extern int ext4_mb_add_groupinfo(struct super_block *sb, | 1802 | extern int ext4_mb_add_groupinfo(struct super_block *sb, |
2040 | ext4_group_t i, struct ext4_group_desc *desc); | 1803 | ext4_group_t i, struct ext4_group_desc *desc); |
2041 | extern int ext4_group_add_blocks(handle_t *handle, struct super_block *sb, | 1804 | extern int ext4_group_add_blocks(handle_t *handle, struct super_block *sb, |
@@ -2047,23 +1810,8 @@ struct buffer_head *ext4_getblk(handle_t *, struct inode *, | |||
2047 | ext4_lblk_t, int, int *); | 1810 | ext4_lblk_t, int, int *); |
2048 | struct buffer_head *ext4_bread(handle_t *, struct inode *, | 1811 | struct buffer_head *ext4_bread(handle_t *, struct inode *, |
2049 | ext4_lblk_t, int, int *); | 1812 | ext4_lblk_t, int, int *); |
2050 | int ext4_get_block_write(struct inode *inode, sector_t iblock, | ||
2051 | struct buffer_head *bh_result, int create); | ||
2052 | int ext4_get_block(struct inode *inode, sector_t iblock, | 1813 | int ext4_get_block(struct inode *inode, sector_t iblock, |
2053 | struct buffer_head *bh_result, int create); | 1814 | struct buffer_head *bh_result, int create); |
2054 | int ext4_da_get_block_prep(struct inode *inode, sector_t iblock, | ||
2055 | struct buffer_head *bh, int create); | ||
2056 | int ext4_walk_page_buffers(handle_t *handle, | ||
2057 | struct buffer_head *head, | ||
2058 | unsigned from, | ||
2059 | unsigned to, | ||
2060 | int *partial, | ||
2061 | int (*fn)(handle_t *handle, | ||
2062 | struct buffer_head *bh)); | ||
2063 | int do_journal_get_write_access(handle_t *handle, | ||
2064 | struct buffer_head *bh); | ||
2065 | #define FALL_BACK_TO_NONDELALLOC 1 | ||
2066 | #define CONVERT_INLINE_DATA 2 | ||
2067 | 1815 | ||
2068 | extern struct inode *ext4_iget(struct super_block *, unsigned long); | 1816 | extern struct inode *ext4_iget(struct super_block *, unsigned long); |
2069 | extern int ext4_write_inode(struct inode *, struct writeback_control *); | 1817 | extern int ext4_write_inode(struct inode *, struct writeback_control *); |
@@ -2086,9 +1834,10 @@ extern int ext4_alloc_da_blocks(struct inode *inode); | |||
2086 | extern void ext4_set_aops(struct inode *inode); | 1834 | extern void ext4_set_aops(struct inode *inode); |
2087 | extern int ext4_writepage_trans_blocks(struct inode *); | 1835 | extern int ext4_writepage_trans_blocks(struct inode *); |
2088 | extern int ext4_chunk_trans_blocks(struct inode *, int nrblocks); | 1836 | extern int ext4_chunk_trans_blocks(struct inode *, int nrblocks); |
2089 | extern int ext4_discard_partial_page_buffers(handle_t *handle, | 1837 | extern int ext4_block_truncate_page(handle_t *handle, |
2090 | struct address_space *mapping, loff_t from, | 1838 | struct address_space *mapping, loff_t from); |
2091 | loff_t length, int flags); | 1839 | extern int ext4_block_zero_page_range(handle_t *handle, |
1840 | struct address_space *mapping, loff_t from, loff_t length); | ||
2092 | extern int ext4_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf); | 1841 | extern int ext4_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf); |
2093 | extern qsize_t *ext4_get_reserved_space(struct inode *inode); | 1842 | extern qsize_t *ext4_get_reserved_space(struct inode *inode); |
2094 | extern void ext4_da_update_reserve_space(struct inode *inode, | 1843 | extern void ext4_da_update_reserve_space(struct inode *inode, |
@@ -2112,26 +1861,10 @@ extern long ext4_compat_ioctl(struct file *, unsigned int, unsigned long); | |||
2112 | extern int ext4_ext_migrate(struct inode *); | 1861 | extern int ext4_ext_migrate(struct inode *); |
2113 | 1862 | ||
2114 | /* namei.c */ | 1863 | /* namei.c */ |
2115 | extern int ext4_dirent_csum_verify(struct inode *inode, | ||
2116 | struct ext4_dir_entry *dirent); | ||
2117 | extern int ext4_orphan_add(handle_t *, struct inode *); | 1864 | extern int ext4_orphan_add(handle_t *, struct inode *); |
2118 | extern int ext4_orphan_del(handle_t *, struct inode *); | 1865 | extern int ext4_orphan_del(handle_t *, struct inode *); |
2119 | extern int ext4_htree_fill_tree(struct file *dir_file, __u32 start_hash, | 1866 | extern int ext4_htree_fill_tree(struct file *dir_file, __u32 start_hash, |
2120 | __u32 start_minor_hash, __u32 *next_hash); | 1867 | __u32 start_minor_hash, __u32 *next_hash); |
2121 | extern int search_dir(struct buffer_head *bh, | ||
2122 | char *search_buf, | ||
2123 | int buf_size, | ||
2124 | struct inode *dir, | ||
2125 | const struct qstr *d_name, | ||
2126 | unsigned int offset, | ||
2127 | struct ext4_dir_entry_2 **res_dir); | ||
2128 | extern int ext4_generic_delete_entry(handle_t *handle, | ||
2129 | struct inode *dir, | ||
2130 | struct ext4_dir_entry_2 *de_del, | ||
2131 | struct buffer_head *bh, | ||
2132 | void *entry_buf, | ||
2133 | int buf_size, | ||
2134 | int csum_size); | ||
2135 | 1868 | ||
2136 | /* resize.c */ | 1869 | /* resize.c */ |
2137 | extern int ext4_group_add(struct super_block *sb, | 1870 | extern int ext4_group_add(struct super_block *sb, |
@@ -2139,52 +1872,45 @@ extern int ext4_group_add(struct super_block *sb, | |||
2139 | extern int ext4_group_extend(struct super_block *sb, | 1872 | extern int ext4_group_extend(struct super_block *sb, |
2140 | struct ext4_super_block *es, | 1873 | struct ext4_super_block *es, |
2141 | ext4_fsblk_t n_blocks_count); | 1874 | ext4_fsblk_t n_blocks_count); |
2142 | extern int ext4_resize_fs(struct super_block *sb, ext4_fsblk_t n_blocks_count); | ||
2143 | 1875 | ||
2144 | /* super.c */ | 1876 | /* super.c */ |
2145 | extern int ext4_calculate_overhead(struct super_block *sb); | ||
2146 | extern int ext4_superblock_csum_verify(struct super_block *sb, | ||
2147 | struct ext4_super_block *es); | ||
2148 | extern void ext4_superblock_csum_set(struct super_block *sb); | ||
2149 | extern void *ext4_kvmalloc(size_t size, gfp_t flags); | 1877 | extern void *ext4_kvmalloc(size_t size, gfp_t flags); |
2150 | extern void *ext4_kvzalloc(size_t size, gfp_t flags); | 1878 | extern void *ext4_kvzalloc(size_t size, gfp_t flags); |
2151 | extern void ext4_kvfree(void *ptr); | 1879 | extern void ext4_kvfree(void *ptr); |
2152 | extern int ext4_alloc_flex_bg_array(struct super_block *sb, | 1880 | extern void __ext4_error(struct super_block *, const char *, unsigned int, |
2153 | ext4_group_t ngroup); | 1881 | const char *, ...) |
2154 | extern __printf(4, 5) | 1882 | __attribute__ ((format (printf, 4, 5))); |
2155 | void __ext4_error(struct super_block *, const char *, unsigned int, | ||
2156 | const char *, ...); | ||
2157 | #define ext4_error(sb, message...) __ext4_error(sb, __func__, \ | 1883 | #define ext4_error(sb, message...) __ext4_error(sb, __func__, \ |
2158 | __LINE__, ## message) | 1884 | __LINE__, ## message) |
2159 | extern __printf(5, 6) | 1885 | extern void ext4_error_inode(struct inode *, const char *, unsigned int, |
2160 | void ext4_error_inode(struct inode *, const char *, unsigned int, ext4_fsblk_t, | 1886 | ext4_fsblk_t, const char *, ...) |
2161 | const char *, ...); | 1887 | __attribute__ ((format (printf, 5, 6))); |
2162 | extern __printf(5, 6) | 1888 | extern void ext4_error_file(struct file *, const char *, unsigned int, |
2163 | void ext4_error_file(struct file *, const char *, unsigned int, ext4_fsblk_t, | 1889 | ext4_fsblk_t, const char *, ...) |
2164 | const char *, ...); | 1890 | __attribute__ ((format (printf, 5, 6))); |
2165 | extern void __ext4_std_error(struct super_block *, const char *, | 1891 | extern void __ext4_std_error(struct super_block *, const char *, |
2166 | unsigned int, int); | 1892 | unsigned int, int); |
2167 | extern __printf(4, 5) | 1893 | extern void __ext4_abort(struct super_block *, const char *, unsigned int, |
2168 | void __ext4_abort(struct super_block *, const char *, unsigned int, | 1894 | const char *, ...) |
2169 | const char *, ...); | 1895 | __attribute__ ((format (printf, 4, 5))); |
2170 | #define ext4_abort(sb, message...) __ext4_abort(sb, __func__, \ | 1896 | #define ext4_abort(sb, message...) __ext4_abort(sb, __func__, \ |
2171 | __LINE__, ## message) | 1897 | __LINE__, ## message) |
2172 | extern __printf(4, 5) | 1898 | extern void __ext4_warning(struct super_block *, const char *, unsigned int, |
2173 | void __ext4_warning(struct super_block *, const char *, unsigned int, | 1899 | const char *, ...) |
2174 | const char *, ...); | 1900 | __attribute__ ((format (printf, 4, 5))); |
2175 | #define ext4_warning(sb, message...) __ext4_warning(sb, __func__, \ | 1901 | #define ext4_warning(sb, message...) __ext4_warning(sb, __func__, \ |
2176 | __LINE__, ## message) | 1902 | __LINE__, ## message) |
2177 | extern __printf(3, 4) | 1903 | extern void ext4_msg(struct super_block *, const char *, const char *, ...) |
2178 | void ext4_msg(struct super_block *, const char *, const char *, ...); | 1904 | __attribute__ ((format (printf, 3, 4))); |
2179 | extern void __dump_mmp_msg(struct super_block *, struct mmp_struct *mmp, | 1905 | extern void __dump_mmp_msg(struct super_block *, struct mmp_struct *mmp, |
2180 | const char *, unsigned int, const char *); | 1906 | const char *, unsigned int, const char *); |
2181 | #define dump_mmp_msg(sb, mmp, msg) __dump_mmp_msg(sb, mmp, __func__, \ | 1907 | #define dump_mmp_msg(sb, mmp, msg) __dump_mmp_msg(sb, mmp, __func__, \ |
2182 | __LINE__, msg) | 1908 | __LINE__, msg) |
2183 | extern __printf(7, 8) | 1909 | extern void __ext4_grp_locked_error(const char *, unsigned int, \ |
2184 | void __ext4_grp_locked_error(const char *, unsigned int, | 1910 | struct super_block *, ext4_group_t, \ |
2185 | struct super_block *, ext4_group_t, | 1911 | unsigned long, ext4_fsblk_t, \ |
2186 | unsigned long, ext4_fsblk_t, | 1912 | const char *, ...) |
2187 | const char *, ...); | 1913 | __attribute__ ((format (printf, 7, 8))); |
2188 | #define ext4_grp_locked_error(sb, grp, message...) \ | 1914 | #define ext4_grp_locked_error(sb, grp, message...) \ |
2189 | __ext4_grp_locked_error(__func__, __LINE__, (sb), (grp), ## message) | 1915 | __ext4_grp_locked_error(__func__, __LINE__, (sb), (grp), ## message) |
2190 | extern void ext4_update_dynamic_rev(struct super_block *sb); | 1916 | extern void ext4_update_dynamic_rev(struct super_block *sb); |
@@ -2200,8 +1926,8 @@ extern ext4_fsblk_t ext4_inode_bitmap(struct super_block *sb, | |||
2200 | struct ext4_group_desc *bg); | 1926 | struct ext4_group_desc *bg); |
2201 | extern ext4_fsblk_t ext4_inode_table(struct super_block *sb, | 1927 | extern ext4_fsblk_t ext4_inode_table(struct super_block *sb, |
2202 | struct ext4_group_desc *bg); | 1928 | struct ext4_group_desc *bg); |
2203 | extern __u32 ext4_free_group_clusters(struct super_block *sb, | 1929 | extern __u32 ext4_free_blks_count(struct super_block *sb, |
2204 | struct ext4_group_desc *bg); | 1930 | struct ext4_group_desc *bg); |
2205 | extern __u32 ext4_free_inodes_count(struct super_block *sb, | 1931 | extern __u32 ext4_free_inodes_count(struct super_block *sb, |
2206 | struct ext4_group_desc *bg); | 1932 | struct ext4_group_desc *bg); |
2207 | extern __u32 ext4_used_dirs_count(struct super_block *sb, | 1933 | extern __u32 ext4_used_dirs_count(struct super_block *sb, |
@@ -2214,26 +1940,18 @@ extern void ext4_inode_bitmap_set(struct super_block *sb, | |||
2214 | struct ext4_group_desc *bg, ext4_fsblk_t blk); | 1940 | struct ext4_group_desc *bg, ext4_fsblk_t blk); |
2215 | extern void ext4_inode_table_set(struct super_block *sb, | 1941 | extern void ext4_inode_table_set(struct super_block *sb, |
2216 | struct ext4_group_desc *bg, ext4_fsblk_t blk); | 1942 | struct ext4_group_desc *bg, ext4_fsblk_t blk); |
2217 | extern void ext4_free_group_clusters_set(struct super_block *sb, | 1943 | extern void ext4_free_blks_set(struct super_block *sb, |
2218 | struct ext4_group_desc *bg, | 1944 | struct ext4_group_desc *bg, __u32 count); |
2219 | __u32 count); | ||
2220 | extern void ext4_free_inodes_set(struct super_block *sb, | 1945 | extern void ext4_free_inodes_set(struct super_block *sb, |
2221 | struct ext4_group_desc *bg, __u32 count); | 1946 | struct ext4_group_desc *bg, __u32 count); |
2222 | extern void ext4_used_dirs_set(struct super_block *sb, | 1947 | extern void ext4_used_dirs_set(struct super_block *sb, |
2223 | struct ext4_group_desc *bg, __u32 count); | 1948 | struct ext4_group_desc *bg, __u32 count); |
2224 | extern void ext4_itable_unused_set(struct super_block *sb, | 1949 | extern void ext4_itable_unused_set(struct super_block *sb, |
2225 | struct ext4_group_desc *bg, __u32 count); | 1950 | struct ext4_group_desc *bg, __u32 count); |
2226 | extern int ext4_group_desc_csum_verify(struct super_block *sb, __u32 group, | 1951 | extern __le16 ext4_group_desc_csum(struct ext4_sb_info *sbi, __u32 group, |
1952 | struct ext4_group_desc *gdp); | ||
1953 | extern int ext4_group_desc_csum_verify(struct ext4_sb_info *sbi, __u32 group, | ||
2227 | struct ext4_group_desc *gdp); | 1954 | struct ext4_group_desc *gdp); |
2228 | extern void ext4_group_desc_csum_set(struct super_block *sb, __u32 group, | ||
2229 | struct ext4_group_desc *gdp); | ||
2230 | |||
2231 | static inline int ext4_has_group_desc_csum(struct super_block *sb) | ||
2232 | { | ||
2233 | return EXT4_HAS_RO_COMPAT_FEATURE(sb, | ||
2234 | EXT4_FEATURE_RO_COMPAT_GDT_CSUM | | ||
2235 | EXT4_FEATURE_RO_COMPAT_METADATA_CSUM); | ||
2236 | } | ||
2237 | 1955 | ||
2238 | static inline ext4_fsblk_t ext4_blocks_count(struct ext4_super_block *es) | 1956 | static inline ext4_fsblk_t ext4_blocks_count(struct ext4_super_block *es) |
2239 | { | 1957 | { |
@@ -2332,13 +2050,13 @@ do { \ | |||
2332 | } while (0) | 2050 | } while (0) |
2333 | 2051 | ||
2334 | #ifdef CONFIG_SMP | 2052 | #ifdef CONFIG_SMP |
2335 | /* Each CPU can accumulate percpu_counter_batch clusters in their local | 2053 | /* Each CPU can accumulate percpu_counter_batch blocks in their local |
2336 | * counters. So we need to make sure we have free clusters more | 2054 | * counters. So we need to make sure we have free blocks more |
2337 | * than percpu_counter_batch * nr_cpu_ids. Also add a window of 4 times. | 2055 | * than percpu_counter_batch * nr_cpu_ids. Also add a window of 4 times. |
2338 | */ | 2056 | */ |
2339 | #define EXT4_FREECLUSTERS_WATERMARK (4 * (percpu_counter_batch * nr_cpu_ids)) | 2057 | #define EXT4_FREEBLOCKS_WATERMARK (4 * (percpu_counter_batch * nr_cpu_ids)) |
2340 | #else | 2058 | #else |
2341 | #define EXT4_FREECLUSTERS_WATERMARK 0 | 2059 | #define EXT4_FREEBLOCKS_WATERMARK 0 |
2342 | #endif | 2060 | #endif |
2343 | 2061 | ||
2344 | static inline void ext4_update_i_disksize(struct inode *inode, loff_t newsize) | 2062 | static inline void ext4_update_i_disksize(struct inode *inode, loff_t newsize) |
@@ -2428,6 +2146,12 @@ static inline void ext4_unlock_group(struct super_block *sb, | |||
2428 | spin_unlock(ext4_group_lock_ptr(sb, group)); | 2146 | spin_unlock(ext4_group_lock_ptr(sb, group)); |
2429 | } | 2147 | } |
2430 | 2148 | ||
2149 | static inline void ext4_mark_super_dirty(struct super_block *sb) | ||
2150 | { | ||
2151 | if (EXT4_SB(sb)->s_journal == NULL) | ||
2152 | sb->s_dirt =1; | ||
2153 | } | ||
2154 | |||
2431 | /* | 2155 | /* |
2432 | * Block validity checking | 2156 | * Block validity checking |
2433 | */ | 2157 | */ |
@@ -2452,21 +2176,11 @@ extern const struct file_operations ext4_dir_operations; | |||
2452 | extern const struct inode_operations ext4_file_inode_operations; | 2176 | extern const struct inode_operations ext4_file_inode_operations; |
2453 | extern const struct file_operations ext4_file_operations; | 2177 | extern const struct file_operations ext4_file_operations; |
2454 | extern loff_t ext4_llseek(struct file *file, loff_t offset, int origin); | 2178 | extern loff_t ext4_llseek(struct file *file, loff_t offset, int origin); |
2455 | extern void ext4_unwritten_wait(struct inode *inode); | ||
2456 | 2179 | ||
2457 | /* namei.c */ | 2180 | /* namei.c */ |
2458 | extern const struct inode_operations ext4_dir_inode_operations; | 2181 | extern const struct inode_operations ext4_dir_inode_operations; |
2459 | extern const struct inode_operations ext4_special_inode_operations; | 2182 | extern const struct inode_operations ext4_special_inode_operations; |
2460 | extern struct dentry *ext4_get_parent(struct dentry *child); | 2183 | extern struct dentry *ext4_get_parent(struct dentry *child); |
2461 | extern struct ext4_dir_entry_2 *ext4_init_dot_dotdot(struct inode *inode, | ||
2462 | struct ext4_dir_entry_2 *de, | ||
2463 | int blocksize, int csum_size, | ||
2464 | unsigned int parent_ino, int dotdot_real_len); | ||
2465 | extern void initialize_dirent_tail(struct ext4_dir_entry_tail *t, | ||
2466 | unsigned int blocksize); | ||
2467 | extern int ext4_handle_dirty_dirent_node(handle_t *handle, | ||
2468 | struct inode *inode, | ||
2469 | struct buffer_head *bh); | ||
2470 | 2184 | ||
2471 | /* symlink.c */ | 2185 | /* symlink.c */ |
2472 | extern const struct inode_operations ext4_symlink_inode_operations; | 2186 | extern const struct inode_operations ext4_symlink_inode_operations; |
@@ -2484,9 +2198,6 @@ extern int ext4_check_blockref(const char *, unsigned int, | |||
2484 | struct inode *, __le32 *, unsigned int); | 2198 | struct inode *, __le32 *, unsigned int); |
2485 | 2199 | ||
2486 | /* extents.c */ | 2200 | /* extents.c */ |
2487 | struct ext4_ext_path; | ||
2488 | struct ext4_extent; | ||
2489 | |||
2490 | extern int ext4_ext_tree_init(handle_t *handle, struct inode *); | 2201 | extern int ext4_ext_tree_init(handle_t *handle, struct inode *); |
2491 | extern int ext4_ext_writepage_trans_blocks(struct inode *, int); | 2202 | extern int ext4_ext_writepage_trans_blocks(struct inode *, int); |
2492 | extern int ext4_ext_index_trans_blocks(struct inode *inode, int nrblocks, | 2203 | extern int ext4_ext_index_trans_blocks(struct inode *inode, int nrblocks, |
@@ -2504,27 +2215,8 @@ extern int ext4_convert_unwritten_extents(struct inode *inode, loff_t offset, | |||
2504 | ssize_t len); | 2215 | ssize_t len); |
2505 | extern int ext4_map_blocks(handle_t *handle, struct inode *inode, | 2216 | extern int ext4_map_blocks(handle_t *handle, struct inode *inode, |
2506 | struct ext4_map_blocks *map, int flags); | 2217 | struct ext4_map_blocks *map, int flags); |
2507 | extern int ext4_ext_calc_metadata_amount(struct inode *inode, | ||
2508 | ext4_lblk_t lblocks); | ||
2509 | extern int ext4_extent_tree_init(handle_t *, struct inode *); | ||
2510 | extern int ext4_ext_calc_credits_for_single_extent(struct inode *inode, | ||
2511 | int num, | ||
2512 | struct ext4_ext_path *path); | ||
2513 | extern int ext4_can_extents_be_merged(struct inode *inode, | ||
2514 | struct ext4_extent *ex1, | ||
2515 | struct ext4_extent *ex2); | ||
2516 | extern int ext4_ext_insert_extent(handle_t *, struct inode *, | ||
2517 | struct ext4_ext_path *, | ||
2518 | struct ext4_extent *, int); | ||
2519 | extern struct ext4_ext_path *ext4_ext_find_extent(struct inode *, ext4_lblk_t, | ||
2520 | struct ext4_ext_path *); | ||
2521 | extern void ext4_ext_drop_refs(struct ext4_ext_path *); | ||
2522 | extern int ext4_ext_check_inode(struct inode *inode); | ||
2523 | extern int ext4_find_delalloc_cluster(struct inode *inode, ext4_lblk_t lblk); | ||
2524 | extern int ext4_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, | 2218 | extern int ext4_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, |
2525 | __u64 start, __u64 len); | 2219 | __u64 start, __u64 len); |
2526 | |||
2527 | |||
2528 | /* move_extent.c */ | 2220 | /* move_extent.c */ |
2529 | extern int ext4_move_extents(struct file *o_filp, struct file *d_filp, | 2221 | extern int ext4_move_extents(struct file *o_filp, struct file *d_filp, |
2530 | __u64 start_orig, __u64 start_donor, | 2222 | __u64 start_orig, __u64 start_donor, |
@@ -2532,11 +2224,11 @@ extern int ext4_move_extents(struct file *o_filp, struct file *d_filp, | |||
2532 | 2224 | ||
2533 | /* page-io.c */ | 2225 | /* page-io.c */ |
2534 | extern int __init ext4_init_pageio(void); | 2226 | extern int __init ext4_init_pageio(void); |
2535 | extern void ext4_add_complete_io(ext4_io_end_t *io_end); | ||
2536 | extern void ext4_exit_pageio(void); | 2227 | extern void ext4_exit_pageio(void); |
2537 | extern void ext4_ioend_wait(struct inode *); | 2228 | extern void ext4_ioend_wait(struct inode *); |
2538 | extern void ext4_free_io_end(ext4_io_end_t *io); | 2229 | extern void ext4_free_io_end(ext4_io_end_t *io); |
2539 | extern ext4_io_end_t *ext4_init_io_end(struct inode *inode, gfp_t flags); | 2230 | extern ext4_io_end_t *ext4_init_io_end(struct inode *inode, gfp_t flags); |
2231 | extern int ext4_end_io_nolock(ext4_io_end_t *io); | ||
2540 | extern void ext4_io_submit(struct ext4_io_submit *io); | 2232 | extern void ext4_io_submit(struct ext4_io_submit *io); |
2541 | extern int ext4_bio_write_page(struct ext4_io_submit *io, | 2233 | extern int ext4_bio_write_page(struct ext4_io_submit *io, |
2542 | struct page *page, | 2234 | struct page *page, |
@@ -2545,26 +2237,18 @@ extern int ext4_bio_write_page(struct ext4_io_submit *io, | |||
2545 | 2237 | ||
2546 | /* mmp.c */ | 2238 | /* mmp.c */ |
2547 | extern int ext4_multi_mount_protect(struct super_block *, ext4_fsblk_t); | 2239 | extern int ext4_multi_mount_protect(struct super_block *, ext4_fsblk_t); |
2548 | extern void ext4_mmp_csum_set(struct super_block *sb, struct mmp_struct *mmp); | ||
2549 | extern int ext4_mmp_csum_verify(struct super_block *sb, | ||
2550 | struct mmp_struct *mmp); | ||
2551 | 2240 | ||
2552 | /* BH_Uninit flag: blocks are allocated but uninitialized on disk */ | 2241 | /* BH_Uninit flag: blocks are allocated but uninitialized on disk */ |
2553 | enum ext4_state_bits { | 2242 | enum ext4_state_bits { |
2554 | BH_Uninit /* blocks are allocated but uninitialized on disk */ | 2243 | BH_Uninit /* blocks are allocated but uninitialized on disk */ |
2555 | = BH_JBDPrivateStart, | 2244 | = BH_JBDPrivateStart, |
2556 | BH_AllocFromCluster, /* allocated blocks were part of already | ||
2557 | * allocated cluster. Note that this flag will | ||
2558 | * never, ever appear in a buffer_head's state | ||
2559 | * flag. See EXT4_MAP_FROM_CLUSTER to see where | ||
2560 | * this is used. */ | ||
2561 | }; | 2245 | }; |
2562 | 2246 | ||
2563 | BUFFER_FNS(Uninit, uninit) | 2247 | BUFFER_FNS(Uninit, uninit) |
2564 | TAS_BUFFER_FNS(Uninit, uninit) | 2248 | TAS_BUFFER_FNS(Uninit, uninit) |
2565 | 2249 | ||
2566 | /* | 2250 | /* |
2567 | * Add new method to test whether block and inode bitmaps are properly | 2251 | * Add new method to test wether block and inode bitmaps are properly |
2568 | * initialized. With uninit_bg reading the block from disk is not enough | 2252 | * initialized. With uninit_bg reading the block from disk is not enough |
2569 | * to mark the bitmap uptodate. We need to also zero-out the bitmap | 2253 | * to mark the bitmap uptodate. We need to also zero-out the bitmap |
2570 | */ | 2254 | */ |
@@ -2580,21 +2264,6 @@ static inline void set_bitmap_uptodate(struct buffer_head *bh) | |||
2580 | set_bit(BH_BITMAP_UPTODATE, &(bh)->b_state); | 2264 | set_bit(BH_BITMAP_UPTODATE, &(bh)->b_state); |
2581 | } | 2265 | } |
2582 | 2266 | ||
2583 | /* | ||
2584 | * Disable DIO read nolock optimization, so new dioreaders will be forced | ||
2585 | * to grab i_mutex | ||
2586 | */ | ||
2587 | static inline void ext4_inode_block_unlocked_dio(struct inode *inode) | ||
2588 | { | ||
2589 | ext4_set_inode_state(inode, EXT4_STATE_DIOREAD_LOCK); | ||
2590 | smp_mb(); | ||
2591 | } | ||
2592 | static inline void ext4_inode_resume_unlocked_dio(struct inode *inode) | ||
2593 | { | ||
2594 | smp_mb(); | ||
2595 | ext4_clear_inode_state(inode, EXT4_STATE_DIOREAD_LOCK); | ||
2596 | } | ||
2597 | |||
2598 | #define in_range(b, first, len) ((b) >= (first) && (b) <= (first) + (len) - 1) | 2267 | #define in_range(b, first, len) ((b) >= (first) && (b) <= (first) + (len) - 1) |
2599 | 2268 | ||
2600 | /* For ioend & aio unwritten conversion wait queues */ | 2269 | /* For ioend & aio unwritten conversion wait queues */ |