diff options
Diffstat (limited to 'fs/ext4/ext4.h')
-rw-r--r-- | fs/ext4/ext4.h | 93 |
1 files changed, 56 insertions, 37 deletions
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 94ce3d7a1c4b..bab2387fba43 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h | |||
@@ -62,8 +62,8 @@ | |||
62 | #define EXT4_ERROR_INODE_BLOCK(inode, block, fmt, a...) \ | 62 | #define EXT4_ERROR_INODE_BLOCK(inode, block, fmt, a...) \ |
63 | ext4_error_inode((inode), __func__, __LINE__, (block), (fmt), ## a) | 63 | ext4_error_inode((inode), __func__, __LINE__, (block), (fmt), ## a) |
64 | 64 | ||
65 | #define EXT4_ERROR_FILE(file, fmt, a...) \ | 65 | #define EXT4_ERROR_FILE(file, block, fmt, a...) \ |
66 | ext4_error_file(__func__, __LINE__, (file), (fmt), ## a) | 66 | ext4_error_file((file), __func__, __LINE__, (block), (fmt), ## a) |
67 | 67 | ||
68 | /* data type for block offset of block group */ | 68 | /* data type for block offset of block group */ |
69 | typedef int ext4_grpblk_t; | 69 | typedef int ext4_grpblk_t; |
@@ -561,22 +561,6 @@ struct ext4_new_group_data { | |||
561 | #define EXT4_IOC32_SETVERSION_OLD FS_IOC32_SETVERSION | 561 | #define EXT4_IOC32_SETVERSION_OLD FS_IOC32_SETVERSION |
562 | #endif | 562 | #endif |
563 | 563 | ||
564 | |||
565 | /* | ||
566 | * Mount options | ||
567 | */ | ||
568 | struct ext4_mount_options { | ||
569 | unsigned long s_mount_opt; | ||
570 | uid_t s_resuid; | ||
571 | gid_t s_resgid; | ||
572 | unsigned long s_commit_interval; | ||
573 | u32 s_min_batch_time, s_max_batch_time; | ||
574 | #ifdef CONFIG_QUOTA | ||
575 | int s_jquota_fmt; | ||
576 | char *s_qf_names[MAXQUOTAS]; | ||
577 | #endif | ||
578 | }; | ||
579 | |||
580 | /* Max physical block we can addres w/o extents */ | 564 | /* Max physical block we can addres w/o extents */ |
581 | #define EXT4_MAX_BLOCK_FILE_PHYS 0xFFFFFFFF | 565 | #define EXT4_MAX_BLOCK_FILE_PHYS 0xFFFFFFFF |
582 | 566 | ||
@@ -709,6 +693,8 @@ do { \ | |||
709 | if (EXT4_FITS_IN_INODE(raw_inode, EXT4_I(inode), xtime ## _extra)) \ | 693 | if (EXT4_FITS_IN_INODE(raw_inode, EXT4_I(inode), xtime ## _extra)) \ |
710 | ext4_decode_extra_time(&(inode)->xtime, \ | 694 | ext4_decode_extra_time(&(inode)->xtime, \ |
711 | raw_inode->xtime ## _extra); \ | 695 | raw_inode->xtime ## _extra); \ |
696 | else \ | ||
697 | (inode)->xtime.tv_nsec = 0; \ | ||
712 | } while (0) | 698 | } while (0) |
713 | 699 | ||
714 | #define EXT4_EINODE_GET_XTIME(xtime, einode, raw_inode) \ | 700 | #define EXT4_EINODE_GET_XTIME(xtime, einode, raw_inode) \ |
@@ -719,6 +705,8 @@ do { \ | |||
719 | if (EXT4_FITS_IN_INODE(raw_inode, einode, xtime ## _extra)) \ | 705 | if (EXT4_FITS_IN_INODE(raw_inode, einode, xtime ## _extra)) \ |
720 | ext4_decode_extra_time(&(einode)->xtime, \ | 706 | ext4_decode_extra_time(&(einode)->xtime, \ |
721 | raw_inode->xtime ## _extra); \ | 707 | raw_inode->xtime ## _extra); \ |
708 | else \ | ||
709 | (einode)->xtime.tv_nsec = 0; \ | ||
722 | } while (0) | 710 | } while (0) |
723 | 711 | ||
724 | #define i_disk_version osd1.linux1.l_i_version | 712 | #define i_disk_version osd1.linux1.l_i_version |
@@ -750,12 +738,13 @@ do { \ | |||
750 | 738 | ||
751 | /* | 739 | /* |
752 | * storage for cached extent | 740 | * storage for cached extent |
741 | * If ec_len == 0, then the cache is invalid. | ||
742 | * If ec_start == 0, then the cache represents a gap (null mapping) | ||
753 | */ | 743 | */ |
754 | struct ext4_ext_cache { | 744 | struct ext4_ext_cache { |
755 | ext4_fsblk_t ec_start; | 745 | ext4_fsblk_t ec_start; |
756 | ext4_lblk_t ec_block; | 746 | ext4_lblk_t ec_block; |
757 | __u32 ec_len; /* must be 32bit to return holes */ | 747 | __u32 ec_len; /* must be 32bit to return holes */ |
758 | __u32 ec_type; | ||
759 | }; | 748 | }; |
760 | 749 | ||
761 | /* | 750 | /* |
@@ -774,10 +763,12 @@ struct ext4_inode_info { | |||
774 | * near to their parent directory's inode. | 763 | * near to their parent directory's inode. |
775 | */ | 764 | */ |
776 | ext4_group_t i_block_group; | 765 | ext4_group_t i_block_group; |
766 | ext4_lblk_t i_dir_start_lookup; | ||
767 | #if (BITS_PER_LONG < 64) | ||
777 | unsigned long i_state_flags; /* Dynamic state flags */ | 768 | unsigned long i_state_flags; /* Dynamic state flags */ |
769 | #endif | ||
778 | unsigned long i_flags; | 770 | unsigned long i_flags; |
779 | 771 | ||
780 | ext4_lblk_t i_dir_start_lookup; | ||
781 | #ifdef CONFIG_EXT4_FS_XATTR | 772 | #ifdef CONFIG_EXT4_FS_XATTR |
782 | /* | 773 | /* |
783 | * Extended attributes can be read independently of the main file | 774 | * Extended attributes can be read independently of the main file |
@@ -820,7 +811,7 @@ struct ext4_inode_info { | |||
820 | */ | 811 | */ |
821 | struct rw_semaphore i_data_sem; | 812 | struct rw_semaphore i_data_sem; |
822 | struct inode vfs_inode; | 813 | struct inode vfs_inode; |
823 | struct jbd2_inode jinode; | 814 | struct jbd2_inode *jinode; |
824 | 815 | ||
825 | struct ext4_ext_cache i_cached_extent; | 816 | struct ext4_ext_cache i_cached_extent; |
826 | /* | 817 | /* |
@@ -840,14 +831,12 @@ struct ext4_inode_info { | |||
840 | unsigned int i_reserved_data_blocks; | 831 | unsigned int i_reserved_data_blocks; |
841 | unsigned int i_reserved_meta_blocks; | 832 | unsigned int i_reserved_meta_blocks; |
842 | unsigned int i_allocated_meta_blocks; | 833 | unsigned int i_allocated_meta_blocks; |
843 | unsigned short i_delalloc_reserved_flag; | 834 | ext4_lblk_t i_da_metadata_calc_last_lblock; |
844 | sector_t i_da_metadata_calc_last_lblock; | ||
845 | int i_da_metadata_calc_len; | 835 | int i_da_metadata_calc_len; |
846 | 836 | ||
847 | /* on-disk additional length */ | 837 | /* on-disk additional length */ |
848 | __u16 i_extra_isize; | 838 | __u16 i_extra_isize; |
849 | 839 | ||
850 | spinlock_t i_block_reservation_lock; | ||
851 | #ifdef CONFIG_QUOTA | 840 | #ifdef CONFIG_QUOTA |
852 | /* quota space reservation, managed internally by quota code */ | 841 | /* quota space reservation, managed internally by quota code */ |
853 | qsize_t i_reserved_quota; | 842 | qsize_t i_reserved_quota; |
@@ -856,9 +845,11 @@ struct ext4_inode_info { | |||
856 | /* completed IOs that might need unwritten extents handling */ | 845 | /* completed IOs that might need unwritten extents handling */ |
857 | struct list_head i_completed_io_list; | 846 | struct list_head i_completed_io_list; |
858 | spinlock_t i_completed_io_lock; | 847 | spinlock_t i_completed_io_lock; |
848 | atomic_t i_ioend_count; /* Number of outstanding io_end structs */ | ||
859 | /* current io_end structure for async DIO write*/ | 849 | /* current io_end structure for async DIO write*/ |
860 | ext4_io_end_t *cur_aio_dio; | 850 | ext4_io_end_t *cur_aio_dio; |
861 | atomic_t i_ioend_count; /* Number of outstanding io_end structs */ | 851 | |
852 | spinlock_t i_block_reservation_lock; | ||
862 | 853 | ||
863 | /* | 854 | /* |
864 | * Transactions that contain inode's metadata needed to complete | 855 | * Transactions that contain inode's metadata needed to complete |
@@ -917,11 +908,20 @@ struct ext4_inode_info { | |||
917 | #define EXT4_MOUNT_DISCARD 0x40000000 /* Issue DISCARD requests */ | 908 | #define EXT4_MOUNT_DISCARD 0x40000000 /* Issue DISCARD requests */ |
918 | #define EXT4_MOUNT_INIT_INODE_TABLE 0x80000000 /* Initialize uninitialized itables */ | 909 | #define EXT4_MOUNT_INIT_INODE_TABLE 0x80000000 /* Initialize uninitialized itables */ |
919 | 910 | ||
920 | #define clear_opt(o, opt) o &= ~EXT4_MOUNT_##opt | 911 | #define clear_opt(sb, opt) EXT4_SB(sb)->s_mount_opt &= \ |
921 | #define set_opt(o, opt) o |= EXT4_MOUNT_##opt | 912 | ~EXT4_MOUNT_##opt |
913 | #define set_opt(sb, opt) EXT4_SB(sb)->s_mount_opt |= \ | ||
914 | EXT4_MOUNT_##opt | ||
922 | #define test_opt(sb, opt) (EXT4_SB(sb)->s_mount_opt & \ | 915 | #define test_opt(sb, opt) (EXT4_SB(sb)->s_mount_opt & \ |
923 | EXT4_MOUNT_##opt) | 916 | EXT4_MOUNT_##opt) |
924 | 917 | ||
918 | #define clear_opt2(sb, opt) EXT4_SB(sb)->s_mount_opt2 &= \ | ||
919 | ~EXT4_MOUNT2_##opt | ||
920 | #define set_opt2(sb, opt) EXT4_SB(sb)->s_mount_opt2 |= \ | ||
921 | EXT4_MOUNT2_##opt | ||
922 | #define test_opt2(sb, opt) (EXT4_SB(sb)->s_mount_opt2 & \ | ||
923 | EXT4_MOUNT2_##opt) | ||
924 | |||
925 | #define ext4_set_bit ext2_set_bit | 925 | #define ext4_set_bit ext2_set_bit |
926 | #define ext4_set_bit_atomic ext2_set_bit_atomic | 926 | #define ext4_set_bit_atomic ext2_set_bit_atomic |
927 | #define ext4_clear_bit ext2_clear_bit | 927 | #define ext4_clear_bit ext2_clear_bit |
@@ -1087,6 +1087,7 @@ struct ext4_sb_info { | |||
1087 | struct ext4_super_block *s_es; /* Pointer to the super block in the buffer */ | 1087 | struct ext4_super_block *s_es; /* Pointer to the super block in the buffer */ |
1088 | struct buffer_head **s_group_desc; | 1088 | struct buffer_head **s_group_desc; |
1089 | unsigned int s_mount_opt; | 1089 | unsigned int s_mount_opt; |
1090 | unsigned int s_mount_opt2; | ||
1090 | unsigned int s_mount_flags; | 1091 | unsigned int s_mount_flags; |
1091 | ext4_fsblk_t s_sb_block; | 1092 | ext4_fsblk_t s_sb_block; |
1092 | uid_t s_resuid; | 1093 | uid_t s_resuid; |
@@ -1237,24 +1238,39 @@ enum { | |||
1237 | EXT4_STATE_EXT_MIGRATE, /* Inode is migrating */ | 1238 | EXT4_STATE_EXT_MIGRATE, /* Inode is migrating */ |
1238 | EXT4_STATE_DIO_UNWRITTEN, /* need convert on dio done*/ | 1239 | EXT4_STATE_DIO_UNWRITTEN, /* need convert on dio done*/ |
1239 | EXT4_STATE_NEWENTRY, /* File just added to dir */ | 1240 | EXT4_STATE_NEWENTRY, /* File just added to dir */ |
1241 | EXT4_STATE_DELALLOC_RESERVED, /* blks already reserved for delalloc */ | ||
1240 | }; | 1242 | }; |
1241 | 1243 | ||
1242 | #define EXT4_INODE_BIT_FNS(name, field) \ | 1244 | #define EXT4_INODE_BIT_FNS(name, field, offset) \ |
1243 | static inline int ext4_test_inode_##name(struct inode *inode, int bit) \ | 1245 | static inline int ext4_test_inode_##name(struct inode *inode, int bit) \ |
1244 | { \ | 1246 | { \ |
1245 | return test_bit(bit, &EXT4_I(inode)->i_##field); \ | 1247 | return test_bit(bit + (offset), &EXT4_I(inode)->i_##field); \ |
1246 | } \ | 1248 | } \ |
1247 | static inline void ext4_set_inode_##name(struct inode *inode, int bit) \ | 1249 | static inline void ext4_set_inode_##name(struct inode *inode, int bit) \ |
1248 | { \ | 1250 | { \ |
1249 | set_bit(bit, &EXT4_I(inode)->i_##field); \ | 1251 | set_bit(bit + (offset), &EXT4_I(inode)->i_##field); \ |
1250 | } \ | 1252 | } \ |
1251 | static inline void ext4_clear_inode_##name(struct inode *inode, int bit) \ | 1253 | static inline void ext4_clear_inode_##name(struct inode *inode, int bit) \ |
1252 | { \ | 1254 | { \ |
1253 | clear_bit(bit, &EXT4_I(inode)->i_##field); \ | 1255 | clear_bit(bit + (offset), &EXT4_I(inode)->i_##field); \ |
1254 | } | 1256 | } |
1255 | 1257 | ||
1256 | EXT4_INODE_BIT_FNS(flag, flags) | 1258 | EXT4_INODE_BIT_FNS(flag, flags, 0) |
1257 | EXT4_INODE_BIT_FNS(state, state_flags) | 1259 | #if (BITS_PER_LONG < 64) |
1260 | EXT4_INODE_BIT_FNS(state, state_flags, 0) | ||
1261 | |||
1262 | static inline void ext4_clear_state_flags(struct ext4_inode_info *ei) | ||
1263 | { | ||
1264 | (ei)->i_state_flags = 0; | ||
1265 | } | ||
1266 | #else | ||
1267 | EXT4_INODE_BIT_FNS(state, flags, 32) | ||
1268 | |||
1269 | static inline void ext4_clear_state_flags(struct ext4_inode_info *ei) | ||
1270 | { | ||
1271 | /* We depend on the fact that callers will set i_flags */ | ||
1272 | } | ||
1273 | #endif | ||
1258 | #else | 1274 | #else |
1259 | /* Assume that user mode programs are passing in an ext4fs superblock, not | 1275 | /* Assume that user mode programs are passing in an ext4fs superblock, not |
1260 | * a kernel struct super_block. This will allow us to call the feature-test | 1276 | * a kernel struct super_block. This will allow us to call the feature-test |
@@ -1642,10 +1658,12 @@ extern unsigned ext4_init_block_bitmap(struct super_block *sb, | |||
1642 | 1658 | ||
1643 | /* dir.c */ | 1659 | /* dir.c */ |
1644 | extern int __ext4_check_dir_entry(const char *, unsigned int, struct inode *, | 1660 | extern int __ext4_check_dir_entry(const char *, unsigned int, struct inode *, |
1661 | struct file *, | ||
1645 | struct ext4_dir_entry_2 *, | 1662 | struct ext4_dir_entry_2 *, |
1646 | struct buffer_head *, unsigned int); | 1663 | struct buffer_head *, unsigned int); |
1647 | #define ext4_check_dir_entry(dir, de, bh, offset) \ | 1664 | #define ext4_check_dir_entry(dir, filp, de, bh, offset) \ |
1648 | __ext4_check_dir_entry(__func__, __LINE__, (dir), (de), (bh), (offset)) | 1665 | unlikely(__ext4_check_dir_entry(__func__, __LINE__, (dir), (filp), \ |
1666 | (de), (bh), (offset))) | ||
1649 | extern int ext4_htree_store_dirent(struct file *dir_file, __u32 hash, | 1667 | extern int ext4_htree_store_dirent(struct file *dir_file, __u32 hash, |
1650 | __u32 minor_hash, | 1668 | __u32 minor_hash, |
1651 | struct ext4_dir_entry_2 *dirent); | 1669 | struct ext4_dir_entry_2 *dirent); |
@@ -1653,6 +1671,7 @@ extern void ext4_htree_free_dir_info(struct dir_private_info *p); | |||
1653 | 1671 | ||
1654 | /* fsync.c */ | 1672 | /* fsync.c */ |
1655 | extern int ext4_sync_file(struct file *, int); | 1673 | extern int ext4_sync_file(struct file *, int); |
1674 | extern int ext4_flush_completed_IO(struct inode *); | ||
1656 | 1675 | ||
1657 | /* hash.c */ | 1676 | /* hash.c */ |
1658 | extern int ext4fs_dirhash(const char *name, int len, struct | 1677 | extern int ext4fs_dirhash(const char *name, int len, struct |
@@ -1752,8 +1771,8 @@ extern void ext4_error_inode(struct inode *, const char *, unsigned int, | |||
1752 | ext4_fsblk_t, const char *, ...) | 1771 | ext4_fsblk_t, const char *, ...) |
1753 | __attribute__ ((format (printf, 5, 6))); | 1772 | __attribute__ ((format (printf, 5, 6))); |
1754 | extern void ext4_error_file(struct file *, const char *, unsigned int, | 1773 | extern void ext4_error_file(struct file *, const char *, unsigned int, |
1755 | const char *, ...) | 1774 | ext4_fsblk_t, const char *, ...) |
1756 | __attribute__ ((format (printf, 4, 5))); | 1775 | __attribute__ ((format (printf, 5, 6))); |
1757 | extern void __ext4_std_error(struct super_block *, const char *, | 1776 | extern void __ext4_std_error(struct super_block *, const char *, |
1758 | unsigned int, int); | 1777 | unsigned int, int); |
1759 | extern void __ext4_abort(struct super_block *, const char *, unsigned int, | 1778 | extern void __ext4_abort(struct super_block *, const char *, unsigned int, |