diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-03-05 13:47:00 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-03-05 13:47:00 -0500 |
commit | 1f63b9c15b17d5af360c180f5c71537e954d5d3b (patch) | |
tree | 4da17d6f2035ae093680fa2caa3e1c84b44bb237 /fs/ext4/ext4.h | |
parent | b24bc1e61cec2174faf5dfa632da16b6ca17144f (diff) | |
parent | 64e290ec69be39f1887fa0b403c1e417b6b038e7 (diff) |
Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4: (36 commits)
ext4: fix up rb_root initializations to use RB_ROOT
ext4: Code cleanup for EXT4_IOC_MOVE_EXT ioctl
ext4: Fix the NULL reference in double_down_write_data_sem()
ext4: Fix insertion point of extent in mext_insert_across_blocks()
ext4: consolidate in_range() definitions
ext4: cleanup to use ext4_grp_offs_to_block()
ext4: cleanup to use ext4_group_first_block_no()
ext4: Release page references acquired in ext4_da_block_invalidatepages
ext4: Fix ext4_quota_write cross block boundary behaviour
ext4: Convert BUG_ON checks to use ext4_error() instead
ext4: Use direct_IO_no_locking in ext4 dio read
ext4: use ext4_get_block_write in buffer write
ext4: mechanical rename some of the direct I/O get_block's identifiers
ext4: make "offset" consistent in ext4_check_dir_entry()
ext4: Handle non empty on-disk orphan link
ext4: explicitly remove inode from orphan list after failed direct io
ext4: fix error handling in migrate
ext4: deprecate obsoleted mount options
ext4: Fix fencepost error in chosing choosing group vs file preallocation.
jbd2: clean up an assertion in jbd2_journal_commit_transaction()
...
Diffstat (limited to 'fs/ext4/ext4.h')
-rw-r--r-- | fs/ext4/ext4.h | 106 |
1 files changed, 77 insertions, 29 deletions
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 4cedc91ec59d..6e5787a29b90 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h | |||
@@ -53,6 +53,12 @@ | |||
53 | #define ext4_debug(f, a...) do {} while (0) | 53 | #define ext4_debug(f, a...) do {} while (0) |
54 | #endif | 54 | #endif |
55 | 55 | ||
56 | #define EXT4_ERROR_INODE(inode, fmt, a...) \ | ||
57 | ext4_error_inode(__func__, (inode), (fmt), ## a); | ||
58 | |||
59 | #define EXT4_ERROR_FILE(file, fmt, a...) \ | ||
60 | ext4_error_file(__func__, (file), (fmt), ## a); | ||
61 | |||
56 | /* data type for block offset of block group */ | 62 | /* data type for block offset of block group */ |
57 | typedef int ext4_grpblk_t; | 63 | typedef int ext4_grpblk_t; |
58 | 64 | ||
@@ -133,14 +139,14 @@ struct mpage_da_data { | |||
133 | int pages_written; | 139 | int pages_written; |
134 | int retval; | 140 | int retval; |
135 | }; | 141 | }; |
136 | #define DIO_AIO_UNWRITTEN 0x1 | 142 | #define EXT4_IO_UNWRITTEN 0x1 |
137 | typedef struct ext4_io_end { | 143 | typedef struct ext4_io_end { |
138 | struct list_head list; /* per-file finished AIO list */ | 144 | struct list_head list; /* per-file finished AIO list */ |
139 | struct inode *inode; /* file being written to */ | 145 | struct inode *inode; /* file being written to */ |
140 | unsigned int flag; /* unwritten or not */ | 146 | unsigned int flag; /* unwritten or not */ |
141 | int error; /* I/O error code */ | 147 | struct page *page; /* page struct for buffer write */ |
142 | ext4_lblk_t offset; /* offset in the file */ | 148 | loff_t offset; /* offset in the file */ |
143 | size_t size; /* size of the extent */ | 149 | ssize_t size; /* size of the extent */ |
144 | struct work_struct work; /* data work queue */ | 150 | struct work_struct work; /* data work queue */ |
145 | } ext4_io_end_t; | 151 | } ext4_io_end_t; |
146 | 152 | ||
@@ -284,10 +290,12 @@ struct flex_groups { | |||
284 | #define EXT4_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/ | 290 | #define EXT4_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/ |
285 | #define EXT4_HUGE_FILE_FL 0x00040000 /* Set to each huge file */ | 291 | #define EXT4_HUGE_FILE_FL 0x00040000 /* Set to each huge file */ |
286 | #define EXT4_EXTENTS_FL 0x00080000 /* Inode uses extents */ | 292 | #define EXT4_EXTENTS_FL 0x00080000 /* Inode uses extents */ |
293 | #define EXT4_EA_INODE_FL 0x00200000 /* Inode used for large EA */ | ||
294 | #define EXT4_EOFBLOCKS_FL 0x00400000 /* Blocks allocated beyond EOF */ | ||
287 | #define EXT4_RESERVED_FL 0x80000000 /* reserved for ext4 lib */ | 295 | #define EXT4_RESERVED_FL 0x80000000 /* reserved for ext4 lib */ |
288 | 296 | ||
289 | #define EXT4_FL_USER_VISIBLE 0x000BDFFF /* User visible flags */ | 297 | #define EXT4_FL_USER_VISIBLE 0x004BDFFF /* User visible flags */ |
290 | #define EXT4_FL_USER_MODIFIABLE 0x000B80FF /* User modifiable flags */ | 298 | #define EXT4_FL_USER_MODIFIABLE 0x004B80FF /* User modifiable flags */ |
291 | 299 | ||
292 | /* Flags that should be inherited by new inodes from their parent. */ | 300 | /* Flags that should be inherited by new inodes from their parent. */ |
293 | #define EXT4_FL_INHERITED (EXT4_SECRM_FL | EXT4_UNRM_FL | EXT4_COMPR_FL |\ | 301 | #define EXT4_FL_INHERITED (EXT4_SECRM_FL | EXT4_UNRM_FL | EXT4_COMPR_FL |\ |
@@ -313,17 +321,6 @@ static inline __u32 ext4_mask_flags(umode_t mode, __u32 flags) | |||
313 | return flags & EXT4_OTHER_FLMASK; | 321 | return flags & EXT4_OTHER_FLMASK; |
314 | } | 322 | } |
315 | 323 | ||
316 | /* | ||
317 | * Inode dynamic state flags | ||
318 | */ | ||
319 | #define EXT4_STATE_JDATA 0x00000001 /* journaled data exists */ | ||
320 | #define EXT4_STATE_NEW 0x00000002 /* inode is newly created */ | ||
321 | #define EXT4_STATE_XATTR 0x00000004 /* has in-inode xattrs */ | ||
322 | #define EXT4_STATE_NO_EXPAND 0x00000008 /* No space for expansion */ | ||
323 | #define EXT4_STATE_DA_ALLOC_CLOSE 0x00000010 /* Alloc DA blks on close */ | ||
324 | #define EXT4_STATE_EXT_MIGRATE 0x00000020 /* Inode is migrating */ | ||
325 | #define EXT4_STATE_DIO_UNWRITTEN 0x00000040 /* need convert on dio done*/ | ||
326 | |||
327 | /* Used to pass group descriptor data when online resize is done */ | 324 | /* Used to pass group descriptor data when online resize is done */ |
328 | struct ext4_new_group_input { | 325 | struct ext4_new_group_input { |
329 | __u32 group; /* Group number for this data */ | 326 | __u32 group; /* Group number for this data */ |
@@ -364,19 +361,20 @@ struct ext4_new_group_data { | |||
364 | /* caller is from the direct IO path, request to creation of an | 361 | /* caller is from the direct IO path, request to creation of an |
365 | unitialized extents if not allocated, split the uninitialized | 362 | unitialized extents if not allocated, split the uninitialized |
366 | extent if blocks has been preallocated already*/ | 363 | extent if blocks has been preallocated already*/ |
367 | #define EXT4_GET_BLOCKS_DIO 0x0008 | 364 | #define EXT4_GET_BLOCKS_PRE_IO 0x0008 |
368 | #define EXT4_GET_BLOCKS_CONVERT 0x0010 | 365 | #define EXT4_GET_BLOCKS_CONVERT 0x0010 |
369 | #define EXT4_GET_BLOCKS_DIO_CREATE_EXT (EXT4_GET_BLOCKS_DIO|\ | 366 | #define EXT4_GET_BLOCKS_IO_CREATE_EXT (EXT4_GET_BLOCKS_PRE_IO|\ |
367 | EXT4_GET_BLOCKS_CREATE_UNINIT_EXT) | ||
368 | /* Convert extent to initialized after IO complete */ | ||
369 | #define EXT4_GET_BLOCKS_IO_CONVERT_EXT (EXT4_GET_BLOCKS_CONVERT|\ | ||
370 | EXT4_GET_BLOCKS_CREATE_UNINIT_EXT) | 370 | EXT4_GET_BLOCKS_CREATE_UNINIT_EXT) |
371 | /* Convert extent to initialized after direct IO complete */ | ||
372 | #define EXT4_GET_BLOCKS_DIO_CONVERT_EXT (EXT4_GET_BLOCKS_CONVERT|\ | ||
373 | EXT4_GET_BLOCKS_DIO_CREATE_EXT) | ||
374 | 371 | ||
375 | /* | 372 | /* |
376 | * Flags used by ext4_free_blocks | 373 | * Flags used by ext4_free_blocks |
377 | */ | 374 | */ |
378 | #define EXT4_FREE_BLOCKS_METADATA 0x0001 | 375 | #define EXT4_FREE_BLOCKS_METADATA 0x0001 |
379 | #define EXT4_FREE_BLOCKS_FORGET 0x0002 | 376 | #define EXT4_FREE_BLOCKS_FORGET 0x0002 |
377 | #define EXT4_FREE_BLOCKS_VALIDATED 0x0004 | ||
380 | 378 | ||
381 | /* | 379 | /* |
382 | * ioctl commands | 380 | * ioctl commands |
@@ -630,7 +628,7 @@ struct ext4_inode_info { | |||
630 | * near to their parent directory's inode. | 628 | * near to their parent directory's inode. |
631 | */ | 629 | */ |
632 | ext4_group_t i_block_group; | 630 | ext4_group_t i_block_group; |
633 | __u32 i_state; /* Dynamic state flags for ext4 */ | 631 | unsigned long i_state_flags; /* Dynamic state flags */ |
634 | 632 | ||
635 | ext4_lblk_t i_dir_start_lookup; | 633 | ext4_lblk_t i_dir_start_lookup; |
636 | #ifdef CONFIG_EXT4_FS_XATTR | 634 | #ifdef CONFIG_EXT4_FS_XATTR |
@@ -708,8 +706,9 @@ struct ext4_inode_info { | |||
708 | qsize_t i_reserved_quota; | 706 | qsize_t i_reserved_quota; |
709 | #endif | 707 | #endif |
710 | 708 | ||
711 | /* completed async DIOs that might need unwritten extents handling */ | 709 | /* completed IOs that might need unwritten extents handling */ |
712 | struct list_head i_aio_dio_complete_list; | 710 | struct list_head i_completed_io_list; |
711 | spinlock_t i_completed_io_lock; | ||
713 | /* current io_end structure for async DIO write*/ | 712 | /* current io_end structure for async DIO write*/ |
714 | ext4_io_end_t *cur_aio_dio; | 713 | ext4_io_end_t *cur_aio_dio; |
715 | 714 | ||
@@ -760,6 +759,7 @@ struct ext4_inode_info { | |||
760 | #define EXT4_MOUNT_QUOTA 0x80000 /* Some quota option set */ | 759 | #define EXT4_MOUNT_QUOTA 0x80000 /* Some quota option set */ |
761 | #define EXT4_MOUNT_USRQUOTA 0x100000 /* "old" user quota */ | 760 | #define EXT4_MOUNT_USRQUOTA 0x100000 /* "old" user quota */ |
762 | #define EXT4_MOUNT_GRPQUOTA 0x200000 /* "old" group quota */ | 761 | #define EXT4_MOUNT_GRPQUOTA 0x200000 /* "old" group quota */ |
762 | #define EXT4_MOUNT_DIOREAD_NOLOCK 0x400000 /* Enable support for dio read nolocking */ | ||
763 | #define EXT4_MOUNT_JOURNAL_CHECKSUM 0x800000 /* Journal checksums */ | 763 | #define EXT4_MOUNT_JOURNAL_CHECKSUM 0x800000 /* Journal checksums */ |
764 | #define EXT4_MOUNT_JOURNAL_ASYNC_COMMIT 0x1000000 /* Journal Async Commit */ | 764 | #define EXT4_MOUNT_JOURNAL_ASYNC_COMMIT 0x1000000 /* Journal Async Commit */ |
765 | #define EXT4_MOUNT_I_VERSION 0x2000000 /* i_version support */ | 765 | #define EXT4_MOUNT_I_VERSION 0x2000000 /* i_version support */ |
@@ -1050,6 +1050,34 @@ static inline int ext4_valid_inum(struct super_block *sb, unsigned long ino) | |||
1050 | (ino >= EXT4_FIRST_INO(sb) && | 1050 | (ino >= EXT4_FIRST_INO(sb) && |
1051 | ino <= le32_to_cpu(EXT4_SB(sb)->s_es->s_inodes_count)); | 1051 | ino <= le32_to_cpu(EXT4_SB(sb)->s_es->s_inodes_count)); |
1052 | } | 1052 | } |
1053 | |||
1054 | /* | ||
1055 | * Inode dynamic state flags | ||
1056 | */ | ||
1057 | enum { | ||
1058 | EXT4_STATE_JDATA, /* journaled data exists */ | ||
1059 | EXT4_STATE_NEW, /* inode is newly created */ | ||
1060 | EXT4_STATE_XATTR, /* has in-inode xattrs */ | ||
1061 | EXT4_STATE_NO_EXPAND, /* No space for expansion */ | ||
1062 | EXT4_STATE_DA_ALLOC_CLOSE, /* Alloc DA blks on close */ | ||
1063 | EXT4_STATE_EXT_MIGRATE, /* Inode is migrating */ | ||
1064 | EXT4_STATE_DIO_UNWRITTEN, /* need convert on dio done*/ | ||
1065 | }; | ||
1066 | |||
1067 | static inline int ext4_test_inode_state(struct inode *inode, int bit) | ||
1068 | { | ||
1069 | return test_bit(bit, &EXT4_I(inode)->i_state_flags); | ||
1070 | } | ||
1071 | |||
1072 | static inline void ext4_set_inode_state(struct inode *inode, int bit) | ||
1073 | { | ||
1074 | set_bit(bit, &EXT4_I(inode)->i_state_flags); | ||
1075 | } | ||
1076 | |||
1077 | static inline void ext4_clear_inode_state(struct inode *inode, int bit) | ||
1078 | { | ||
1079 | clear_bit(bit, &EXT4_I(inode)->i_state_flags); | ||
1080 | } | ||
1053 | #else | 1081 | #else |
1054 | /* Assume that user mode programs are passing in an ext4fs superblock, not | 1082 | /* Assume that user mode programs are passing in an ext4fs superblock, not |
1055 | * a kernel struct super_block. This will allow us to call the feature-test | 1083 | * a kernel struct super_block. This will allow us to call the feature-test |
@@ -1126,6 +1154,8 @@ static inline int ext4_valid_inum(struct super_block *sb, unsigned long ino) | |||
1126 | #define EXT4_FEATURE_INCOMPAT_64BIT 0x0080 | 1154 | #define EXT4_FEATURE_INCOMPAT_64BIT 0x0080 |
1127 | #define EXT4_FEATURE_INCOMPAT_MMP 0x0100 | 1155 | #define EXT4_FEATURE_INCOMPAT_MMP 0x0100 |
1128 | #define EXT4_FEATURE_INCOMPAT_FLEX_BG 0x0200 | 1156 | #define EXT4_FEATURE_INCOMPAT_FLEX_BG 0x0200 |
1157 | #define EXT4_FEATURE_INCOMPAT_EA_INODE 0x0400 /* EA in inode */ | ||
1158 | #define EXT4_FEATURE_INCOMPAT_DIRDATA 0x1000 /* data in dirent */ | ||
1129 | 1159 | ||
1130 | #define EXT4_FEATURE_COMPAT_SUPP EXT2_FEATURE_COMPAT_EXT_ATTR | 1160 | #define EXT4_FEATURE_COMPAT_SUPP EXT2_FEATURE_COMPAT_EXT_ATTR |
1131 | #define EXT4_FEATURE_INCOMPAT_SUPP (EXT4_FEATURE_INCOMPAT_FILETYPE| \ | 1161 | #define EXT4_FEATURE_INCOMPAT_SUPP (EXT4_FEATURE_INCOMPAT_FILETYPE| \ |
@@ -1439,7 +1469,7 @@ extern int ext4_block_truncate_page(handle_t *handle, | |||
1439 | struct address_space *mapping, loff_t from); | 1469 | struct address_space *mapping, loff_t from); |
1440 | extern int ext4_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf); | 1470 | extern int ext4_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf); |
1441 | extern qsize_t *ext4_get_reserved_space(struct inode *inode); | 1471 | extern qsize_t *ext4_get_reserved_space(struct inode *inode); |
1442 | extern int flush_aio_dio_completed_IO(struct inode *inode); | 1472 | extern int flush_completed_IO(struct inode *inode); |
1443 | extern void ext4_da_update_reserve_space(struct inode *inode, | 1473 | extern void ext4_da_update_reserve_space(struct inode *inode, |
1444 | int used, int quota_claim); | 1474 | int used, int quota_claim); |
1445 | /* ioctl.c */ | 1475 | /* ioctl.c */ |
@@ -1465,13 +1495,20 @@ extern int ext4_group_extend(struct super_block *sb, | |||
1465 | ext4_fsblk_t n_blocks_count); | 1495 | ext4_fsblk_t n_blocks_count); |
1466 | 1496 | ||
1467 | /* super.c */ | 1497 | /* super.c */ |
1468 | extern void ext4_error(struct super_block *, const char *, const char *, ...) | 1498 | extern void __ext4_error(struct super_block *, const char *, const char *, ...) |
1499 | __attribute__ ((format (printf, 3, 4))); | ||
1500 | #define ext4_error(sb, message...) __ext4_error(sb, __func__, ## message) | ||
1501 | extern void ext4_error_inode(const char *, struct inode *, const char *, ...) | ||
1502 | __attribute__ ((format (printf, 3, 4))); | ||
1503 | extern void ext4_error_file(const char *, struct file *, const char *, ...) | ||
1469 | __attribute__ ((format (printf, 3, 4))); | 1504 | __attribute__ ((format (printf, 3, 4))); |
1470 | extern void __ext4_std_error(struct super_block *, const char *, int); | 1505 | extern void __ext4_std_error(struct super_block *, const char *, int); |
1471 | extern void ext4_abort(struct super_block *, const char *, const char *, ...) | 1506 | extern void ext4_abort(struct super_block *, const char *, const char *, ...) |
1472 | __attribute__ ((format (printf, 3, 4))); | 1507 | __attribute__ ((format (printf, 3, 4))); |
1473 | extern void ext4_warning(struct super_block *, const char *, const char *, ...) | 1508 | extern void __ext4_warning(struct super_block *, const char *, |
1509 | const char *, ...) | ||
1474 | __attribute__ ((format (printf, 3, 4))); | 1510 | __attribute__ ((format (printf, 3, 4))); |
1511 | #define ext4_warning(sb, message...) __ext4_warning(sb, __func__, ## message) | ||
1475 | extern void ext4_msg(struct super_block *, const char *, const char *, ...) | 1512 | extern void ext4_msg(struct super_block *, const char *, const char *, ...) |
1476 | __attribute__ ((format (printf, 3, 4))); | 1513 | __attribute__ ((format (printf, 3, 4))); |
1477 | extern void ext4_grp_locked_error(struct super_block *, ext4_group_t, | 1514 | extern void ext4_grp_locked_error(struct super_block *, ext4_group_t, |
@@ -1744,7 +1781,7 @@ extern void ext4_ext_release(struct super_block *); | |||
1744 | extern long ext4_fallocate(struct inode *inode, int mode, loff_t offset, | 1781 | extern long ext4_fallocate(struct inode *inode, int mode, loff_t offset, |
1745 | loff_t len); | 1782 | loff_t len); |
1746 | extern int ext4_convert_unwritten_extents(struct inode *inode, loff_t offset, | 1783 | extern int ext4_convert_unwritten_extents(struct inode *inode, loff_t offset, |
1747 | loff_t len); | 1784 | ssize_t len); |
1748 | extern int ext4_get_blocks(handle_t *handle, struct inode *inode, | 1785 | extern int ext4_get_blocks(handle_t *handle, struct inode *inode, |
1749 | sector_t block, unsigned int max_blocks, | 1786 | sector_t block, unsigned int max_blocks, |
1750 | struct buffer_head *bh, int flags); | 1787 | struct buffer_head *bh, int flags); |
@@ -1756,6 +1793,15 @@ extern int ext4_move_extents(struct file *o_filp, struct file *d_filp, | |||
1756 | __u64 len, __u64 *moved_len); | 1793 | __u64 len, __u64 *moved_len); |
1757 | 1794 | ||
1758 | 1795 | ||
1796 | /* BH_Uninit flag: blocks are allocated but uninitialized on disk */ | ||
1797 | enum ext4_state_bits { | ||
1798 | BH_Uninit /* blocks are allocated but uninitialized on disk */ | ||
1799 | = BH_JBDPrivateStart, | ||
1800 | }; | ||
1801 | |||
1802 | BUFFER_FNS(Uninit, uninit) | ||
1803 | TAS_BUFFER_FNS(Uninit, uninit) | ||
1804 | |||
1759 | /* | 1805 | /* |
1760 | * Add new method to test wether block and inode bitmaps are properly | 1806 | * Add new method to test wether block and inode bitmaps are properly |
1761 | * initialized. With uninit_bg reading the block from disk is not enough | 1807 | * initialized. With uninit_bg reading the block from disk is not enough |
@@ -1773,6 +1819,8 @@ static inline void set_bitmap_uptodate(struct buffer_head *bh) | |||
1773 | set_bit(BH_BITMAP_UPTODATE, &(bh)->b_state); | 1819 | set_bit(BH_BITMAP_UPTODATE, &(bh)->b_state); |
1774 | } | 1820 | } |
1775 | 1821 | ||
1822 | #define in_range(b, first, len) ((b) >= (first) && (b) <= (first) + (len) - 1) | ||
1823 | |||
1776 | #endif /* __KERNEL__ */ | 1824 | #endif /* __KERNEL__ */ |
1777 | 1825 | ||
1778 | #endif /* _EXT4_H */ | 1826 | #endif /* _EXT4_H */ |