diff options
Diffstat (limited to 'fs/ext4/ext4.h')
-rw-r--r-- | fs/ext4/ext4.h | 99 |
1 files changed, 86 insertions, 13 deletions
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index cc7ca4e87144..1c127213363a 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h | |||
@@ -378,14 +378,22 @@ struct flex_groups { | |||
378 | #define EXT4_PROJINHERIT_FL 0x20000000 /* Create with parents projid */ | 378 | #define EXT4_PROJINHERIT_FL 0x20000000 /* Create with parents projid */ |
379 | #define EXT4_RESERVED_FL 0x80000000 /* reserved for ext4 lib */ | 379 | #define EXT4_RESERVED_FL 0x80000000 /* reserved for ext4 lib */ |
380 | 380 | ||
381 | #define EXT4_FL_USER_VISIBLE 0x004BDFFF /* User visible flags */ | 381 | #define EXT4_FL_USER_VISIBLE 0x304BDFFF /* User visible flags */ |
382 | #define EXT4_FL_USER_MODIFIABLE 0x004380FF /* User modifiable flags */ | 382 | #define EXT4_FL_USER_MODIFIABLE 0x204380FF /* User modifiable flags */ |
383 | |||
384 | #define EXT4_FL_XFLAG_VISIBLE (EXT4_SYNC_FL | \ | ||
385 | EXT4_IMMUTABLE_FL | \ | ||
386 | EXT4_APPEND_FL | \ | ||
387 | EXT4_NODUMP_FL | \ | ||
388 | EXT4_NOATIME_FL | \ | ||
389 | EXT4_PROJINHERIT_FL) | ||
383 | 390 | ||
384 | /* Flags that should be inherited by new inodes from their parent. */ | 391 | /* Flags that should be inherited by new inodes from their parent. */ |
385 | #define EXT4_FL_INHERITED (EXT4_SECRM_FL | EXT4_UNRM_FL | EXT4_COMPR_FL |\ | 392 | #define EXT4_FL_INHERITED (EXT4_SECRM_FL | EXT4_UNRM_FL | EXT4_COMPR_FL |\ |
386 | EXT4_SYNC_FL | EXT4_NODUMP_FL | EXT4_NOATIME_FL |\ | 393 | EXT4_SYNC_FL | EXT4_NODUMP_FL | EXT4_NOATIME_FL |\ |
387 | EXT4_NOCOMPR_FL | EXT4_JOURNAL_DATA_FL |\ | 394 | EXT4_NOCOMPR_FL | EXT4_JOURNAL_DATA_FL |\ |
388 | EXT4_NOTAIL_FL | EXT4_DIRSYNC_FL) | 395 | EXT4_NOTAIL_FL | EXT4_DIRSYNC_FL |\ |
396 | EXT4_PROJINHERIT_FL) | ||
389 | 397 | ||
390 | /* Flags that are appropriate for regular files (all but dir-specific ones). */ | 398 | /* Flags that are appropriate for regular files (all but dir-specific ones). */ |
391 | #define EXT4_REG_FLMASK (~(EXT4_DIRSYNC_FL | EXT4_TOPDIR_FL)) | 399 | #define EXT4_REG_FLMASK (~(EXT4_DIRSYNC_FL | EXT4_TOPDIR_FL)) |
@@ -555,10 +563,12 @@ enum { | |||
555 | #define EXT4_GET_BLOCKS_NO_NORMALIZE 0x0040 | 563 | #define EXT4_GET_BLOCKS_NO_NORMALIZE 0x0040 |
556 | /* Request will not result in inode size update (user for fallocate) */ | 564 | /* Request will not result in inode size update (user for fallocate) */ |
557 | #define EXT4_GET_BLOCKS_KEEP_SIZE 0x0080 | 565 | #define EXT4_GET_BLOCKS_KEEP_SIZE 0x0080 |
558 | /* Do not take i_data_sem locking in ext4_map_blocks */ | ||
559 | #define EXT4_GET_BLOCKS_NO_LOCK 0x0100 | ||
560 | /* Convert written extents to unwritten */ | 566 | /* Convert written extents to unwritten */ |
561 | #define EXT4_GET_BLOCKS_CONVERT_UNWRITTEN 0x0200 | 567 | #define EXT4_GET_BLOCKS_CONVERT_UNWRITTEN 0x0100 |
568 | /* Write zeros to newly created written extents */ | ||
569 | #define EXT4_GET_BLOCKS_ZERO 0x0200 | ||
570 | #define EXT4_GET_BLOCKS_CREATE_ZERO (EXT4_GET_BLOCKS_CREATE |\ | ||
571 | EXT4_GET_BLOCKS_ZERO) | ||
562 | 572 | ||
563 | /* | 573 | /* |
564 | * The bit position of these flags must not overlap with any of the | 574 | * The bit position of these flags must not overlap with any of the |
@@ -616,6 +626,46 @@ enum { | |||
616 | #define EXT4_IOC_GET_ENCRYPTION_PWSALT _IOW('f', 20, __u8[16]) | 626 | #define EXT4_IOC_GET_ENCRYPTION_PWSALT _IOW('f', 20, __u8[16]) |
617 | #define EXT4_IOC_GET_ENCRYPTION_POLICY _IOW('f', 21, struct ext4_encryption_policy) | 627 | #define EXT4_IOC_GET_ENCRYPTION_POLICY _IOW('f', 21, struct ext4_encryption_policy) |
618 | 628 | ||
629 | #ifndef FS_IOC_FSGETXATTR | ||
630 | /* Until the uapi changes get merged for project quota... */ | ||
631 | |||
632 | #define FS_IOC_FSGETXATTR _IOR('X', 31, struct fsxattr) | ||
633 | #define FS_IOC_FSSETXATTR _IOW('X', 32, struct fsxattr) | ||
634 | |||
635 | /* | ||
636 | * Structure for FS_IOC_FSGETXATTR and FS_IOC_FSSETXATTR. | ||
637 | */ | ||
638 | struct fsxattr { | ||
639 | __u32 fsx_xflags; /* xflags field value (get/set) */ | ||
640 | __u32 fsx_extsize; /* extsize field value (get/set)*/ | ||
641 | __u32 fsx_nextents; /* nextents field value (get) */ | ||
642 | __u32 fsx_projid; /* project identifier (get/set) */ | ||
643 | unsigned char fsx_pad[12]; | ||
644 | }; | ||
645 | |||
646 | /* | ||
647 | * Flags for the fsx_xflags field | ||
648 | */ | ||
649 | #define FS_XFLAG_REALTIME 0x00000001 /* data in realtime volume */ | ||
650 | #define FS_XFLAG_PREALLOC 0x00000002 /* preallocated file extents */ | ||
651 | #define FS_XFLAG_IMMUTABLE 0x00000008 /* file cannot be modified */ | ||
652 | #define FS_XFLAG_APPEND 0x00000010 /* all writes append */ | ||
653 | #define FS_XFLAG_SYNC 0x00000020 /* all writes synchronous */ | ||
654 | #define FS_XFLAG_NOATIME 0x00000040 /* do not update access time */ | ||
655 | #define FS_XFLAG_NODUMP 0x00000080 /* do not include in backups */ | ||
656 | #define FS_XFLAG_RTINHERIT 0x00000100 /* create with rt bit set */ | ||
657 | #define FS_XFLAG_PROJINHERIT 0x00000200 /* create with parents projid */ | ||
658 | #define FS_XFLAG_NOSYMLINKS 0x00000400 /* disallow symlink creation */ | ||
659 | #define FS_XFLAG_EXTSIZE 0x00000800 /* extent size allocator hint */ | ||
660 | #define FS_XFLAG_EXTSZINHERIT 0x00001000 /* inherit inode extent size */ | ||
661 | #define FS_XFLAG_NODEFRAG 0x00002000 /* do not defragment */ | ||
662 | #define FS_XFLAG_FILESTREAM 0x00004000 /* use filestream allocator */ | ||
663 | #define FS_XFLAG_HASATTR 0x80000000 /* no DIFLAG for this */ | ||
664 | #endif /* !defined(FS_IOC_FSGETXATTR) */ | ||
665 | |||
666 | #define EXT4_IOC_FSGETXATTR FS_IOC_FSGETXATTR | ||
667 | #define EXT4_IOC_FSSETXATTR FS_IOC_FSSETXATTR | ||
668 | |||
619 | #if defined(__KERNEL__) && defined(CONFIG_COMPAT) | 669 | #if defined(__KERNEL__) && defined(CONFIG_COMPAT) |
620 | /* | 670 | /* |
621 | * ioctl commands in 32 bit emulation | 671 | * ioctl commands in 32 bit emulation |
@@ -910,6 +960,15 @@ struct ext4_inode_info { | |||
910 | * by other means, so we have i_data_sem. | 960 | * by other means, so we have i_data_sem. |
911 | */ | 961 | */ |
912 | struct rw_semaphore i_data_sem; | 962 | struct rw_semaphore i_data_sem; |
963 | /* | ||
964 | * i_mmap_sem is for serializing page faults with truncate / punch hole | ||
965 | * operations. We have to make sure that new page cannot be faulted in | ||
966 | * a section of the inode that is being punched. We cannot easily use | ||
967 | * i_data_sem for this since we need protection for the whole punch | ||
968 | * operation and i_data_sem ranks below transaction start so we have | ||
969 | * to occasionally drop it. | ||
970 | */ | ||
971 | struct rw_semaphore i_mmap_sem; | ||
913 | struct inode vfs_inode; | 972 | struct inode vfs_inode; |
914 | struct jbd2_inode *jinode; | 973 | struct jbd2_inode *jinode; |
915 | 974 | ||
@@ -993,6 +1052,7 @@ struct ext4_inode_info { | |||
993 | /* Encryption params */ | 1052 | /* Encryption params */ |
994 | struct ext4_crypt_info *i_crypt_info; | 1053 | struct ext4_crypt_info *i_crypt_info; |
995 | #endif | 1054 | #endif |
1055 | kprojid_t i_projid; | ||
996 | }; | 1056 | }; |
997 | 1057 | ||
998 | /* | 1058 | /* |
@@ -1248,7 +1308,7 @@ struct ext4_super_block { | |||
1248 | #endif | 1308 | #endif |
1249 | 1309 | ||
1250 | /* Number of quota types we support */ | 1310 | /* Number of quota types we support */ |
1251 | #define EXT4_MAXQUOTAS 2 | 1311 | #define EXT4_MAXQUOTAS 3 |
1252 | 1312 | ||
1253 | /* | 1313 | /* |
1254 | * fourth extended-fs super-block data in memory | 1314 | * fourth extended-fs super-block data in memory |
@@ -1754,7 +1814,8 @@ EXT4_FEATURE_INCOMPAT_FUNCS(encrypt, ENCRYPT) | |||
1754 | EXT4_FEATURE_RO_COMPAT_HUGE_FILE |\ | 1814 | EXT4_FEATURE_RO_COMPAT_HUGE_FILE |\ |
1755 | EXT4_FEATURE_RO_COMPAT_BIGALLOC |\ | 1815 | EXT4_FEATURE_RO_COMPAT_BIGALLOC |\ |
1756 | EXT4_FEATURE_RO_COMPAT_METADATA_CSUM|\ | 1816 | EXT4_FEATURE_RO_COMPAT_METADATA_CSUM|\ |
1757 | EXT4_FEATURE_RO_COMPAT_QUOTA) | 1817 | EXT4_FEATURE_RO_COMPAT_QUOTA |\ |
1818 | EXT4_FEATURE_RO_COMPAT_PROJECT) | ||
1758 | 1819 | ||
1759 | #define EXTN_FEATURE_FUNCS(ver) \ | 1820 | #define EXTN_FEATURE_FUNCS(ver) \ |
1760 | static inline bool ext4_has_unknown_ext##ver##_compat_features(struct super_block *sb) \ | 1821 | static inline bool ext4_has_unknown_ext##ver##_compat_features(struct super_block *sb) \ |
@@ -1796,6 +1857,11 @@ static inline bool ext4_has_incompat_features(struct super_block *sb) | |||
1796 | #define EXT4_DEF_RESUID 0 | 1857 | #define EXT4_DEF_RESUID 0 |
1797 | #define EXT4_DEF_RESGID 0 | 1858 | #define EXT4_DEF_RESGID 0 |
1798 | 1859 | ||
1860 | /* | ||
1861 | * Default project ID | ||
1862 | */ | ||
1863 | #define EXT4_DEF_PROJID 0 | ||
1864 | |||
1799 | #define EXT4_DEF_INODE_READAHEAD_BLKS 32 | 1865 | #define EXT4_DEF_INODE_READAHEAD_BLKS 32 |
1800 | 1866 | ||
1801 | /* | 1867 | /* |
@@ -2234,7 +2300,8 @@ void ext4_restore_control_page(struct page *data_page); | |||
2234 | struct page *ext4_encrypt(struct inode *inode, | 2300 | struct page *ext4_encrypt(struct inode *inode, |
2235 | struct page *plaintext_page); | 2301 | struct page *plaintext_page); |
2236 | int ext4_decrypt(struct page *page); | 2302 | int ext4_decrypt(struct page *page); |
2237 | int ext4_encrypted_zeroout(struct inode *inode, struct ext4_extent *ex); | 2303 | int ext4_encrypted_zeroout(struct inode *inode, ext4_lblk_t lblk, |
2304 | ext4_fsblk_t pblk, ext4_lblk_t len); | ||
2238 | 2305 | ||
2239 | #ifdef CONFIG_EXT4_FS_ENCRYPTION | 2306 | #ifdef CONFIG_EXT4_FS_ENCRYPTION |
2240 | int ext4_init_crypto(void); | 2307 | int ext4_init_crypto(void); |
@@ -2440,8 +2507,8 @@ struct buffer_head *ext4_getblk(handle_t *, struct inode *, ext4_lblk_t, int); | |||
2440 | struct buffer_head *ext4_bread(handle_t *, struct inode *, ext4_lblk_t, int); | 2507 | struct buffer_head *ext4_bread(handle_t *, struct inode *, ext4_lblk_t, int); |
2441 | int ext4_get_block_write(struct inode *inode, sector_t iblock, | 2508 | int ext4_get_block_write(struct inode *inode, sector_t iblock, |
2442 | struct buffer_head *bh_result, int create); | 2509 | struct buffer_head *bh_result, int create); |
2443 | int ext4_get_block_dax(struct inode *inode, sector_t iblock, | 2510 | int ext4_dax_mmap_get_block(struct inode *inode, sector_t iblock, |
2444 | struct buffer_head *bh_result, int create); | 2511 | struct buffer_head *bh_result, int create); |
2445 | int ext4_get_block(struct inode *inode, sector_t iblock, | 2512 | int ext4_get_block(struct inode *inode, sector_t iblock, |
2446 | struct buffer_head *bh_result, int create); | 2513 | struct buffer_head *bh_result, int create); |
2447 | int ext4_da_get_block_prep(struct inode *inode, sector_t iblock, | 2514 | int ext4_da_get_block_prep(struct inode *inode, sector_t iblock, |
@@ -2484,9 +2551,13 @@ extern int ext4_chunk_trans_blocks(struct inode *, int nrblocks); | |||
2484 | extern int ext4_zero_partial_blocks(handle_t *handle, struct inode *inode, | 2551 | extern int ext4_zero_partial_blocks(handle_t *handle, struct inode *inode, |
2485 | loff_t lstart, loff_t lend); | 2552 | loff_t lstart, loff_t lend); |
2486 | extern int ext4_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf); | 2553 | extern int ext4_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf); |
2554 | extern int ext4_filemap_fault(struct vm_area_struct *vma, struct vm_fault *vmf); | ||
2487 | extern qsize_t *ext4_get_reserved_space(struct inode *inode); | 2555 | extern qsize_t *ext4_get_reserved_space(struct inode *inode); |
2556 | extern int ext4_get_projid(struct inode *inode, kprojid_t *projid); | ||
2488 | extern void ext4_da_update_reserve_space(struct inode *inode, | 2557 | extern void ext4_da_update_reserve_space(struct inode *inode, |
2489 | int used, int quota_claim); | 2558 | int used, int quota_claim); |
2559 | extern int ext4_issue_zeroout(struct inode *inode, ext4_lblk_t lblk, | ||
2560 | ext4_fsblk_t pblk, ext4_lblk_t len); | ||
2490 | 2561 | ||
2491 | /* indirect.c */ | 2562 | /* indirect.c */ |
2492 | extern int ext4_ind_map_blocks(handle_t *handle, struct inode *inode, | 2563 | extern int ext4_ind_map_blocks(handle_t *handle, struct inode *inode, |
@@ -2848,6 +2919,9 @@ static inline int ext4_update_inode_size(struct inode *inode, loff_t newsize) | |||
2848 | return changed; | 2919 | return changed; |
2849 | } | 2920 | } |
2850 | 2921 | ||
2922 | int ext4_update_disksize_before_punch(struct inode *inode, loff_t offset, | ||
2923 | loff_t len); | ||
2924 | |||
2851 | struct ext4_group_info { | 2925 | struct ext4_group_info { |
2852 | unsigned long bb_state; | 2926 | unsigned long bb_state; |
2853 | struct rb_root bb_free_root; | 2927 | struct rb_root bb_free_root; |
@@ -2986,8 +3060,7 @@ extern int ext4_da_write_inline_data_end(struct inode *inode, loff_t pos, | |||
2986 | struct page *page); | 3060 | struct page *page); |
2987 | extern int ext4_try_add_inline_entry(handle_t *handle, | 3061 | extern int ext4_try_add_inline_entry(handle_t *handle, |
2988 | struct ext4_filename *fname, | 3062 | struct ext4_filename *fname, |
2989 | struct dentry *dentry, | 3063 | struct inode *dir, struct inode *inode); |
2990 | struct inode *inode); | ||
2991 | extern int ext4_try_create_inline_dir(handle_t *handle, | 3064 | extern int ext4_try_create_inline_dir(handle_t *handle, |
2992 | struct inode *parent, | 3065 | struct inode *parent, |
2993 | struct inode *inode); | 3066 | struct inode *inode); |