hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/fs/ext4/ext4.h
....@@ -27,7 +27,6 @@
2727 #include <linux/seqlock.h>
2828 #include <linux/mutex.h>
2929 #include <linux/timer.h>
30
-#include <linux/version.h>
3130 #include <linux/wait.h>
3231 #include <linux/sched/signal.h>
3332 #include <linux/blockgroup_lock.h>
....@@ -36,6 +35,7 @@
3635 #include <crypto/hash.h>
3736 #include <linux/falloc.h>
3837 #include <linux/percpu-rwsem.h>
38
+#include <linux/fiemap.h>
3939 #ifdef __KERNEL__
4040 #include <linux/compat.h>
4141 #endif
....@@ -44,15 +44,6 @@
4444 #include <linux/fsverity.h>
4545
4646 #include <linux/compiler.h>
47
-
48
-/* Until this gets included into linux/compiler-gcc.h */
49
-#ifndef __nonstring
50
-#if defined(GCC_VERSION) && (GCC_VERSION >= 80000)
51
-#define __nonstring __attribute__((nonstring))
52
-#else
53
-#define __nonstring
54
-#endif
55
-#endif
5647
5748 /*
5849 * The fourth extended filesystem constants/structures
....@@ -89,14 +80,22 @@
8980 #define ext4_debug(fmt, ...) no_printk(fmt, ##__VA_ARGS__)
9081 #endif
9182
92
-/*
93
- * Turn on EXT_DEBUG to get lots of info about extents operations.
94
- */
83
+ /*
84
+ * Turn on EXT_DEBUG to enable ext4_ext_show_path/leaf/move in extents.c
85
+ */
9586 #define EXT_DEBUG__
96
-#ifdef EXT_DEBUG
97
-#define ext_debug(fmt, ...) printk(fmt, ##__VA_ARGS__)
87
+
88
+/*
89
+ * Dynamic printk for controlled extents debugging.
90
+ */
91
+#ifdef CONFIG_EXT4_DEBUG
92
+#define ext_debug(ino, fmt, ...) \
93
+ pr_debug("[%s/%d] EXT4-fs (%s): ino %lu: (%s, %d): %s:" fmt, \
94
+ current->comm, task_pid_nr(current), \
95
+ ino->i_sb->s_id, ino->i_ino, __FILE__, __LINE__, \
96
+ __func__, ##__VA_ARGS__)
9897 #else
99
-#define ext_debug(fmt, ...) no_printk(fmt, ##__VA_ARGS__)
98
+#define ext_debug(ino, fmt, ...) no_printk(fmt, ##__VA_ARGS__)
10099 #endif
101100
102101 /* data type for block offset of block group */
....@@ -151,6 +150,8 @@
151150 #define EXT4_MB_USE_ROOT_BLOCKS 0x1000
152151 /* Use blocks from reserved pool */
153152 #define EXT4_MB_USE_RESERVED 0x2000
153
+/* Do strict check for free blocks while retrying block allocation */
154
+#define EXT4_MB_STRICT_CHECK 0x4000
154155
155156 struct ext4_allocation_request {
156157 /* target inode for block we're allocating */
....@@ -180,10 +181,10 @@
180181 * well as to store the information returned by ext4_map_blocks(). It
181182 * takes less room on the stack than a struct buffer_head.
182183 */
183
-#define EXT4_MAP_NEW (1 << BH_New)
184
-#define EXT4_MAP_MAPPED (1 << BH_Mapped)
185
-#define EXT4_MAP_UNWRITTEN (1 << BH_Unwritten)
186
-#define EXT4_MAP_BOUNDARY (1 << BH_Boundary)
184
+#define EXT4_MAP_NEW BIT(BH_New)
185
+#define EXT4_MAP_MAPPED BIT(BH_Mapped)
186
+#define EXT4_MAP_UNWRITTEN BIT(BH_Unwritten)
187
+#define EXT4_MAP_BOUNDARY BIT(BH_Boundary)
187188 #define EXT4_MAP_FLAGS (EXT4_MAP_NEW | EXT4_MAP_MAPPED |\
188189 EXT4_MAP_UNWRITTEN | EXT4_MAP_BOUNDARY)
189190
....@@ -207,6 +208,12 @@
207208 */
208209 #define EXT4_IO_END_UNWRITTEN 0x0001
209210
211
+struct ext4_io_end_vec {
212
+ struct list_head list; /* list of io_end_vec */
213
+ loff_t offset; /* offset in the file */
214
+ ssize_t size; /* size of the extent */
215
+};
216
+
210217 /*
211218 * For converting unwritten extents on a work queue. 'handle' is used for
212219 * buffered writeback.
....@@ -220,8 +227,7 @@
220227 * bios covering the extent */
221228 unsigned int flag; /* unwritten or not */
222229 atomic_t count; /* reference counter */
223
- loff_t offset; /* offset in the file */
224
- ssize_t size; /* size of the extent */
230
+ struct list_head list_vec; /* list of ext4_io_end_vec */
225231 } ext4_io_end_t;
226232
227233 struct ext4_io_submit {
....@@ -302,6 +308,9 @@
302308 ~((ext4_fsblk_t) (s)->s_cluster_ratio - 1))
303309 #define EXT4_LBLK_CMASK(s, lblk) ((lblk) & \
304310 ~((ext4_lblk_t) (s)->s_cluster_ratio - 1))
311
+/* Fill in the low bits to get the last block of the cluster */
312
+#define EXT4_LBLK_CFILL(sbi, lblk) ((lblk) | \
313
+ ((ext4_lblk_t) (sbi)->s_cluster_ratio - 1))
305314 /* Get the cluster offset */
306315 #define EXT4_PBLK_COFF(s, pblk) ((pblk) & \
307316 ((ext4_fsblk_t) (s)->s_cluster_ratio - 1))
....@@ -415,38 +424,74 @@
415424 #define EXT4_EXTENTS_FL 0x00080000 /* Inode uses extents */
416425 #define EXT4_VERITY_FL 0x00100000 /* Verity protected inode */
417426 #define EXT4_EA_INODE_FL 0x00200000 /* Inode used for large EA */
418
-#define EXT4_EOFBLOCKS_FL 0x00400000 /* Blocks allocated beyond EOF */
427
+/* 0x00400000 was formerly EXT4_EOFBLOCKS_FL */
428
+
429
+#define EXT4_DAX_FL 0x02000000 /* Inode is DAX */
430
+
419431 #define EXT4_INLINE_DATA_FL 0x10000000 /* Inode has inline data. */
420432 #define EXT4_PROJINHERIT_FL 0x20000000 /* Create with parents projid */
421
-#define EXT4_CASEFOLD_FL 0x40000000 /* Casefolded file */
433
+#define EXT4_CASEFOLD_FL 0x40000000 /* Casefolded directory */
422434 #define EXT4_RESERVED_FL 0x80000000 /* reserved for ext4 lib */
423435
424
-#define EXT4_FL_USER_VISIBLE 0x705BDFFF /* User visible flags */
425
-#define EXT4_FL_USER_MODIFIABLE 0x604BC0FF /* User modifiable flags */
436
+/* User modifiable flags */
437
+#define EXT4_FL_USER_MODIFIABLE (EXT4_SECRM_FL | \
438
+ EXT4_UNRM_FL | \
439
+ EXT4_COMPR_FL | \
440
+ EXT4_SYNC_FL | \
441
+ EXT4_IMMUTABLE_FL | \
442
+ EXT4_APPEND_FL | \
443
+ EXT4_NODUMP_FL | \
444
+ EXT4_NOATIME_FL | \
445
+ EXT4_JOURNAL_DATA_FL | \
446
+ EXT4_NOTAIL_FL | \
447
+ EXT4_DIRSYNC_FL | \
448
+ EXT4_TOPDIR_FL | \
449
+ EXT4_EXTENTS_FL | \
450
+ 0x00400000 /* EXT4_EOFBLOCKS_FL */ | \
451
+ EXT4_DAX_FL | \
452
+ EXT4_PROJINHERIT_FL | \
453
+ EXT4_CASEFOLD_FL)
426454
427
-/* Flags we can manipulate with through EXT4_IOC_FSSETXATTR */
455
+/* User visible flags */
456
+#define EXT4_FL_USER_VISIBLE (EXT4_FL_USER_MODIFIABLE | \
457
+ EXT4_DIRTY_FL | \
458
+ EXT4_COMPRBLK_FL | \
459
+ EXT4_NOCOMPR_FL | \
460
+ EXT4_ENCRYPT_FL | \
461
+ EXT4_INDEX_FL | \
462
+ EXT4_VERITY_FL | \
463
+ EXT4_INLINE_DATA_FL)
464
+
465
+/* Flags we can manipulate with through FS_IOC_FSSETXATTR */
428466 #define EXT4_FL_XFLAG_VISIBLE (EXT4_SYNC_FL | \
429467 EXT4_IMMUTABLE_FL | \
430468 EXT4_APPEND_FL | \
431469 EXT4_NODUMP_FL | \
432470 EXT4_NOATIME_FL | \
433
- EXT4_PROJINHERIT_FL)
471
+ EXT4_PROJINHERIT_FL | \
472
+ EXT4_DAX_FL)
434473
435474 /* Flags that should be inherited by new inodes from their parent. */
436475 #define EXT4_FL_INHERITED (EXT4_SECRM_FL | EXT4_UNRM_FL | EXT4_COMPR_FL |\
437476 EXT4_SYNC_FL | EXT4_NODUMP_FL | EXT4_NOATIME_FL |\
438477 EXT4_NOCOMPR_FL | EXT4_JOURNAL_DATA_FL |\
439478 EXT4_NOTAIL_FL | EXT4_DIRSYNC_FL |\
440
- EXT4_PROJINHERIT_FL | EXT4_CASEFOLD_FL)
479
+ EXT4_PROJINHERIT_FL | EXT4_CASEFOLD_FL |\
480
+ EXT4_DAX_FL)
441481
442482 /* Flags that are appropriate for regular files (all but dir-specific ones). */
443
-#define EXT4_REG_FLMASK (~(EXT4_DIRSYNC_FL | EXT4_TOPDIR_FL | EXT4_CASEFOLD_FL))
483
+#define EXT4_REG_FLMASK (~(EXT4_DIRSYNC_FL | EXT4_TOPDIR_FL | EXT4_CASEFOLD_FL |\
484
+ EXT4_PROJINHERIT_FL))
444485
445486 /* Flags that are appropriate for non-directories/regular files. */
446487 #define EXT4_OTHER_FLMASK (EXT4_NODUMP_FL | EXT4_NOATIME_FL)
447488
448489 /* The only flags that should be swapped */
449490 #define EXT4_FL_SHOULD_SWAP (EXT4_HUGE_FILE_FL | EXT4_EXTENTS_FL)
491
+
492
+/* Flags which are mutually exclusive to DAX */
493
+#define EXT4_DAX_MUT_EXCL (EXT4_VERITY_FL | EXT4_ENCRYPT_FL |\
494
+ EXT4_JOURNAL_DATA_FL | EXT4_INLINE_DATA_FL)
450495
451496 /* Mask out flags that are inappropriate for the given type of inode. */
452497 static inline __u32 ext4_mask_flags(umode_t mode, __u32 flags)
....@@ -487,9 +532,11 @@
487532 EXT4_INODE_EXTENTS = 19, /* Inode uses extents */
488533 EXT4_INODE_VERITY = 20, /* Verity protected inode */
489534 EXT4_INODE_EA_INODE = 21, /* Inode used for large EA */
490
- EXT4_INODE_EOFBLOCKS = 22, /* Blocks allocated beyond EOF */
535
+/* 22 was formerly EXT4_INODE_EOFBLOCKS */
536
+ EXT4_INODE_DAX = 25, /* Inode is DAX */
491537 EXT4_INODE_INLINE_DATA = 28, /* Data in inode. */
492538 EXT4_INODE_PROJINHERIT = 29, /* Create with parents projid */
539
+ EXT4_INODE_CASEFOLD = 30, /* Casefolded directory */
493540 EXT4_INODE_RESERVED = 31, /* reserved for ext4 lib */
494541 };
495542
....@@ -506,7 +553,7 @@
506553 *
507554 * It's not paranoia if the Murphy's Law really *is* out to get you. :-)
508555 */
509
-#define TEST_FLAG_VALUE(FLAG) (EXT4_##FLAG##_FL == (1 << EXT4_INODE_##FLAG))
556
+#define TEST_FLAG_VALUE(FLAG) (EXT4_##FLAG##_FL == (1U << EXT4_INODE_##FLAG))
510557 #define CHECK_FLAG_VALUE(FLAG) BUILD_BUG_ON(!TEST_FLAG_VALUE(FLAG))
511558
512559 static inline void ext4_check_flag_values(void)
....@@ -533,9 +580,9 @@
533580 CHECK_FLAG_VALUE(EXTENTS);
534581 CHECK_FLAG_VALUE(VERITY);
535582 CHECK_FLAG_VALUE(EA_INODE);
536
- CHECK_FLAG_VALUE(EOFBLOCKS);
537583 CHECK_FLAG_VALUE(INLINE_DATA);
538584 CHECK_FLAG_VALUE(PROJINHERIT);
585
+ CHECK_FLAG_VALUE(CASEFOLD);
539586 CHECK_FLAG_VALUE(RESERVED);
540587 }
541588
....@@ -610,8 +657,6 @@
610657 #define EXT4_GET_BLOCKS_METADATA_NOFAIL 0x0020
611658 /* Don't normalize allocation size (used for fallocate) */
612659 #define EXT4_GET_BLOCKS_NO_NORMALIZE 0x0040
613
- /* Request will not result in inode size update (user for fallocate) */
614
-#define EXT4_GET_BLOCKS_KEEP_SIZE 0x0080
615660 /* Convert written extents to unwritten */
616661 #define EXT4_GET_BLOCKS_CONVERT_UNWRITTEN 0x0100
617662 /* Write zeros to newly created written extents */
....@@ -633,6 +678,7 @@
633678 */
634679 #define EXT4_EX_NOCACHE 0x40000000
635680 #define EXT4_EX_FORCE_CACHE 0x20000000
681
+#define EXT4_EX_NOFAIL 0x10000000
636682
637683 /*
638684 * Flags used by ext4_free_blocks
....@@ -643,12 +689,11 @@
643689 #define EXT4_FREE_BLOCKS_NO_QUOT_UPDATE 0x0008
644690 #define EXT4_FREE_BLOCKS_NOFREE_FIRST_CLUSTER 0x0010
645691 #define EXT4_FREE_BLOCKS_NOFREE_LAST_CLUSTER 0x0020
692
+#define EXT4_FREE_BLOCKS_RERESERVE_CLUSTER 0x0040
646693
647694 /*
648695 * ioctl commands
649696 */
650
-#define EXT4_IOC_GETFLAGS FS_IOC_GETFLAGS
651
-#define EXT4_IOC_SETFLAGS FS_IOC_SETFLAGS
652697 #define EXT4_IOC_GETVERSION _IOR('f', 3, long)
653698 #define EXT4_IOC_SETVERSION _IOW('f', 4, long)
654699 #define EXT4_IOC_GETVERSION_OLD FS_IOC_GETVERSION
....@@ -665,12 +710,10 @@
665710 #define EXT4_IOC_RESIZE_FS _IOW('f', 16, __u64)
666711 #define EXT4_IOC_SWAP_BOOT _IO('f', 17)
667712 #define EXT4_IOC_PRECACHE_EXTENTS _IO('f', 18)
668
-#define EXT4_IOC_SET_ENCRYPTION_POLICY FS_IOC_SET_ENCRYPTION_POLICY
669
-#define EXT4_IOC_GET_ENCRYPTION_PWSALT FS_IOC_GET_ENCRYPTION_PWSALT
670
-#define EXT4_IOC_GET_ENCRYPTION_POLICY FS_IOC_GET_ENCRYPTION_POLICY
671
-
672
-#define EXT4_IOC_FSGETXATTR FS_IOC_FSGETXATTR
673
-#define EXT4_IOC_FSSETXATTR FS_IOC_FSSETXATTR
713
+/* ioctl codes 19--39 are reserved for fscrypt */
714
+#define EXT4_IOC_CLEAR_ES_CACHE _IO('f', 40)
715
+#define EXT4_IOC_GETSTATE _IOW('f', 41, __u32)
716
+#define EXT4_IOC_GET_ES_CACHE _IOWR('f', 42, struct fiemap)
674717
675718 #define EXT4_IOC_SHUTDOWN _IOR ('X', 125, __u32)
676719
....@@ -681,13 +724,21 @@
681724 #define EXT4_GOING_FLAGS_LOGFLUSH 0x1 /* flush log but not data */
682725 #define EXT4_GOING_FLAGS_NOLOGFLUSH 0x2 /* don't flush log nor data */
683726
727
+/*
728
+ * Flags returned by EXT4_IOC_GETSTATE
729
+ *
730
+ * We only expose to userspace a subset of the state flags in
731
+ * i_state_flags
732
+ */
733
+#define EXT4_STATE_FLAG_EXT_PRECACHED 0x00000001
734
+#define EXT4_STATE_FLAG_NEW 0x00000002
735
+#define EXT4_STATE_FLAG_NEWENTRY 0x00000004
736
+#define EXT4_STATE_FLAG_DA_ALLOC_CLOSE 0x00000008
684737
685738 #if defined(__KERNEL__) && defined(CONFIG_COMPAT)
686739 /*
687740 * ioctl commands in 32 bit emulation
688741 */
689
-#define EXT4_IOC32_GETFLAGS FS_IOC32_GETFLAGS
690
-#define EXT4_IOC32_SETFLAGS FS_IOC32_SETFLAGS
691742 #define EXT4_IOC32_GETVERSION _IOR('f', 3, int)
692743 #define EXT4_IOC32_SETVERSION _IOW('f', 4, int)
693744 #define EXT4_IOC32_GETRSVSZ _IOR('f', 5, int)
....@@ -698,11 +749,17 @@
698749 #define EXT4_IOC32_SETVERSION_OLD FS_IOC32_SETVERSION
699750 #endif
700751
752
+/*
753
+ * Returned by EXT4_IOC_GET_ES_CACHE as an additional possible flag.
754
+ * It indicates that the entry in extent status cache is for a hole.
755
+ */
756
+#define EXT4_FIEMAP_EXTENT_HOLE 0x08000000
757
+
701758 /* Max physical block we can address w/o extents */
702759 #define EXT4_MAX_BLOCK_FILE_PHYS 0xFFFFFFFF
703760
704761 /* Max logical block we can support */
705
-#define EXT4_MAX_LOGICAL_BLOCK 0xFFFFFFFF
762
+#define EXT4_MAX_LOGICAL_BLOCK 0xFFFFFFFE
706763
707764 /*
708765 * Structure of an inode on the disk
....@@ -827,31 +884,20 @@
827884 static inline void ext4_decode_extra_time(struct timespec64 *time,
828885 __le32 extra)
829886 {
830
- if (unlikely(extra & cpu_to_le32(EXT4_EPOCH_MASK))) {
831
-
832
-#if 1
833
- /* Handle legacy encoding of pre-1970 dates with epoch
834
- * bits 1,1. (This backwards compatibility may be removed
835
- * at the discretion of the ext4 developers.)
836
- */
837
- u64 extra_bits = le32_to_cpu(extra) & EXT4_EPOCH_MASK;
838
- if (extra_bits == 3 && ((time->tv_sec) & 0x80000000) != 0)
839
- extra_bits = 0;
840
- time->tv_sec += extra_bits << 32;
841
-#else
887
+ if (unlikely(extra & cpu_to_le32(EXT4_EPOCH_MASK)))
842888 time->tv_sec += (u64)(le32_to_cpu(extra) & EXT4_EPOCH_MASK) << 32;
843
-#endif
844
- }
845889 time->tv_nsec = (le32_to_cpu(extra) & EXT4_NSEC_MASK) >> EXT4_EPOCH_BITS;
846890 }
847891
848892 #define EXT4_INODE_SET_XTIME(xtime, inode, raw_inode) \
849893 do { \
850
- (raw_inode)->xtime = cpu_to_le32((inode)->xtime.tv_sec); \
851894 if (EXT4_FITS_IN_INODE(raw_inode, EXT4_I(inode), xtime ## _extra)) {\
895
+ (raw_inode)->xtime = cpu_to_le32((inode)->xtime.tv_sec); \
852896 (raw_inode)->xtime ## _extra = \
853897 ext4_encode_extra_time(&(inode)->xtime); \
854898 } \
899
+ else \
900
+ (raw_inode)->xtime = cpu_to_le32(clamp_t(int32_t, (inode)->xtime.tv_sec, S32_MIN, S32_MAX)); \
855901 } while (0)
856902
857903 #define EXT4_EINODE_SET_XTIME(xtime, einode, raw_inode) \
....@@ -917,6 +963,7 @@
917963 #endif /* defined(__KERNEL__) || defined(__linux__) */
918964
919965 #include "extents_status.h"
966
+#include "fast_commit.h"
920967
921968 /*
922969 * Lock subclasses for i_data_sem in the ext4_inode_info structure.
....@@ -933,11 +980,13 @@
933980 * where the second inode has larger inode number
934981 * than the first
935982 * I_DATA_SEM_QUOTA - Used for quota inodes only
983
+ * I_DATA_SEM_EA - Used for ea_inodes only
936984 */
937985 enum {
938986 I_DATA_SEM_NORMAL = 0,
939987 I_DATA_SEM_OTHER,
940988 I_DATA_SEM_QUOTA,
989
+ I_DATA_SEM_EA
941990 };
942991
943992
....@@ -973,6 +1022,28 @@
9731022 struct rw_semaphore xattr_sem;
9741023
9751024 struct list_head i_orphan; /* unlinked but open inodes */
1025
+
1026
+ /* Fast commit related info */
1027
+
1028
+ struct list_head i_fc_list; /*
1029
+ * inodes that need fast commit
1030
+ * protected by sbi->s_fc_lock.
1031
+ */
1032
+
1033
+ /* Start of lblk range that needs to be committed in this fast commit */
1034
+ ext4_lblk_t i_fc_lblk_start;
1035
+
1036
+ /* End of lblk range that needs to be committed in this fast commit */
1037
+ ext4_lblk_t i_fc_lblk_len;
1038
+
1039
+ /* Number of ongoing updates on this inode */
1040
+ atomic_t i_fc_updates;
1041
+
1042
+ /* Fast commit wait queue for this inode */
1043
+ wait_queue_head_t i_fc_wait;
1044
+
1045
+ /* Protect concurrent accesses on i_fc_lblk_start, i_fc_lblk_len */
1046
+ struct mutex i_fc_lock;
9761047
9771048 /*
9781049 * i_disksize keeps track of what the inode size is ON DISK, not
....@@ -1023,6 +1094,7 @@
10231094 struct timespec64 i_crtime;
10241095
10251096 /* mballoc */
1097
+ atomic_t i_prealloc_active;
10261098 struct list_head i_prealloc_list;
10271099 spinlock_t i_prealloc_lock;
10281100
....@@ -1042,8 +1114,9 @@
10421114 /* allocation reservation info for delalloc */
10431115 /* In case of bigalloc, this refer to clusters rather than blocks */
10441116 unsigned int i_reserved_data_blocks;
1045
- ext4_lblk_t i_da_metadata_calc_last_lblock;
1046
- int i_da_metadata_calc_len;
1117
+
1118
+ /* pending cluster reservations for bigalloc file systems */
1119
+ struct ext4_pending_tree i_pending_tree;
10471120
10481121 /* on-disk additional length */
10491122 __u16 i_extra_isize;
....@@ -1092,6 +1165,7 @@
10921165 #define EXT4_VALID_FS 0x0001 /* Unmounted cleanly */
10931166 #define EXT4_ERROR_FS 0x0002 /* Errors detected */
10941167 #define EXT4_ORPHAN_FS 0x0004 /* Orphans being recovered */
1168
+#define EXT4_FC_REPLAY 0x0020 /* Fast commit replay ongoing */
10951169
10961170 /*
10971171 * Misc. filesystem flags
....@@ -1113,9 +1187,9 @@
11131187 #define EXT4_MOUNT_MINIX_DF 0x00080 /* Mimics the Minix statfs */
11141188 #define EXT4_MOUNT_NOLOAD 0x00100 /* Don't use existing journal*/
11151189 #ifdef CONFIG_FS_DAX
1116
-#define EXT4_MOUNT_DAX 0x00200 /* Direct Access */
1190
+#define EXT4_MOUNT_DAX_ALWAYS 0x00200 /* Direct Access */
11171191 #else
1118
-#define EXT4_MOUNT_DAX 0
1192
+#define EXT4_MOUNT_DAX_ALWAYS 0
11191193 #endif
11201194 #define EXT4_MOUNT_DATA_FLAGS 0x00C00 /* Mode for data writes: */
11211195 #define EXT4_MOUNT_JOURNAL_DATA 0x00400 /* Write data to journal */
....@@ -1140,7 +1214,7 @@
11401214 #define EXT4_MOUNT_JOURNAL_CHECKSUM 0x800000 /* Journal checksums */
11411215 #define EXT4_MOUNT_JOURNAL_ASYNC_COMMIT 0x1000000 /* Journal Async Commit */
11421216 #define EXT4_MOUNT_WARN_ON_ERROR 0x2000000 /* Trigger WARN_ON on error */
1143
-#define EXT4_MOUNT_INLINECRYPT 0x4000000 /* Inline encryption support */
1217
+#define EXT4_MOUNT_PREFETCH_BLOCK_BITMAPS 0x4000000
11441218 #define EXT4_MOUNT_DELALLOC 0x8000000 /* Delalloc support */
11451219 #define EXT4_MOUNT_DATA_ERR_ABORT 0x10000000 /* Abort on file data write */
11461220 #define EXT4_MOUNT_BLOCK_VALIDITY 0x20000000 /* Block validity checking */
....@@ -1159,9 +1233,13 @@
11591233 blocks */
11601234 #define EXT4_MOUNT2_HURD_COMPAT 0x00000004 /* Support HURD-castrated
11611235 file systems */
1162
-
11631236 #define EXT4_MOUNT2_EXPLICIT_JOURNAL_CHECKSUM 0x00000008 /* User explicitly
11641237 specified journal checksum */
1238
+
1239
+#define EXT4_MOUNT2_JOURNAL_FAST_COMMIT 0x00000010 /* Journal fast commit */
1240
+#define EXT4_MOUNT2_DAX_NEVER 0x00000020 /* Do not allow Direct Access */
1241
+#define EXT4_MOUNT2_DAX_INODE 0x00000040 /* For printing options only */
1242
+
11651243
11661244 #define clear_opt(sb, opt) EXT4_SB(sb)->s_mount_opt &= \
11671245 ~EXT4_MOUNT_##opt
....@@ -1331,7 +1409,8 @@
13311409 __u8 s_lastcheck_hi;
13321410 __u8 s_first_error_time_hi;
13331411 __u8 s_last_error_time_hi;
1334
- __u8 s_pad[2];
1412
+ __u8 s_first_error_errcode;
1413
+ __u8 s_last_error_errcode;
13351414 __le16 s_encoding; /* Filename charset encoding */
13361415 __le16 s_encoding_flags; /* Filename charset encoding flags */
13371416 __le32 s_reserved[95]; /* Padding to the end of the block */
....@@ -1341,18 +1420,6 @@
13411420 #define EXT4_S_ERR_LEN (EXT4_S_ERR_END - EXT4_S_ERR_START)
13421421
13431422 #ifdef __KERNEL__
1344
-
1345
-/*
1346
- * run-time mount flags
1347
- */
1348
-#define EXT4_MF_MNTDIR_SAMPLED 0x0001
1349
-#define EXT4_MF_FS_ABORTED 0x0002 /* Fatal error detected */
1350
-
1351
-#ifdef CONFIG_FS_ENCRYPTION
1352
-#define DUMMY_ENCRYPTION_ENABLED(sbi) ((sbi)->s_dummy_enc_ctx.ctx != NULL)
1353
-#else
1354
-#define DUMMY_ENCRYPTION_ENABLED(sbi) (0)
1355
-#endif
13561423
13571424 /* Number of quota types we support */
13581425 #define EXT4_MAXQUOTAS 3
....@@ -1382,7 +1449,7 @@
13821449 struct buffer_head * __rcu *s_group_desc;
13831450 unsigned int s_mount_opt;
13841451 unsigned int s_mount_opt2;
1385
- unsigned int s_mount_flags;
1452
+ unsigned long s_mount_flags;
13861453 unsigned int s_def_mount_opt;
13871454 ext4_fsblk_t s_sb_block;
13881455 atomic64_t s_resv_clusters;
....@@ -1403,11 +1470,13 @@
14031470 struct percpu_counter s_freeinodes_counter;
14041471 struct percpu_counter s_dirs_counter;
14051472 struct percpu_counter s_dirtyclusters_counter;
1473
+ struct percpu_counter s_sra_exceeded_retry_limit;
14061474 struct blockgroup_lock *s_blockgroup_lock;
14071475 struct proc_dir_entry *s_proc;
14081476 struct kobject s_kobj;
14091477 struct completion s_kobj_unregister;
14101478 struct super_block *s_sb;
1479
+ struct buffer_head *s_mmp_bh;
14111480
14121481 /* Journaling */
14131482 struct journal_s *s_journal;
....@@ -1417,14 +1486,14 @@
14171486 unsigned long s_commit_interval;
14181487 u32 s_max_batch_time;
14191488 u32 s_min_batch_time;
1420
- struct block_device *journal_bdev;
1489
+ struct block_device *s_journal_bdev;
14211490 #ifdef CONFIG_QUOTA
14221491 /* Names of quota files with journalled quota */
14231492 char __rcu *s_qf_names[EXT4_MAXQUOTAS];
14241493 int s_jquota_fmt; /* Format of quota to use */
14251494 #endif
14261495 unsigned int s_want_extra_isize; /* New inodes should reserve # bytes */
1427
- struct ext4_system_blocks __rcu *system_blks;
1496
+ struct ext4_system_blocks __rcu *s_system_blks;
14281497
14291498 #ifdef EXTENTS_STATS
14301499 /* ext4 extents stats */
....@@ -1455,22 +1524,28 @@
14551524 unsigned int s_mb_stats;
14561525 unsigned int s_mb_order2_reqs;
14571526 unsigned int s_mb_group_prealloc;
1527
+ unsigned int s_mb_max_inode_prealloc;
14581528 unsigned int s_max_dir_size_kb;
14591529 /* where last allocation was done - for stream allocation */
14601530 unsigned long s_mb_last_group;
14611531 unsigned long s_mb_last_start;
1532
+ unsigned int s_mb_prefetch;
1533
+ unsigned int s_mb_prefetch_limit;
14621534
14631535 /* stats for buddy allocator */
14641536 atomic_t s_bal_reqs; /* number of reqs with len > 1 */
14651537 atomic_t s_bal_success; /* we found long enough chunks */
14661538 atomic_t s_bal_allocated; /* in blocks */
14671539 atomic_t s_bal_ex_scanned; /* total extents scanned */
1540
+ atomic_t s_bal_groups_scanned; /* number of groups scanned */
14681541 atomic_t s_bal_goals; /* goal hits */
14691542 atomic_t s_bal_breaks; /* too long searches */
14701543 atomic_t s_bal_2orders; /* 2^order hits */
1471
- spinlock_t s_bal_lock;
1472
- unsigned long s_mb_buddies_generated;
1473
- unsigned long long s_mb_generation_time;
1544
+ atomic64_t s_bal_cX_groups_considered[4];
1545
+ atomic64_t s_bal_cX_hits[4];
1546
+ atomic64_t s_bal_cX_failed[4]; /* cX loop didn't find blocks */
1547
+ atomic_t s_mb_buddies_generated; /* number of buddies generated */
1548
+ atomic64_t s_mb_generation_time;
14741549 atomic_t s_mb_lost_chunks;
14751550 atomic_t s_mb_preallocated;
14761551 atomic_t s_mb_discarded;
....@@ -1505,7 +1580,7 @@
15051580 struct task_struct *s_mmp_tsk;
15061581
15071582 /* record the last minlen when FITRIM is called. */
1508
- atomic_t s_last_trim_minblks;
1583
+ unsigned long s_last_trim_minblks;
15091584
15101585 /* Reference to checksum algorithm driver via cryptoapi */
15111586 struct crypto_shash *s_chksum_driver;
....@@ -1526,9 +1601,11 @@
15261601 struct ratelimit_state s_err_ratelimit_state;
15271602 struct ratelimit_state s_warning_ratelimit_state;
15281603 struct ratelimit_state s_msg_ratelimit_state;
1604
+ atomic_t s_warning_count;
1605
+ atomic_t s_msg_count;
15291606
1530
- /* Encryption context for '-o test_dummy_encryption' */
1531
- struct fscrypt_dummy_context s_dummy_enc_ctx;
1607
+ /* Encryption policy for '-o test_dummy_encryption' */
1608
+ struct fscrypt_dummy_policy s_dummy_enc_policy;
15321609
15331610 /*
15341611 * Barrier between writepages ops and changing any inode's JOURNAL_DATA
....@@ -1536,6 +1613,40 @@
15361613 */
15371614 struct percpu_rw_semaphore s_writepages_rwsem;
15381615 struct dax_device *s_daxdev;
1616
+#ifdef CONFIG_EXT4_DEBUG
1617
+ unsigned long s_simulate_fail;
1618
+#endif
1619
+ /* Record the errseq of the backing block device */
1620
+ errseq_t s_bdev_wb_err;
1621
+ spinlock_t s_bdev_wb_lock;
1622
+
1623
+ /* Ext4 fast commit stuff */
1624
+ atomic_t s_fc_subtid;
1625
+ atomic_t s_fc_ineligible_updates;
1626
+ /*
1627
+ * After commit starts, the main queue gets locked, and the further
1628
+ * updates get added in the staging queue.
1629
+ */
1630
+#define FC_Q_MAIN 0
1631
+#define FC_Q_STAGING 1
1632
+ struct list_head s_fc_q[2]; /* Inodes staged for fast commit
1633
+ * that have data changes in them.
1634
+ */
1635
+ struct list_head s_fc_dentry_q[2]; /* directory entry updates */
1636
+ unsigned int s_fc_bytes;
1637
+ /*
1638
+ * Main fast commit lock. This lock protects accesses to the
1639
+ * following fields:
1640
+ * ei->i_fc_list, s_fc_dentry_q, s_fc_q, s_fc_bytes, s_fc_bh.
1641
+ */
1642
+ spinlock_t s_fc_lock;
1643
+ struct buffer_head *s_fc_bh;
1644
+ struct ext4_fc_stats s_fc_stats;
1645
+ u64 s_fc_avg_commit_time;
1646
+#ifdef CONFIG_EXT4_DEBUG
1647
+ int s_fc_debug_max_replay;
1648
+#endif
1649
+ struct ext4_fc_replay_state s_fc_replay_state;
15391650 };
15401651
15411652 static inline struct ext4_sb_info *EXT4_SB(struct super_block *sb)
....@@ -1572,6 +1683,94 @@
15721683 })
15731684
15741685 /*
1686
+ * run-time mount flags
1687
+ */
1688
+enum {
1689
+ EXT4_MF_MNTDIR_SAMPLED,
1690
+ EXT4_MF_FS_ABORTED, /* Fatal error detected */
1691
+ EXT4_MF_FC_INELIGIBLE, /* Fast commit ineligible */
1692
+ EXT4_MF_FC_COMMITTING /* File system underoing a fast
1693
+ * commit.
1694
+ */
1695
+};
1696
+
1697
+static inline void ext4_set_mount_flag(struct super_block *sb, int bit)
1698
+{
1699
+ set_bit(bit, &EXT4_SB(sb)->s_mount_flags);
1700
+}
1701
+
1702
+static inline void ext4_clear_mount_flag(struct super_block *sb, int bit)
1703
+{
1704
+ clear_bit(bit, &EXT4_SB(sb)->s_mount_flags);
1705
+}
1706
+
1707
+static inline int ext4_test_mount_flag(struct super_block *sb, int bit)
1708
+{
1709
+ return test_bit(bit, &EXT4_SB(sb)->s_mount_flags);
1710
+}
1711
+
1712
+
1713
+/*
1714
+ * Simulate_fail codes
1715
+ */
1716
+#define EXT4_SIM_BBITMAP_EIO 1
1717
+#define EXT4_SIM_BBITMAP_CRC 2
1718
+#define EXT4_SIM_IBITMAP_EIO 3
1719
+#define EXT4_SIM_IBITMAP_CRC 4
1720
+#define EXT4_SIM_INODE_EIO 5
1721
+#define EXT4_SIM_INODE_CRC 6
1722
+#define EXT4_SIM_DIRBLOCK_EIO 7
1723
+#define EXT4_SIM_DIRBLOCK_CRC 8
1724
+
1725
+static inline bool ext4_simulate_fail(struct super_block *sb,
1726
+ unsigned long code)
1727
+{
1728
+#ifdef CONFIG_EXT4_DEBUG
1729
+ struct ext4_sb_info *sbi = EXT4_SB(sb);
1730
+
1731
+ if (unlikely(sbi->s_simulate_fail == code)) {
1732
+ sbi->s_simulate_fail = 0;
1733
+ return true;
1734
+ }
1735
+#endif
1736
+ return false;
1737
+}
1738
+
1739
+static inline void ext4_simulate_fail_bh(struct super_block *sb,
1740
+ struct buffer_head *bh,
1741
+ unsigned long code)
1742
+{
1743
+ if (!IS_ERR(bh) && ext4_simulate_fail(sb, code))
1744
+ clear_buffer_uptodate(bh);
1745
+}
1746
+
1747
+/*
1748
+ * Error number codes for s_{first,last}_error_errno
1749
+ *
1750
+ * Linux errno numbers are architecture specific, so we need to translate
1751
+ * them into something which is architecture independent. We don't define
1752
+ * codes for all errno's; just the ones which are most likely to be the cause
1753
+ * of an ext4_error() call.
1754
+ */
1755
+#define EXT4_ERR_UNKNOWN 1
1756
+#define EXT4_ERR_EIO 2
1757
+#define EXT4_ERR_ENOMEM 3
1758
+#define EXT4_ERR_EFSBADCRC 4
1759
+#define EXT4_ERR_EFSCORRUPTED 5
1760
+#define EXT4_ERR_ENOSPC 6
1761
+#define EXT4_ERR_ENOKEY 7
1762
+#define EXT4_ERR_EROFS 8
1763
+#define EXT4_ERR_EFBIG 9
1764
+#define EXT4_ERR_EEXIST 10
1765
+#define EXT4_ERR_ERANGE 11
1766
+#define EXT4_ERR_EOVERFLOW 12
1767
+#define EXT4_ERR_EBUSY 13
1768
+#define EXT4_ERR_ENOTDIR 14
1769
+#define EXT4_ERR_ENOTEMPTY 15
1770
+#define EXT4_ERR_ESHUTDOWN 16
1771
+#define EXT4_ERR_EFAULT 17
1772
+
1773
+/*
15751774 * Inode dynamic state flags
15761775 */
15771776 enum {
....@@ -1581,12 +1780,12 @@
15811780 EXT4_STATE_NO_EXPAND, /* No space for expansion */
15821781 EXT4_STATE_DA_ALLOC_CLOSE, /* Alloc DA blks on close */
15831782 EXT4_STATE_EXT_MIGRATE, /* Inode is migrating */
1584
- EXT4_STATE_DIO_UNWRITTEN, /* need convert on dio done*/
15851783 EXT4_STATE_NEWENTRY, /* File just added to dir */
15861784 EXT4_STATE_MAY_INLINE_DATA, /* may have in-inode data */
15871785 EXT4_STATE_EXT_PRECACHED, /* extents have been precached */
15881786 EXT4_STATE_LUSTRE_EA_INODE, /* Lustre-style ea_inode */
15891787 EXT4_STATE_VERITY_IN_PROGRESS, /* building fs-verity Merkle tree */
1788
+ EXT4_STATE_FC_COMMITTING, /* Fast commit ongoing */
15901789 };
15911790
15921791 #define EXT4_INODE_BIT_FNS(name, field, offset) \
....@@ -1665,6 +1864,10 @@
16651864
16661865 #define EXT4_GOOD_OLD_INODE_SIZE 128
16671866
1867
+#define EXT4_EXTRA_TIMESTAMP_MAX (((s64)1 << 34) - 1 + S32_MIN)
1868
+#define EXT4_NON_EXTRA_TIMESTAMP_MAX S32_MAX
1869
+#define EXT4_TIMESTAMP_MIN S32_MIN
1870
+
16681871 /*
16691872 * Feature set definitions
16701873 */
....@@ -1676,6 +1879,14 @@
16761879 #define EXT4_FEATURE_COMPAT_RESIZE_INODE 0x0010
16771880 #define EXT4_FEATURE_COMPAT_DIR_INDEX 0x0020
16781881 #define EXT4_FEATURE_COMPAT_SPARSE_SUPER2 0x0200
1882
+/*
1883
+ * The reason why "FAST_COMMIT" is a compat feature is that, FS becomes
1884
+ * incompatible only if fast commit blocks are present in the FS. Since we
1885
+ * clear the journal (and thus the fast commit blocks), we don't mark FS as
1886
+ * incompatible. We also have a JBD2 incompat feature, which gets set when
1887
+ * there are fast commit blocks present in the journal.
1888
+ */
1889
+#define EXT4_FEATURE_COMPAT_FAST_COMMIT 0x0400
16791890 #define EXT4_FEATURE_COMPAT_STABLE_INODES 0x0800
16801891
16811892 #define EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001
....@@ -1778,6 +1989,7 @@
17781989 EXT4_FEATURE_COMPAT_FUNCS(resize_inode, RESIZE_INODE)
17791990 EXT4_FEATURE_COMPAT_FUNCS(dir_index, DIR_INDEX)
17801991 EXT4_FEATURE_COMPAT_FUNCS(sparse_super2, SPARSE_SUPER2)
1992
+EXT4_FEATURE_COMPAT_FUNCS(fast_commit, FAST_COMMIT)
17811993 EXT4_FEATURE_COMPAT_FUNCS(stable_inodes, STABLE_INODES)
17821994
17831995 EXT4_FEATURE_RO_COMPAT_FUNCS(sparse_super, SPARSE_SUPER)
....@@ -1892,6 +2104,7 @@
18922104 */
18932105 #define EXT4_FLAGS_RESIZING 0
18942106 #define EXT4_FLAGS_SHUTDOWN 1
2107
+#define EXT4_FLAGS_BDEV_IS_DAX 2
18952108
18962109 static inline int ext4_forced_shutdown(struct ext4_sb_info *sbi)
18972110 {
....@@ -1945,6 +2158,10 @@
19452158 * Structure of a directory entry
19462159 */
19472160 #define EXT4_NAME_LEN 255
2161
+/*
2162
+ * Base length of the ext4 directory entry excluding the name length
2163
+ */
2164
+#define EXT4_BASE_DIR_LEN (sizeof(struct ext4_dir_entry_2) - EXT4_NAME_LEN)
19482165
19492166 struct ext4_dir_entry {
19502167 __le32 inode; /* Inode number */
....@@ -1974,7 +2191,7 @@
19742191 __le32 inode; /* Inode number */
19752192 __le16 rec_len; /* Directory entry length */
19762193 __u8 name_len; /* Name length */
1977
- __u8 file_type;
2194
+ __u8 file_type; /* See file type macros EXT4_FT_* below */
19782195 char name[EXT4_NAME_LEN]; /* File name */
19792196 };
19802197
....@@ -2122,7 +2339,6 @@
21222339 BUG_ON(crypto_shash_descsize(sbi->s_chksum_driver)!=sizeof(desc.ctx));
21232340
21242341 desc.shash.tfm = sbi->s_chksum_driver;
2125
- desc.shash.flags = 0;
21262342 *(u32 *)desc.ctx = crc;
21272343
21282344 BUG_ON(crypto_shash_update(&desc.shash, address, length));
....@@ -2244,9 +2460,15 @@
22442460 struct mutex li_list_mtx;
22452461 };
22462462
2463
+enum ext4_li_mode {
2464
+ EXT4_LI_MODE_PREFETCH_BBITMAP,
2465
+ EXT4_LI_MODE_ITABLE,
2466
+};
2467
+
22472468 struct ext4_li_request {
22482469 struct super_block *lr_super;
2249
- struct ext4_sb_info *lr_sbi;
2470
+ enum ext4_li_mode lr_mode;
2471
+ ext4_group_t lr_first_not_zeroed;
22502472 ext4_group_t lr_next_group;
22512473 struct list_head lr_request;
22522474 unsigned long lr_next_sched;
....@@ -2374,10 +2596,13 @@
23742596 extern struct ext4_group_desc * ext4_get_group_desc(struct super_block * sb,
23752597 ext4_group_t block_group,
23762598 struct buffer_head ** bh);
2599
+extern struct ext4_group_info *ext4_get_group_info(struct super_block *sb,
2600
+ ext4_group_t group);
23772601 extern int ext4_should_retry_alloc(struct super_block *sb, int *retries);
23782602
23792603 extern struct buffer_head *ext4_read_block_bitmap_nowait(struct super_block *sb,
2380
- ext4_group_t block_group);
2604
+ ext4_group_t block_group,
2605
+ bool ignore_locked);
23812606 extern int ext4_wait_block_bitmap(struct super_block *sb,
23822607 ext4_group_t block_group,
23832608 struct buffer_head *bh);
....@@ -2551,6 +2776,7 @@
25512776 struct dx_hash_info *hinfo);
25522777
25532778 /* ialloc.c */
2779
+extern int ext4_mark_inode_used(struct super_block *sb, int ino);
25542780 extern struct inode *__ext4_new_inode(handle_t *, struct inode *, umode_t,
25552781 const struct qstr *qstr, __u32 goal,
25562782 uid_t *owner, __u32 i_flags,
....@@ -2576,18 +2802,56 @@
25762802 ext4_group_t group, int barrier);
25772803 extern void ext4_end_bitmap_read(struct buffer_head *bh, int uptodate);
25782804
2805
+/* fast_commit.c */
2806
+int ext4_fc_info_show(struct seq_file *seq, void *v);
2807
+void ext4_fc_init(struct super_block *sb, journal_t *journal);
2808
+void ext4_fc_init_inode(struct inode *inode);
2809
+void ext4_fc_track_range(handle_t *handle, struct inode *inode, ext4_lblk_t start,
2810
+ ext4_lblk_t end);
2811
+void __ext4_fc_track_unlink(handle_t *handle, struct inode *inode,
2812
+ struct dentry *dentry);
2813
+void __ext4_fc_track_link(handle_t *handle, struct inode *inode,
2814
+ struct dentry *dentry);
2815
+void ext4_fc_track_unlink(handle_t *handle, struct dentry *dentry);
2816
+void ext4_fc_track_link(handle_t *handle, struct dentry *dentry);
2817
+void __ext4_fc_track_create(handle_t *handle, struct inode *inode,
2818
+ struct dentry *dentry);
2819
+void ext4_fc_track_create(handle_t *handle, struct dentry *dentry);
2820
+void ext4_fc_track_inode(handle_t *handle, struct inode *inode);
2821
+void ext4_fc_mark_ineligible(struct super_block *sb, int reason);
2822
+void ext4_fc_start_ineligible(struct super_block *sb, int reason);
2823
+void ext4_fc_stop_ineligible(struct super_block *sb);
2824
+void ext4_fc_start_update(struct inode *inode);
2825
+void ext4_fc_stop_update(struct inode *inode);
2826
+void ext4_fc_del(struct inode *inode);
2827
+bool ext4_fc_replay_check_excluded(struct super_block *sb, ext4_fsblk_t block);
2828
+void ext4_fc_replay_cleanup(struct super_block *sb);
2829
+int ext4_fc_commit(journal_t *journal, tid_t commit_tid);
2830
+int __init ext4_fc_init_dentry_cache(void);
2831
+void ext4_fc_destroy_dentry_cache(void);
2832
+int ext4_fc_record_regions(struct super_block *sb, int ino,
2833
+ ext4_lblk_t lblk, ext4_fsblk_t pblk,
2834
+ int len, int replay);
2835
+
25792836 /* mballoc.c */
25802837 extern const struct seq_operations ext4_mb_seq_groups_ops;
25812838 extern long ext4_mb_stats;
25822839 extern long ext4_mb_max_to_scan;
2840
+extern int ext4_seq_mb_stats_show(struct seq_file *seq, void *offset);
25832841 extern int ext4_mb_init(struct super_block *);
25842842 extern int ext4_mb_release(struct super_block *);
25852843 extern ext4_fsblk_t ext4_mb_new_blocks(handle_t *,
25862844 struct ext4_allocation_request *, int *);
25872845 extern int ext4_mb_reserve_blocks(struct super_block *, int);
2588
-extern void ext4_discard_preallocations(struct inode *);
2846
+extern void ext4_discard_preallocations(struct inode *, unsigned int);
25892847 extern int __init ext4_init_mballoc(void);
25902848 extern void ext4_exit_mballoc(void);
2849
+extern ext4_group_t ext4_mb_prefetch(struct super_block *sb,
2850
+ ext4_group_t group,
2851
+ unsigned int nr, int *cnt);
2852
+extern void ext4_mb_prefetch_fini(struct super_block *sb, ext4_group_t group,
2853
+ unsigned int nr);
2854
+
25912855 extern void ext4_free_blocks(handle_t *handle, struct inode *inode,
25922856 struct buffer_head *bh, ext4_fsblk_t block,
25932857 unsigned long count, int flags);
....@@ -2599,8 +2863,12 @@
25992863 ext4_fsblk_t block, unsigned long count);
26002864 extern int ext4_trim_fs(struct super_block *, struct fstrim_range *);
26012865 extern void ext4_process_freed_data(struct super_block *sb, tid_t commit_tid);
2866
+extern void ext4_mb_mark_bb(struct super_block *sb, ext4_fsblk_t block,
2867
+ int len, int state);
26022868
26032869 /* inode.c */
2870
+void ext4_inode_csum_set(struct inode *inode, struct ext4_inode *raw,
2871
+ struct ext4_inode_info *ei);
26042872 int ext4_inode_is_fast_symlink(struct inode *inode);
26052873 struct buffer_head *ext4_getblk(handle_t *, struct inode *, ext4_lblk_t, int);
26062874 struct buffer_head *ext4_bread(handle_t *, struct inode *, ext4_lblk_t, int);
....@@ -2610,8 +2878,6 @@
26102878 struct buffer_head *bh_result, int create);
26112879 int ext4_get_block(struct inode *inode, sector_t iblock,
26122880 struct buffer_head *bh_result, int create);
2613
-int ext4_dio_get_block(struct inode *inode, sector_t iblock,
2614
- struct buffer_head *bh_result, int create);
26152881 int ext4_da_get_block_prep(struct inode *inode, sector_t iblock,
26162882 struct buffer_head *bh, int create);
26172883 int ext4_walk_page_buffers(handle_t *handle,
....@@ -2629,7 +2895,9 @@
26292895 typedef enum {
26302896 EXT4_IGET_NORMAL = 0,
26312897 EXT4_IGET_SPECIAL = 0x0001, /* OK to iget a system inode */
2632
- EXT4_IGET_HANDLE = 0x0002 /* Inode # is from a handle */
2898
+ EXT4_IGET_HANDLE = 0x0002, /* Inode # is from a handle */
2899
+ EXT4_IGET_BAD = 0x0004, /* Allow to iget a bad inode */
2900
+ EXT4_IGET_EA_INODE = 0x0008 /* Inode should contain an EA value */
26332901 } ext4_iget_flags;
26342902
26352903 extern struct inode *__ext4_iget(struct super_block *sb, unsigned long ino,
....@@ -2649,23 +2917,25 @@
26492917 extern void ext4_dirty_inode(struct inode *, int);
26502918 extern int ext4_change_inode_journal_flag(struct inode *, int);
26512919 extern int ext4_get_inode_loc(struct inode *, struct ext4_iloc *);
2920
+extern int ext4_get_fc_inode_loc(struct super_block *sb, unsigned long ino,
2921
+ struct ext4_iloc *iloc);
26522922 extern int ext4_inode_attach_jinode(struct inode *inode);
26532923 extern int ext4_can_truncate(struct inode *inode);
26542924 extern int ext4_truncate(struct inode *);
26552925 extern int ext4_break_layouts(struct inode *);
2656
-extern int ext4_punch_hole(struct inode *inode, loff_t offset, loff_t length);
2657
-extern int ext4_truncate_restart_trans(handle_t *, struct inode *, int nblocks);
2658
-extern void ext4_set_inode_flags(struct inode *);
2926
+extern int ext4_punch_hole(struct file *file, loff_t offset, loff_t length);
2927
+extern void ext4_set_inode_flags(struct inode *, bool init);
26592928 extern int ext4_alloc_da_blocks(struct inode *inode);
26602929 extern void ext4_set_aops(struct inode *inode);
26612930 extern int ext4_writepage_trans_blocks(struct inode *);
26622931 extern int ext4_chunk_trans_blocks(struct inode *, int nrblocks);
26632932 extern int ext4_zero_partial_blocks(handle_t *handle, struct inode *inode,
26642933 loff_t lstart, loff_t lend);
2665
-extern int ext4_page_mkwrite(struct vm_fault *vmf);
2666
-extern int ext4_filemap_fault(struct vm_fault *vmf);
2934
+extern vm_fault_t ext4_page_mkwrite(struct vm_fault *vmf);
2935
+extern vm_fault_t ext4_filemap_fault(struct vm_fault *vmf);
26672936 extern qsize_t *ext4_get_reserved_space(struct inode *inode);
26682937 extern int ext4_get_projid(struct inode *inode, kprojid_t *projid);
2938
+extern void ext4_da_release_space(struct inode *inode, int to_free);
26692939 extern void ext4_da_update_reserve_space(struct inode *inode,
26702940 int used, int quota_claim);
26712941 extern int ext4_issue_zeroout(struct inode *inode, ext4_lblk_t lblk,
....@@ -2674,7 +2944,6 @@
26742944 /* indirect.c */
26752945 extern int ext4_ind_map_blocks(handle_t *handle, struct inode *inode,
26762946 struct ext4_map_blocks *map, int flags);
2677
-extern int ext4_ind_calc_metadata_amount(struct inode *inode, sector_t lblock);
26782947 extern int ext4_ind_trans_blocks(struct inode *inode, int nrblocks);
26792948 extern void ext4_ind_truncate(handle_t *, struct inode *inode);
26802949 extern int ext4_ind_remove_space(handle_t *handle, struct inode *inode,
....@@ -2683,14 +2952,17 @@
26832952 /* ioctl.c */
26842953 extern long ext4_ioctl(struct file *, unsigned int, unsigned long);
26852954 extern long ext4_compat_ioctl(struct file *, unsigned int, unsigned long);
2955
+extern void ext4_reset_inode_seed(struct inode *inode);
26862956
26872957 /* migrate.c */
26882958 extern int ext4_ext_migrate(struct inode *);
26892959 extern int ext4_ind_migrate(struct inode *inode);
26902960
26912961 /* namei.c */
2692
-extern int ext4_dirent_csum_verify(struct inode *inode,
2693
- struct ext4_dir_entry *dirent);
2962
+extern int ext4_init_new_dir(handle_t *handle, struct inode *dir,
2963
+ struct inode *inode);
2964
+extern int ext4_dirblock_csum_verify(struct inode *inode,
2965
+ struct buffer_head *bh);
26942966 extern int ext4_orphan_add(handle_t *, struct inode *);
26952967 extern int ext4_orphan_del(handle_t *, struct inode *);
26962968 extern int ext4_htree_fill_tree(struct file *dir_file, __u32 start_hash,
....@@ -2702,8 +2974,7 @@
27022974 struct ext4_filename *fname,
27032975 ext4_lblk_t lblk, unsigned int offset,
27042976 struct ext4_dir_entry_2 **res_dir);
2705
-extern int ext4_generic_delete_entry(handle_t *handle,
2706
- struct inode *dir,
2977
+extern int ext4_generic_delete_entry(struct inode *dir,
27072978 struct ext4_dir_entry_2 *de_del,
27082979 ext4_lblk_t lblk,
27092980 struct buffer_head *bh,
....@@ -2724,11 +2995,17 @@
27242995 /* super.c */
27252996 extern struct buffer_head *ext4_sb_bread(struct super_block *sb,
27262997 sector_t block, int op_flags);
2998
+extern struct buffer_head *ext4_sb_bread_unmovable(struct super_block *sb,
2999
+ sector_t block);
3000
+extern void ext4_read_bh_nowait(struct buffer_head *bh, int op_flags,
3001
+ bh_end_io_t *end_io);
3002
+extern int ext4_read_bh(struct buffer_head *bh, int op_flags,
3003
+ bh_end_io_t *end_io);
3004
+extern int ext4_read_bh_lock(struct buffer_head *bh, int op_flags, bool wait);
3005
+extern void ext4_sb_breadahead_unmovable(struct super_block *sb, sector_t block);
27273006 extern int ext4_seq_options_show(struct seq_file *seq, void *offset);
27283007 extern int ext4_calculate_overhead(struct super_block *sb);
27293008 extern void ext4_superblock_csum_set(struct super_block *sb);
2730
-extern void *ext4_kvmalloc(size_t size, gfp_t flags);
2731
-extern void *ext4_kvzalloc(size_t size, gfp_t flags);
27323009 extern int ext4_alloc_flex_bg_array(struct super_block *sb,
27333010 ext4_group_t ngroup);
27343011 extern const char *ext4_decode_error(struct super_block *sb, int errno,
....@@ -2736,20 +3013,22 @@
27363013 extern void ext4_mark_group_bitmap_corrupted(struct super_block *sb,
27373014 ext4_group_t block_group,
27383015 unsigned int flags);
3016
+extern unsigned int ext4_num_base_meta_blocks(struct super_block *sb,
3017
+ ext4_group_t block_group);
27393018
2740
-extern __printf(4, 5)
2741
-void __ext4_error(struct super_block *, const char *, unsigned int,
3019
+extern __printf(6, 7)
3020
+void __ext4_error(struct super_block *, const char *, unsigned int, int, __u64,
27423021 const char *, ...);
2743
-extern __printf(5, 6)
2744
-void __ext4_error_inode(struct inode *, const char *, unsigned int, ext4_fsblk_t,
2745
- const char *, ...);
3022
+extern __printf(6, 7)
3023
+void __ext4_error_inode(struct inode *, const char *, unsigned int,
3024
+ ext4_fsblk_t, int, const char *, ...);
27463025 extern __printf(5, 6)
27473026 void __ext4_error_file(struct file *, const char *, unsigned int, ext4_fsblk_t,
27483027 const char *, ...);
27493028 extern void __ext4_std_error(struct super_block *, const char *,
27503029 unsigned int, int);
2751
-extern __printf(4, 5)
2752
-void __ext4_abort(struct super_block *, const char *, unsigned int,
3030
+extern __printf(5, 6)
3031
+void __ext4_abort(struct super_block *, const char *, unsigned int, int,
27533032 const char *, ...);
27543033 extern __printf(4, 5)
27553034 void __ext4_warning(struct super_block *, const char *, unsigned int,
....@@ -2770,8 +3049,12 @@
27703049 #define EXT4_ERROR_INODE(inode, fmt, a...) \
27713050 ext4_error_inode((inode), __func__, __LINE__, 0, (fmt), ## a)
27723051
2773
-#define EXT4_ERROR_INODE_BLOCK(inode, block, fmt, a...) \
2774
- ext4_error_inode((inode), __func__, __LINE__, (block), (fmt), ## a)
3052
+#define EXT4_ERROR_INODE_ERR(inode, err, fmt, a...) \
3053
+ __ext4_error_inode((inode), __func__, __LINE__, 0, (err), (fmt), ## a)
3054
+
3055
+#define ext4_error_inode_block(inode, block, err, fmt, a...) \
3056
+ __ext4_error_inode((inode), __func__, __LINE__, (block), (err), \
3057
+ (fmt), ## a)
27753058
27763059 #define EXT4_ERROR_FILE(file, block, fmt, a...) \
27773060 ext4_error_file((file), __func__, __LINE__, (block), (fmt), ## a)
....@@ -2779,13 +3062,18 @@
27793062 #ifdef CONFIG_PRINTK
27803063
27813064 #define ext4_error_inode(inode, func, line, block, fmt, ...) \
2782
- __ext4_error_inode(inode, func, line, block, fmt, ##__VA_ARGS__)
3065
+ __ext4_error_inode(inode, func, line, block, 0, fmt, ##__VA_ARGS__)
3066
+#define ext4_error_inode_err(inode, func, line, block, err, fmt, ...) \
3067
+ __ext4_error_inode((inode), (func), (line), (block), \
3068
+ (err), (fmt), ##__VA_ARGS__)
27833069 #define ext4_error_file(file, func, line, block, fmt, ...) \
27843070 __ext4_error_file(file, func, line, block, fmt, ##__VA_ARGS__)
27853071 #define ext4_error(sb, fmt, ...) \
2786
- __ext4_error(sb, __func__, __LINE__, fmt, ##__VA_ARGS__)
2787
-#define ext4_abort(sb, fmt, ...) \
2788
- __ext4_abort(sb, __func__, __LINE__, fmt, ##__VA_ARGS__)
3072
+ __ext4_error((sb), __func__, __LINE__, 0, 0, (fmt), ##__VA_ARGS__)
3073
+#define ext4_error_err(sb, err, fmt, ...) \
3074
+ __ext4_error((sb), __func__, __LINE__, (err), 0, (fmt), ##__VA_ARGS__)
3075
+#define ext4_abort(sb, err, fmt, ...) \
3076
+ __ext4_abort((sb), __func__, __LINE__, (err), (fmt), ##__VA_ARGS__)
27893077 #define ext4_warning(sb, fmt, ...) \
27903078 __ext4_warning(sb, __func__, __LINE__, fmt, ##__VA_ARGS__)
27913079 #define ext4_warning_inode(inode, fmt, ...) \
....@@ -2803,7 +3091,12 @@
28033091 #define ext4_error_inode(inode, func, line, block, fmt, ...) \
28043092 do { \
28053093 no_printk(fmt, ##__VA_ARGS__); \
2806
- __ext4_error_inode(inode, "", 0, block, " "); \
3094
+ __ext4_error_inode(inode, "", 0, block, 0, " "); \
3095
+} while (0)
3096
+#define ext4_error_inode_err(inode, func, line, block, err, fmt, ...) \
3097
+do { \
3098
+ no_printk(fmt, ##__VA_ARGS__); \
3099
+ __ext4_error_inode(inode, "", 0, block, err, " "); \
28073100 } while (0)
28083101 #define ext4_error_file(file, func, line, block, fmt, ...) \
28093102 do { \
....@@ -2813,12 +3106,17 @@
28133106 #define ext4_error(sb, fmt, ...) \
28143107 do { \
28153108 no_printk(fmt, ##__VA_ARGS__); \
2816
- __ext4_error(sb, "", 0, " "); \
3109
+ __ext4_error(sb, "", 0, 0, 0, " "); \
28173110 } while (0)
2818
-#define ext4_abort(sb, fmt, ...) \
3111
+#define ext4_error_err(sb, err, fmt, ...) \
28193112 do { \
28203113 no_printk(fmt, ##__VA_ARGS__); \
2821
- __ext4_abort(sb, "", 0, " "); \
3114
+ __ext4_error(sb, "", 0, err, 0, " "); \
3115
+} while (0)
3116
+#define ext4_abort(sb, err, fmt, ...) \
3117
+do { \
3118
+ no_printk(fmt, ##__VA_ARGS__); \
3119
+ __ext4_abort(sb, "", 0, err, " "); \
28223120 } while (0)
28233121 #define ext4_warning(sb, fmt, ...) \
28243122 do { \
....@@ -2845,12 +3143,6 @@
28453143
28463144 #endif
28473145
2848
-extern int ext4_update_compat_feature(handle_t *handle, struct super_block *sb,
2849
- __u32 compat);
2850
-extern int ext4_update_rocompat_feature(handle_t *handle,
2851
- struct super_block *sb, __u32 rocompat);
2852
-extern int ext4_update_incompat_feature(handle_t *handle,
2853
- struct super_block *sb, __u32 incompat);
28543146 extern ext4_fsblk_t ext4_block_bitmap(struct super_block *sb,
28553147 struct ext4_group_desc *bg);
28563148 extern ext4_fsblk_t ext4_inode_bitmap(struct super_block *sb,
....@@ -2901,22 +3193,24 @@
29013193 return ext4_has_feature_gdt_csum(sb) || ext4_has_metadata_csum(sb);
29023194 }
29033195
3196
+#define ext4_read_incompat_64bit_val(es, name) \
3197
+ (((es)->s_feature_incompat & cpu_to_le32(EXT4_FEATURE_INCOMPAT_64BIT) \
3198
+ ? (ext4_fsblk_t)le32_to_cpu(es->name##_hi) << 32 : 0) | \
3199
+ le32_to_cpu(es->name##_lo))
3200
+
29043201 static inline ext4_fsblk_t ext4_blocks_count(struct ext4_super_block *es)
29053202 {
2906
- return ((ext4_fsblk_t)le32_to_cpu(es->s_blocks_count_hi) << 32) |
2907
- le32_to_cpu(es->s_blocks_count_lo);
3203
+ return ext4_read_incompat_64bit_val(es, s_blocks_count);
29083204 }
29093205
29103206 static inline ext4_fsblk_t ext4_r_blocks_count(struct ext4_super_block *es)
29113207 {
2912
- return ((ext4_fsblk_t)le32_to_cpu(es->s_r_blocks_count_hi) << 32) |
2913
- le32_to_cpu(es->s_r_blocks_count_lo);
3208
+ return ext4_read_incompat_64bit_val(es, s_r_blocks_count);
29143209 }
29153210
29163211 static inline ext4_fsblk_t ext4_free_blocks_count(struct ext4_super_block *es)
29173212 {
2918
- return ((ext4_fsblk_t)le32_to_cpu(es->s_free_blocks_count_hi) << 32) |
2919
- le32_to_cpu(es->s_free_blocks_count_lo);
3213
+ return ext4_read_incompat_64bit_val(es, s_free_blocks_count);
29203214 }
29213215
29223216 static inline void ext4_blocks_count_set(struct ext4_super_block *es,
....@@ -2955,19 +3249,6 @@
29553249 {
29563250 raw_inode->i_size_lo = cpu_to_le32(i_size);
29573251 raw_inode->i_size_high = cpu_to_le32(i_size >> 32);
2958
-}
2959
-
2960
-static inline
2961
-struct ext4_group_info *ext4_get_group_info(struct super_block *sb,
2962
- ext4_group_t group)
2963
-{
2964
- struct ext4_group_info **grp_info;
2965
- long indexv, indexh;
2966
- BUG_ON(group >= EXT4_SB(sb)->s_groups_count);
2967
- indexv = group >> (EXT4_DESC_PER_BLOCK_BITS(sb));
2968
- indexh = group & ((EXT4_DESC_PER_BLOCK(sb)) - 1);
2969
- grp_info = sbi_array_rcu_deref(EXT4_SB(sb), s_group_info, indexv);
2970
- return grp_info[indexh];
29713252 }
29723253
29733254 /*
....@@ -3042,6 +3323,9 @@
30423323
30433324 struct ext4_group_info {
30443325 unsigned long bb_state;
3326
+#ifdef AGGRESSIVE_CHECK
3327
+ unsigned long bb_check_counter;
3328
+#endif
30453329 struct rb_root bb_free_root;
30463330 ext4_grpblk_t bb_first_free; /* first free block */
30473331 ext4_grpblk_t bb_free; /* total free blocks */
....@@ -3066,6 +3350,7 @@
30663350 (1 << EXT4_GROUP_INFO_BBITMAP_CORRUPT_BIT)
30673351 #define EXT4_GROUP_INFO_IBITMAP_CORRUPT \
30683352 (1 << EXT4_GROUP_INFO_IBITMAP_CORRUPT_BIT)
3353
+#define EXT4_GROUP_INFO_BBITMAP_READ_BIT 4
30693354
30703355 #define EXT4_MB_GRP_NEED_INIT(grp) \
30713356 (test_bit(EXT4_GROUP_INFO_NEED_INIT_BIT, &((grp)->bb_state)))
....@@ -3080,6 +3365,8 @@
30803365 (set_bit(EXT4_GROUP_INFO_WAS_TRIMMED_BIT, &((grp)->bb_state)))
30813366 #define EXT4_MB_GRP_CLEAR_TRIMMED(grp) \
30823367 (clear_bit(EXT4_GROUP_INFO_WAS_TRIMMED_BIT, &((grp)->bb_state)))
3368
+#define EXT4_MB_GRP_TEST_AND_SET_READ(grp) \
3369
+ (test_and_set_bit(EXT4_GROUP_INFO_BBITMAP_READ_BIT, &((grp)->bb_state)))
30833370
30843371 #define EXT4_MAX_CONTENTION 8
30853372 #define EXT4_CONTENTION_THRESHOLD 2
....@@ -3145,10 +3432,6 @@
31453432 /* dir.c */
31463433 extern const struct file_operations ext4_dir_operations;
31473434
3148
-#ifdef CONFIG_UNICODE
3149
-extern const struct dentry_operations ext4_dentry_ops;
3150
-#endif
3151
-
31523435 /* file.c */
31533436 extern const struct inode_operations ext4_file_inode_operations;
31543437 extern const struct file_operations ext4_file_operations;
....@@ -3193,11 +3476,11 @@
31933476 extern int ext4_read_inline_dir(struct file *filp,
31943477 struct dir_context *ctx,
31953478 int *has_inline_data);
3196
-extern int htree_inlinedir_to_tree(struct file *dir_file,
3197
- struct inode *dir, ext4_lblk_t block,
3198
- struct dx_hash_info *hinfo,
3199
- __u32 start_hash, __u32 start_minor_hash,
3200
- int *has_inline_data);
3479
+extern int ext4_inlinedir_to_tree(struct file *dir_file,
3480
+ struct inode *dir, ext4_lblk_t block,
3481
+ struct dx_hash_info *hinfo,
3482
+ __u32 start_hash, __u32 start_minor_hash,
3483
+ int *has_inline_data);
32013484 extern struct buffer_head *ext4_find_inline_entry(struct inode *dir,
32023485 struct ext4_filename *fname,
32033486 struct ext4_dir_entry_2 **res_dir,
....@@ -3236,11 +3519,14 @@
32363519 struct ext4_dir_entry_2 *de,
32373520 int blocksize, int csum_size,
32383521 unsigned int parent_ino, int dotdot_real_len);
3239
-extern void initialize_dirent_tail(struct ext4_dir_entry_tail *t,
3240
- unsigned int blocksize);
3241
-extern int ext4_handle_dirty_dirent_node(handle_t *handle,
3242
- struct inode *inode,
3243
- struct buffer_head *bh);
3522
+extern void ext4_initialize_dirent_tail(struct buffer_head *bh,
3523
+ unsigned int blocksize);
3524
+extern int ext4_handle_dirty_dirblock(handle_t *handle, struct inode *inode,
3525
+ struct buffer_head *bh);
3526
+extern int __ext4_unlink(struct inode *dir, const struct qstr *d_name,
3527
+ struct inode *inode, struct dentry *dentry);
3528
+extern int __ext4_link(struct inode *dir, struct inode *inode,
3529
+ struct dentry *dentry);
32443530
32453531 #define S_SHIFT 12
32463532 static const unsigned char ext4_type_by_mode[(S_IFMT >> S_SHIFT) + 1] = {
....@@ -3261,9 +3547,8 @@
32613547 }
32623548
32633549 /* readpages.c */
3264
-extern int ext4_mpage_readpages(struct address_space *mapping,
3265
- struct list_head *pages, struct page *page,
3266
- unsigned nr_pages, bool is_readahead);
3550
+extern int ext4_mpage_readpages(struct inode *inode,
3551
+ struct readahead_control *rac, struct page *page);
32673552 extern int __init ext4_init_post_read_processing(void);
32683553 extern void ext4_exit_post_read_processing(void);
32693554
....@@ -3288,6 +3573,9 @@
32883573 unsigned int count);
32893574 extern int ext4_check_blockref(const char *, unsigned int,
32903575 struct inode *, __le32 *, unsigned int);
3576
+extern int ext4_sb_block_valid(struct super_block *sb, struct inode *inode,
3577
+ ext4_fsblk_t start_blk, unsigned int count);
3578
+
32913579
32923580 /* extents.c */
32933581 struct ext4_ext_path;
....@@ -3299,8 +3587,7 @@
32993587 */
33003588 #define EXT_MAX_BLOCKS 0xffffffff
33013589
3302
-extern int ext4_ext_tree_init(handle_t *handle, struct inode *);
3303
-extern int ext4_ext_writepage_trans_blocks(struct inode *, int);
3590
+extern void ext4_ext_tree_init(handle_t *handle, struct inode *inode);
33043591 extern int ext4_ext_index_trans_blocks(struct inode *inode, int extents);
33053592 extern int ext4_ext_map_blocks(handle_t *handle, struct inode *inode,
33063593 struct ext4_map_blocks *map, int flags);
....@@ -3313,16 +3600,13 @@
33133600 loff_t len);
33143601 extern int ext4_convert_unwritten_extents(handle_t *handle, struct inode *inode,
33153602 loff_t offset, ssize_t len);
3603
+extern int ext4_convert_unwritten_io_end_vec(handle_t *handle,
3604
+ ext4_io_end_t *io_end);
33163605 extern int ext4_map_blocks(handle_t *handle, struct inode *inode,
33173606 struct ext4_map_blocks *map, int flags);
3318
-extern int ext4_ext_calc_metadata_amount(struct inode *inode,
3319
- ext4_lblk_t lblocks);
33203607 extern int ext4_ext_calc_credits_for_single_extent(struct inode *inode,
33213608 int num,
33223609 struct ext4_ext_path *path);
3323
-extern int ext4_can_extents_be_merged(struct inode *inode,
3324
- struct ext4_extent *ex1,
3325
- struct ext4_extent *ex2);
33263610 extern int ext4_ext_insert_extent(handle_t *, struct inode *,
33273611 struct ext4_ext_path **,
33283612 struct ext4_extent *, int);
....@@ -3331,20 +3615,27 @@
33313615 int flags);
33323616 extern void ext4_ext_drop_refs(struct ext4_ext_path *);
33333617 extern int ext4_ext_check_inode(struct inode *inode);
3334
-extern int ext4_find_delalloc_range(struct inode *inode,
3335
- ext4_lblk_t lblk_start,
3336
- ext4_lblk_t lblk_end);
3337
-extern int ext4_find_delalloc_cluster(struct inode *inode, ext4_lblk_t lblk);
33383618 extern ext4_lblk_t ext4_ext_next_allocated_block(struct ext4_ext_path *path);
33393619 extern int ext4_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
33403620 __u64 start, __u64 len);
3621
+extern int ext4_get_es_cache(struct inode *inode,
3622
+ struct fiemap_extent_info *fieinfo,
3623
+ __u64 start, __u64 len);
33413624 extern int ext4_ext_precache(struct inode *inode);
3342
-extern int ext4_collapse_range(struct inode *inode, loff_t offset, loff_t len);
3343
-extern int ext4_insert_range(struct inode *inode, loff_t offset, loff_t len);
33443625 extern int ext4_swap_extents(handle_t *handle, struct inode *inode1,
33453626 struct inode *inode2, ext4_lblk_t lblk1,
33463627 ext4_lblk_t lblk2, ext4_lblk_t count,
33473628 int mark_unwritten,int *err);
3629
+extern int ext4_clu_mapped(struct inode *inode, ext4_lblk_t lclu);
3630
+extern int ext4_datasem_ensure_credits(handle_t *handle, struct inode *inode,
3631
+ int check_cred, int restart_cred,
3632
+ int revoke_cred);
3633
+extern void ext4_ext_replay_shrink_inode(struct inode *inode, ext4_lblk_t end);
3634
+extern int ext4_ext_replay_set_iblocks(struct inode *inode);
3635
+extern int ext4_ext_replay_update_ex(struct inode *inode, ext4_lblk_t start,
3636
+ int len, int unwritten, ext4_fsblk_t pblk);
3637
+extern int ext4_ext_clear_bb(struct inode *inode);
3638
+
33483639
33493640 /* move_extent.c */
33503641 extern void ext4_double_down_write_data_sem(struct inode *first,
....@@ -3371,9 +3662,14 @@
33713662 int len,
33723663 struct writeback_control *wbc,
33733664 bool keep_towrite);
3665
+extern struct ext4_io_end_vec *ext4_alloc_io_end_vec(ext4_io_end_t *io_end);
3666
+extern struct ext4_io_end_vec *ext4_last_io_end_vec(ext4_io_end_t *io_end);
33743667
33753668 /* mmp.c */
33763669 extern int ext4_multi_mount_protect(struct super_block *, ext4_fsblk_t);
3670
+
3671
+/* mmp.c */
3672
+extern void ext4_stop_mmpd(struct ext4_sb_info *sbi);
33773673
33783674 /* verity.c */
33793675 extern const struct fsverity_operations ext4_verityops;
....@@ -3428,6 +3724,21 @@
34283724 }
34293725
34303726 extern const struct iomap_ops ext4_iomap_ops;
3727
+extern const struct iomap_ops ext4_iomap_overwrite_ops;
3728
+extern const struct iomap_ops ext4_iomap_report_ops;
3729
+
3730
+static inline int ext4_buffer_uptodate(struct buffer_head *bh)
3731
+{
3732
+ /*
3733
+ * If the buffer has the write error flag, we have failed
3734
+ * to write out data in the block. In this case, we don't
3735
+ * have to read the block because we may read the old data
3736
+ * successfully.
3737
+ */
3738
+ if (!buffer_uptodate(bh) && buffer_write_io_error(bh))
3739
+ set_buffer_uptodate(bh);
3740
+ return buffer_uptodate(bh);
3741
+}
34313742
34323743 #endif /* __KERNEL__ */
34333744