.. | .. |
---|
27 | 27 | #include <linux/seqlock.h> |
---|
28 | 28 | #include <linux/mutex.h> |
---|
29 | 29 | #include <linux/timer.h> |
---|
30 | | -#include <linux/version.h> |
---|
31 | 30 | #include <linux/wait.h> |
---|
32 | 31 | #include <linux/sched/signal.h> |
---|
33 | 32 | #include <linux/blockgroup_lock.h> |
---|
.. | .. |
---|
36 | 35 | #include <crypto/hash.h> |
---|
37 | 36 | #include <linux/falloc.h> |
---|
38 | 37 | #include <linux/percpu-rwsem.h> |
---|
| 38 | +#include <linux/fiemap.h> |
---|
39 | 39 | #ifdef __KERNEL__ |
---|
40 | 40 | #include <linux/compat.h> |
---|
41 | 41 | #endif |
---|
.. | .. |
---|
44 | 44 | #include <linux/fsverity.h> |
---|
45 | 45 | |
---|
46 | 46 | #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 |
---|
56 | 47 | |
---|
57 | 48 | /* |
---|
58 | 49 | * The fourth extended filesystem constants/structures |
---|
.. | .. |
---|
89 | 80 | #define ext4_debug(fmt, ...) no_printk(fmt, ##__VA_ARGS__) |
---|
90 | 81 | #endif |
---|
91 | 82 | |
---|
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 | + */ |
---|
95 | 86 | #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__) |
---|
98 | 97 | #else |
---|
99 | | -#define ext_debug(fmt, ...) no_printk(fmt, ##__VA_ARGS__) |
---|
| 98 | +#define ext_debug(ino, fmt, ...) no_printk(fmt, ##__VA_ARGS__) |
---|
100 | 99 | #endif |
---|
101 | 100 | |
---|
102 | 101 | /* data type for block offset of block group */ |
---|
.. | .. |
---|
151 | 150 | #define EXT4_MB_USE_ROOT_BLOCKS 0x1000 |
---|
152 | 151 | /* Use blocks from reserved pool */ |
---|
153 | 152 | #define EXT4_MB_USE_RESERVED 0x2000 |
---|
| 153 | +/* Do strict check for free blocks while retrying block allocation */ |
---|
| 154 | +#define EXT4_MB_STRICT_CHECK 0x4000 |
---|
154 | 155 | |
---|
155 | 156 | struct ext4_allocation_request { |
---|
156 | 157 | /* target inode for block we're allocating */ |
---|
.. | .. |
---|
180 | 181 | * well as to store the information returned by ext4_map_blocks(). It |
---|
181 | 182 | * takes less room on the stack than a struct buffer_head. |
---|
182 | 183 | */ |
---|
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) |
---|
187 | 188 | #define EXT4_MAP_FLAGS (EXT4_MAP_NEW | EXT4_MAP_MAPPED |\ |
---|
188 | 189 | EXT4_MAP_UNWRITTEN | EXT4_MAP_BOUNDARY) |
---|
189 | 190 | |
---|
.. | .. |
---|
207 | 208 | */ |
---|
208 | 209 | #define EXT4_IO_END_UNWRITTEN 0x0001 |
---|
209 | 210 | |
---|
| 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 | + |
---|
210 | 217 | /* |
---|
211 | 218 | * For converting unwritten extents on a work queue. 'handle' is used for |
---|
212 | 219 | * buffered writeback. |
---|
.. | .. |
---|
220 | 227 | * bios covering the extent */ |
---|
221 | 228 | unsigned int flag; /* unwritten or not */ |
---|
222 | 229 | 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 */ |
---|
225 | 231 | } ext4_io_end_t; |
---|
226 | 232 | |
---|
227 | 233 | struct ext4_io_submit { |
---|
.. | .. |
---|
302 | 308 | ~((ext4_fsblk_t) (s)->s_cluster_ratio - 1)) |
---|
303 | 309 | #define EXT4_LBLK_CMASK(s, lblk) ((lblk) & \ |
---|
304 | 310 | ~((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)) |
---|
305 | 314 | /* Get the cluster offset */ |
---|
306 | 315 | #define EXT4_PBLK_COFF(s, pblk) ((pblk) & \ |
---|
307 | 316 | ((ext4_fsblk_t) (s)->s_cluster_ratio - 1)) |
---|
.. | .. |
---|
415 | 424 | #define EXT4_EXTENTS_FL 0x00080000 /* Inode uses extents */ |
---|
416 | 425 | #define EXT4_VERITY_FL 0x00100000 /* Verity protected inode */ |
---|
417 | 426 | #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 | + |
---|
419 | 431 | #define EXT4_INLINE_DATA_FL 0x10000000 /* Inode has inline data. */ |
---|
420 | 432 | #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 */ |
---|
422 | 434 | #define EXT4_RESERVED_FL 0x80000000 /* reserved for ext4 lib */ |
---|
423 | 435 | |
---|
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) |
---|
426 | 454 | |
---|
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 */ |
---|
428 | 466 | #define EXT4_FL_XFLAG_VISIBLE (EXT4_SYNC_FL | \ |
---|
429 | 467 | EXT4_IMMUTABLE_FL | \ |
---|
430 | 468 | EXT4_APPEND_FL | \ |
---|
431 | 469 | EXT4_NODUMP_FL | \ |
---|
432 | 470 | EXT4_NOATIME_FL | \ |
---|
433 | | - EXT4_PROJINHERIT_FL) |
---|
| 471 | + EXT4_PROJINHERIT_FL | \ |
---|
| 472 | + EXT4_DAX_FL) |
---|
434 | 473 | |
---|
435 | 474 | /* Flags that should be inherited by new inodes from their parent. */ |
---|
436 | 475 | #define EXT4_FL_INHERITED (EXT4_SECRM_FL | EXT4_UNRM_FL | EXT4_COMPR_FL |\ |
---|
437 | 476 | EXT4_SYNC_FL | EXT4_NODUMP_FL | EXT4_NOATIME_FL |\ |
---|
438 | 477 | EXT4_NOCOMPR_FL | EXT4_JOURNAL_DATA_FL |\ |
---|
439 | 478 | EXT4_NOTAIL_FL | EXT4_DIRSYNC_FL |\ |
---|
440 | | - EXT4_PROJINHERIT_FL | EXT4_CASEFOLD_FL) |
---|
| 479 | + EXT4_PROJINHERIT_FL | EXT4_CASEFOLD_FL |\ |
---|
| 480 | + EXT4_DAX_FL) |
---|
441 | 481 | |
---|
442 | 482 | /* 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)) |
---|
444 | 485 | |
---|
445 | 486 | /* Flags that are appropriate for non-directories/regular files. */ |
---|
446 | 487 | #define EXT4_OTHER_FLMASK (EXT4_NODUMP_FL | EXT4_NOATIME_FL) |
---|
447 | 488 | |
---|
448 | 489 | /* The only flags that should be swapped */ |
---|
449 | 490 | #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) |
---|
450 | 495 | |
---|
451 | 496 | /* Mask out flags that are inappropriate for the given type of inode. */ |
---|
452 | 497 | static inline __u32 ext4_mask_flags(umode_t mode, __u32 flags) |
---|
.. | .. |
---|
487 | 532 | EXT4_INODE_EXTENTS = 19, /* Inode uses extents */ |
---|
488 | 533 | EXT4_INODE_VERITY = 20, /* Verity protected inode */ |
---|
489 | 534 | 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 */ |
---|
491 | 537 | EXT4_INODE_INLINE_DATA = 28, /* Data in inode. */ |
---|
492 | 538 | EXT4_INODE_PROJINHERIT = 29, /* Create with parents projid */ |
---|
| 539 | + EXT4_INODE_CASEFOLD = 30, /* Casefolded directory */ |
---|
493 | 540 | EXT4_INODE_RESERVED = 31, /* reserved for ext4 lib */ |
---|
494 | 541 | }; |
---|
495 | 542 | |
---|
.. | .. |
---|
506 | 553 | * |
---|
507 | 554 | * It's not paranoia if the Murphy's Law really *is* out to get you. :-) |
---|
508 | 555 | */ |
---|
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)) |
---|
510 | 557 | #define CHECK_FLAG_VALUE(FLAG) BUILD_BUG_ON(!TEST_FLAG_VALUE(FLAG)) |
---|
511 | 558 | |
---|
512 | 559 | static inline void ext4_check_flag_values(void) |
---|
.. | .. |
---|
533 | 580 | CHECK_FLAG_VALUE(EXTENTS); |
---|
534 | 581 | CHECK_FLAG_VALUE(VERITY); |
---|
535 | 582 | CHECK_FLAG_VALUE(EA_INODE); |
---|
536 | | - CHECK_FLAG_VALUE(EOFBLOCKS); |
---|
537 | 583 | CHECK_FLAG_VALUE(INLINE_DATA); |
---|
538 | 584 | CHECK_FLAG_VALUE(PROJINHERIT); |
---|
| 585 | + CHECK_FLAG_VALUE(CASEFOLD); |
---|
539 | 586 | CHECK_FLAG_VALUE(RESERVED); |
---|
540 | 587 | } |
---|
541 | 588 | |
---|
.. | .. |
---|
610 | 657 | #define EXT4_GET_BLOCKS_METADATA_NOFAIL 0x0020 |
---|
611 | 658 | /* Don't normalize allocation size (used for fallocate) */ |
---|
612 | 659 | #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 |
---|
615 | 660 | /* Convert written extents to unwritten */ |
---|
616 | 661 | #define EXT4_GET_BLOCKS_CONVERT_UNWRITTEN 0x0100 |
---|
617 | 662 | /* Write zeros to newly created written extents */ |
---|
.. | .. |
---|
633 | 678 | */ |
---|
634 | 679 | #define EXT4_EX_NOCACHE 0x40000000 |
---|
635 | 680 | #define EXT4_EX_FORCE_CACHE 0x20000000 |
---|
| 681 | +#define EXT4_EX_NOFAIL 0x10000000 |
---|
636 | 682 | |
---|
637 | 683 | /* |
---|
638 | 684 | * Flags used by ext4_free_blocks |
---|
.. | .. |
---|
643 | 689 | #define EXT4_FREE_BLOCKS_NO_QUOT_UPDATE 0x0008 |
---|
644 | 690 | #define EXT4_FREE_BLOCKS_NOFREE_FIRST_CLUSTER 0x0010 |
---|
645 | 691 | #define EXT4_FREE_BLOCKS_NOFREE_LAST_CLUSTER 0x0020 |
---|
| 692 | +#define EXT4_FREE_BLOCKS_RERESERVE_CLUSTER 0x0040 |
---|
646 | 693 | |
---|
647 | 694 | /* |
---|
648 | 695 | * ioctl commands |
---|
649 | 696 | */ |
---|
650 | | -#define EXT4_IOC_GETFLAGS FS_IOC_GETFLAGS |
---|
651 | | -#define EXT4_IOC_SETFLAGS FS_IOC_SETFLAGS |
---|
652 | 697 | #define EXT4_IOC_GETVERSION _IOR('f', 3, long) |
---|
653 | 698 | #define EXT4_IOC_SETVERSION _IOW('f', 4, long) |
---|
654 | 699 | #define EXT4_IOC_GETVERSION_OLD FS_IOC_GETVERSION |
---|
.. | .. |
---|
665 | 710 | #define EXT4_IOC_RESIZE_FS _IOW('f', 16, __u64) |
---|
666 | 711 | #define EXT4_IOC_SWAP_BOOT _IO('f', 17) |
---|
667 | 712 | #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) |
---|
674 | 717 | |
---|
675 | 718 | #define EXT4_IOC_SHUTDOWN _IOR ('X', 125, __u32) |
---|
676 | 719 | |
---|
.. | .. |
---|
681 | 724 | #define EXT4_GOING_FLAGS_LOGFLUSH 0x1 /* flush log but not data */ |
---|
682 | 725 | #define EXT4_GOING_FLAGS_NOLOGFLUSH 0x2 /* don't flush log nor data */ |
---|
683 | 726 | |
---|
| 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 |
---|
684 | 737 | |
---|
685 | 738 | #if defined(__KERNEL__) && defined(CONFIG_COMPAT) |
---|
686 | 739 | /* |
---|
687 | 740 | * ioctl commands in 32 bit emulation |
---|
688 | 741 | */ |
---|
689 | | -#define EXT4_IOC32_GETFLAGS FS_IOC32_GETFLAGS |
---|
690 | | -#define EXT4_IOC32_SETFLAGS FS_IOC32_SETFLAGS |
---|
691 | 742 | #define EXT4_IOC32_GETVERSION _IOR('f', 3, int) |
---|
692 | 743 | #define EXT4_IOC32_SETVERSION _IOW('f', 4, int) |
---|
693 | 744 | #define EXT4_IOC32_GETRSVSZ _IOR('f', 5, int) |
---|
.. | .. |
---|
698 | 749 | #define EXT4_IOC32_SETVERSION_OLD FS_IOC32_SETVERSION |
---|
699 | 750 | #endif |
---|
700 | 751 | |
---|
| 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 | + |
---|
701 | 758 | /* Max physical block we can address w/o extents */ |
---|
702 | 759 | #define EXT4_MAX_BLOCK_FILE_PHYS 0xFFFFFFFF |
---|
703 | 760 | |
---|
704 | 761 | /* Max logical block we can support */ |
---|
705 | | -#define EXT4_MAX_LOGICAL_BLOCK 0xFFFFFFFF |
---|
| 762 | +#define EXT4_MAX_LOGICAL_BLOCK 0xFFFFFFFE |
---|
706 | 763 | |
---|
707 | 764 | /* |
---|
708 | 765 | * Structure of an inode on the disk |
---|
.. | .. |
---|
827 | 884 | static inline void ext4_decode_extra_time(struct timespec64 *time, |
---|
828 | 885 | __le32 extra) |
---|
829 | 886 | { |
---|
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))) |
---|
842 | 888 | time->tv_sec += (u64)(le32_to_cpu(extra) & EXT4_EPOCH_MASK) << 32; |
---|
843 | | -#endif |
---|
844 | | - } |
---|
845 | 889 | time->tv_nsec = (le32_to_cpu(extra) & EXT4_NSEC_MASK) >> EXT4_EPOCH_BITS; |
---|
846 | 890 | } |
---|
847 | 891 | |
---|
848 | 892 | #define EXT4_INODE_SET_XTIME(xtime, inode, raw_inode) \ |
---|
849 | 893 | do { \ |
---|
850 | | - (raw_inode)->xtime = cpu_to_le32((inode)->xtime.tv_sec); \ |
---|
851 | 894 | if (EXT4_FITS_IN_INODE(raw_inode, EXT4_I(inode), xtime ## _extra)) {\ |
---|
| 895 | + (raw_inode)->xtime = cpu_to_le32((inode)->xtime.tv_sec); \ |
---|
852 | 896 | (raw_inode)->xtime ## _extra = \ |
---|
853 | 897 | ext4_encode_extra_time(&(inode)->xtime); \ |
---|
854 | 898 | } \ |
---|
| 899 | + else \ |
---|
| 900 | + (raw_inode)->xtime = cpu_to_le32(clamp_t(int32_t, (inode)->xtime.tv_sec, S32_MIN, S32_MAX)); \ |
---|
855 | 901 | } while (0) |
---|
856 | 902 | |
---|
857 | 903 | #define EXT4_EINODE_SET_XTIME(xtime, einode, raw_inode) \ |
---|
.. | .. |
---|
917 | 963 | #endif /* defined(__KERNEL__) || defined(__linux__) */ |
---|
918 | 964 | |
---|
919 | 965 | #include "extents_status.h" |
---|
| 966 | +#include "fast_commit.h" |
---|
920 | 967 | |
---|
921 | 968 | /* |
---|
922 | 969 | * Lock subclasses for i_data_sem in the ext4_inode_info structure. |
---|
.. | .. |
---|
933 | 980 | * where the second inode has larger inode number |
---|
934 | 981 | * than the first |
---|
935 | 982 | * I_DATA_SEM_QUOTA - Used for quota inodes only |
---|
| 983 | + * I_DATA_SEM_EA - Used for ea_inodes only |
---|
936 | 984 | */ |
---|
937 | 985 | enum { |
---|
938 | 986 | I_DATA_SEM_NORMAL = 0, |
---|
939 | 987 | I_DATA_SEM_OTHER, |
---|
940 | 988 | I_DATA_SEM_QUOTA, |
---|
| 989 | + I_DATA_SEM_EA |
---|
941 | 990 | }; |
---|
942 | 991 | |
---|
943 | 992 | |
---|
.. | .. |
---|
973 | 1022 | struct rw_semaphore xattr_sem; |
---|
974 | 1023 | |
---|
975 | 1024 | 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; |
---|
976 | 1047 | |
---|
977 | 1048 | /* |
---|
978 | 1049 | * i_disksize keeps track of what the inode size is ON DISK, not |
---|
.. | .. |
---|
1023 | 1094 | struct timespec64 i_crtime; |
---|
1024 | 1095 | |
---|
1025 | 1096 | /* mballoc */ |
---|
| 1097 | + atomic_t i_prealloc_active; |
---|
1026 | 1098 | struct list_head i_prealloc_list; |
---|
1027 | 1099 | spinlock_t i_prealloc_lock; |
---|
1028 | 1100 | |
---|
.. | .. |
---|
1042 | 1114 | /* allocation reservation info for delalloc */ |
---|
1043 | 1115 | /* In case of bigalloc, this refer to clusters rather than blocks */ |
---|
1044 | 1116 | 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; |
---|
1047 | 1120 | |
---|
1048 | 1121 | /* on-disk additional length */ |
---|
1049 | 1122 | __u16 i_extra_isize; |
---|
.. | .. |
---|
1092 | 1165 | #define EXT4_VALID_FS 0x0001 /* Unmounted cleanly */ |
---|
1093 | 1166 | #define EXT4_ERROR_FS 0x0002 /* Errors detected */ |
---|
1094 | 1167 | #define EXT4_ORPHAN_FS 0x0004 /* Orphans being recovered */ |
---|
| 1168 | +#define EXT4_FC_REPLAY 0x0020 /* Fast commit replay ongoing */ |
---|
1095 | 1169 | |
---|
1096 | 1170 | /* |
---|
1097 | 1171 | * Misc. filesystem flags |
---|
.. | .. |
---|
1113 | 1187 | #define EXT4_MOUNT_MINIX_DF 0x00080 /* Mimics the Minix statfs */ |
---|
1114 | 1188 | #define EXT4_MOUNT_NOLOAD 0x00100 /* Don't use existing journal*/ |
---|
1115 | 1189 | #ifdef CONFIG_FS_DAX |
---|
1116 | | -#define EXT4_MOUNT_DAX 0x00200 /* Direct Access */ |
---|
| 1190 | +#define EXT4_MOUNT_DAX_ALWAYS 0x00200 /* Direct Access */ |
---|
1117 | 1191 | #else |
---|
1118 | | -#define EXT4_MOUNT_DAX 0 |
---|
| 1192 | +#define EXT4_MOUNT_DAX_ALWAYS 0 |
---|
1119 | 1193 | #endif |
---|
1120 | 1194 | #define EXT4_MOUNT_DATA_FLAGS 0x00C00 /* Mode for data writes: */ |
---|
1121 | 1195 | #define EXT4_MOUNT_JOURNAL_DATA 0x00400 /* Write data to journal */ |
---|
.. | .. |
---|
1140 | 1214 | #define EXT4_MOUNT_JOURNAL_CHECKSUM 0x800000 /* Journal checksums */ |
---|
1141 | 1215 | #define EXT4_MOUNT_JOURNAL_ASYNC_COMMIT 0x1000000 /* Journal Async Commit */ |
---|
1142 | 1216 | #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 |
---|
1144 | 1218 | #define EXT4_MOUNT_DELALLOC 0x8000000 /* Delalloc support */ |
---|
1145 | 1219 | #define EXT4_MOUNT_DATA_ERR_ABORT 0x10000000 /* Abort on file data write */ |
---|
1146 | 1220 | #define EXT4_MOUNT_BLOCK_VALIDITY 0x20000000 /* Block validity checking */ |
---|
.. | .. |
---|
1159 | 1233 | blocks */ |
---|
1160 | 1234 | #define EXT4_MOUNT2_HURD_COMPAT 0x00000004 /* Support HURD-castrated |
---|
1161 | 1235 | file systems */ |
---|
1162 | | - |
---|
1163 | 1236 | #define EXT4_MOUNT2_EXPLICIT_JOURNAL_CHECKSUM 0x00000008 /* User explicitly |
---|
1164 | 1237 | 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 | + |
---|
1165 | 1243 | |
---|
1166 | 1244 | #define clear_opt(sb, opt) EXT4_SB(sb)->s_mount_opt &= \ |
---|
1167 | 1245 | ~EXT4_MOUNT_##opt |
---|
.. | .. |
---|
1331 | 1409 | __u8 s_lastcheck_hi; |
---|
1332 | 1410 | __u8 s_first_error_time_hi; |
---|
1333 | 1411 | __u8 s_last_error_time_hi; |
---|
1334 | | - __u8 s_pad[2]; |
---|
| 1412 | + __u8 s_first_error_errcode; |
---|
| 1413 | + __u8 s_last_error_errcode; |
---|
1335 | 1414 | __le16 s_encoding; /* Filename charset encoding */ |
---|
1336 | 1415 | __le16 s_encoding_flags; /* Filename charset encoding flags */ |
---|
1337 | 1416 | __le32 s_reserved[95]; /* Padding to the end of the block */ |
---|
.. | .. |
---|
1341 | 1420 | #define EXT4_S_ERR_LEN (EXT4_S_ERR_END - EXT4_S_ERR_START) |
---|
1342 | 1421 | |
---|
1343 | 1422 | #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 |
---|
1356 | 1423 | |
---|
1357 | 1424 | /* Number of quota types we support */ |
---|
1358 | 1425 | #define EXT4_MAXQUOTAS 3 |
---|
.. | .. |
---|
1382 | 1449 | struct buffer_head * __rcu *s_group_desc; |
---|
1383 | 1450 | unsigned int s_mount_opt; |
---|
1384 | 1451 | unsigned int s_mount_opt2; |
---|
1385 | | - unsigned int s_mount_flags; |
---|
| 1452 | + unsigned long s_mount_flags; |
---|
1386 | 1453 | unsigned int s_def_mount_opt; |
---|
1387 | 1454 | ext4_fsblk_t s_sb_block; |
---|
1388 | 1455 | atomic64_t s_resv_clusters; |
---|
.. | .. |
---|
1403 | 1470 | struct percpu_counter s_freeinodes_counter; |
---|
1404 | 1471 | struct percpu_counter s_dirs_counter; |
---|
1405 | 1472 | struct percpu_counter s_dirtyclusters_counter; |
---|
| 1473 | + struct percpu_counter s_sra_exceeded_retry_limit; |
---|
1406 | 1474 | struct blockgroup_lock *s_blockgroup_lock; |
---|
1407 | 1475 | struct proc_dir_entry *s_proc; |
---|
1408 | 1476 | struct kobject s_kobj; |
---|
1409 | 1477 | struct completion s_kobj_unregister; |
---|
1410 | 1478 | struct super_block *s_sb; |
---|
| 1479 | + struct buffer_head *s_mmp_bh; |
---|
1411 | 1480 | |
---|
1412 | 1481 | /* Journaling */ |
---|
1413 | 1482 | struct journal_s *s_journal; |
---|
.. | .. |
---|
1417 | 1486 | unsigned long s_commit_interval; |
---|
1418 | 1487 | u32 s_max_batch_time; |
---|
1419 | 1488 | u32 s_min_batch_time; |
---|
1420 | | - struct block_device *journal_bdev; |
---|
| 1489 | + struct block_device *s_journal_bdev; |
---|
1421 | 1490 | #ifdef CONFIG_QUOTA |
---|
1422 | 1491 | /* Names of quota files with journalled quota */ |
---|
1423 | 1492 | char __rcu *s_qf_names[EXT4_MAXQUOTAS]; |
---|
1424 | 1493 | int s_jquota_fmt; /* Format of quota to use */ |
---|
1425 | 1494 | #endif |
---|
1426 | 1495 | 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; |
---|
1428 | 1497 | |
---|
1429 | 1498 | #ifdef EXTENTS_STATS |
---|
1430 | 1499 | /* ext4 extents stats */ |
---|
.. | .. |
---|
1455 | 1524 | unsigned int s_mb_stats; |
---|
1456 | 1525 | unsigned int s_mb_order2_reqs; |
---|
1457 | 1526 | unsigned int s_mb_group_prealloc; |
---|
| 1527 | + unsigned int s_mb_max_inode_prealloc; |
---|
1458 | 1528 | unsigned int s_max_dir_size_kb; |
---|
1459 | 1529 | /* where last allocation was done - for stream allocation */ |
---|
1460 | 1530 | unsigned long s_mb_last_group; |
---|
1461 | 1531 | unsigned long s_mb_last_start; |
---|
| 1532 | + unsigned int s_mb_prefetch; |
---|
| 1533 | + unsigned int s_mb_prefetch_limit; |
---|
1462 | 1534 | |
---|
1463 | 1535 | /* stats for buddy allocator */ |
---|
1464 | 1536 | atomic_t s_bal_reqs; /* number of reqs with len > 1 */ |
---|
1465 | 1537 | atomic_t s_bal_success; /* we found long enough chunks */ |
---|
1466 | 1538 | atomic_t s_bal_allocated; /* in blocks */ |
---|
1467 | 1539 | atomic_t s_bal_ex_scanned; /* total extents scanned */ |
---|
| 1540 | + atomic_t s_bal_groups_scanned; /* number of groups scanned */ |
---|
1468 | 1541 | atomic_t s_bal_goals; /* goal hits */ |
---|
1469 | 1542 | atomic_t s_bal_breaks; /* too long searches */ |
---|
1470 | 1543 | 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; |
---|
1474 | 1549 | atomic_t s_mb_lost_chunks; |
---|
1475 | 1550 | atomic_t s_mb_preallocated; |
---|
1476 | 1551 | atomic_t s_mb_discarded; |
---|
.. | .. |
---|
1505 | 1580 | struct task_struct *s_mmp_tsk; |
---|
1506 | 1581 | |
---|
1507 | 1582 | /* record the last minlen when FITRIM is called. */ |
---|
1508 | | - atomic_t s_last_trim_minblks; |
---|
| 1583 | + unsigned long s_last_trim_minblks; |
---|
1509 | 1584 | |
---|
1510 | 1585 | /* Reference to checksum algorithm driver via cryptoapi */ |
---|
1511 | 1586 | struct crypto_shash *s_chksum_driver; |
---|
.. | .. |
---|
1526 | 1601 | struct ratelimit_state s_err_ratelimit_state; |
---|
1527 | 1602 | struct ratelimit_state s_warning_ratelimit_state; |
---|
1528 | 1603 | struct ratelimit_state s_msg_ratelimit_state; |
---|
| 1604 | + atomic_t s_warning_count; |
---|
| 1605 | + atomic_t s_msg_count; |
---|
1529 | 1606 | |
---|
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; |
---|
1532 | 1609 | |
---|
1533 | 1610 | /* |
---|
1534 | 1611 | * Barrier between writepages ops and changing any inode's JOURNAL_DATA |
---|
.. | .. |
---|
1536 | 1613 | */ |
---|
1537 | 1614 | struct percpu_rw_semaphore s_writepages_rwsem; |
---|
1538 | 1615 | 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; |
---|
1539 | 1650 | }; |
---|
1540 | 1651 | |
---|
1541 | 1652 | static inline struct ext4_sb_info *EXT4_SB(struct super_block *sb) |
---|
.. | .. |
---|
1572 | 1683 | }) |
---|
1573 | 1684 | |
---|
1574 | 1685 | /* |
---|
| 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 | +/* |
---|
1575 | 1774 | * Inode dynamic state flags |
---|
1576 | 1775 | */ |
---|
1577 | 1776 | enum { |
---|
.. | .. |
---|
1581 | 1780 | EXT4_STATE_NO_EXPAND, /* No space for expansion */ |
---|
1582 | 1781 | EXT4_STATE_DA_ALLOC_CLOSE, /* Alloc DA blks on close */ |
---|
1583 | 1782 | EXT4_STATE_EXT_MIGRATE, /* Inode is migrating */ |
---|
1584 | | - EXT4_STATE_DIO_UNWRITTEN, /* need convert on dio done*/ |
---|
1585 | 1783 | EXT4_STATE_NEWENTRY, /* File just added to dir */ |
---|
1586 | 1784 | EXT4_STATE_MAY_INLINE_DATA, /* may have in-inode data */ |
---|
1587 | 1785 | EXT4_STATE_EXT_PRECACHED, /* extents have been precached */ |
---|
1588 | 1786 | EXT4_STATE_LUSTRE_EA_INODE, /* Lustre-style ea_inode */ |
---|
1589 | 1787 | EXT4_STATE_VERITY_IN_PROGRESS, /* building fs-verity Merkle tree */ |
---|
| 1788 | + EXT4_STATE_FC_COMMITTING, /* Fast commit ongoing */ |
---|
1590 | 1789 | }; |
---|
1591 | 1790 | |
---|
1592 | 1791 | #define EXT4_INODE_BIT_FNS(name, field, offset) \ |
---|
.. | .. |
---|
1665 | 1864 | |
---|
1666 | 1865 | #define EXT4_GOOD_OLD_INODE_SIZE 128 |
---|
1667 | 1866 | |
---|
| 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 | + |
---|
1668 | 1871 | /* |
---|
1669 | 1872 | * Feature set definitions |
---|
1670 | 1873 | */ |
---|
.. | .. |
---|
1676 | 1879 | #define EXT4_FEATURE_COMPAT_RESIZE_INODE 0x0010 |
---|
1677 | 1880 | #define EXT4_FEATURE_COMPAT_DIR_INDEX 0x0020 |
---|
1678 | 1881 | #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 |
---|
1679 | 1890 | #define EXT4_FEATURE_COMPAT_STABLE_INODES 0x0800 |
---|
1680 | 1891 | |
---|
1681 | 1892 | #define EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001 |
---|
.. | .. |
---|
1778 | 1989 | EXT4_FEATURE_COMPAT_FUNCS(resize_inode, RESIZE_INODE) |
---|
1779 | 1990 | EXT4_FEATURE_COMPAT_FUNCS(dir_index, DIR_INDEX) |
---|
1780 | 1991 | EXT4_FEATURE_COMPAT_FUNCS(sparse_super2, SPARSE_SUPER2) |
---|
| 1992 | +EXT4_FEATURE_COMPAT_FUNCS(fast_commit, FAST_COMMIT) |
---|
1781 | 1993 | EXT4_FEATURE_COMPAT_FUNCS(stable_inodes, STABLE_INODES) |
---|
1782 | 1994 | |
---|
1783 | 1995 | EXT4_FEATURE_RO_COMPAT_FUNCS(sparse_super, SPARSE_SUPER) |
---|
.. | .. |
---|
1892 | 2104 | */ |
---|
1893 | 2105 | #define EXT4_FLAGS_RESIZING 0 |
---|
1894 | 2106 | #define EXT4_FLAGS_SHUTDOWN 1 |
---|
| 2107 | +#define EXT4_FLAGS_BDEV_IS_DAX 2 |
---|
1895 | 2108 | |
---|
1896 | 2109 | static inline int ext4_forced_shutdown(struct ext4_sb_info *sbi) |
---|
1897 | 2110 | { |
---|
.. | .. |
---|
1945 | 2158 | * Structure of a directory entry |
---|
1946 | 2159 | */ |
---|
1947 | 2160 | #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) |
---|
1948 | 2165 | |
---|
1949 | 2166 | struct ext4_dir_entry { |
---|
1950 | 2167 | __le32 inode; /* Inode number */ |
---|
.. | .. |
---|
1974 | 2191 | __le32 inode; /* Inode number */ |
---|
1975 | 2192 | __le16 rec_len; /* Directory entry length */ |
---|
1976 | 2193 | __u8 name_len; /* Name length */ |
---|
1977 | | - __u8 file_type; |
---|
| 2194 | + __u8 file_type; /* See file type macros EXT4_FT_* below */ |
---|
1978 | 2195 | char name[EXT4_NAME_LEN]; /* File name */ |
---|
1979 | 2196 | }; |
---|
1980 | 2197 | |
---|
.. | .. |
---|
2122 | 2339 | BUG_ON(crypto_shash_descsize(sbi->s_chksum_driver)!=sizeof(desc.ctx)); |
---|
2123 | 2340 | |
---|
2124 | 2341 | desc.shash.tfm = sbi->s_chksum_driver; |
---|
2125 | | - desc.shash.flags = 0; |
---|
2126 | 2342 | *(u32 *)desc.ctx = crc; |
---|
2127 | 2343 | |
---|
2128 | 2344 | BUG_ON(crypto_shash_update(&desc.shash, address, length)); |
---|
.. | .. |
---|
2244 | 2460 | struct mutex li_list_mtx; |
---|
2245 | 2461 | }; |
---|
2246 | 2462 | |
---|
| 2463 | +enum ext4_li_mode { |
---|
| 2464 | + EXT4_LI_MODE_PREFETCH_BBITMAP, |
---|
| 2465 | + EXT4_LI_MODE_ITABLE, |
---|
| 2466 | +}; |
---|
| 2467 | + |
---|
2247 | 2468 | struct ext4_li_request { |
---|
2248 | 2469 | 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; |
---|
2250 | 2472 | ext4_group_t lr_next_group; |
---|
2251 | 2473 | struct list_head lr_request; |
---|
2252 | 2474 | unsigned long lr_next_sched; |
---|
.. | .. |
---|
2374 | 2596 | extern struct ext4_group_desc * ext4_get_group_desc(struct super_block * sb, |
---|
2375 | 2597 | ext4_group_t block_group, |
---|
2376 | 2598 | struct buffer_head ** bh); |
---|
| 2599 | +extern struct ext4_group_info *ext4_get_group_info(struct super_block *sb, |
---|
| 2600 | + ext4_group_t group); |
---|
2377 | 2601 | extern int ext4_should_retry_alloc(struct super_block *sb, int *retries); |
---|
2378 | 2602 | |
---|
2379 | 2603 | 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); |
---|
2381 | 2606 | extern int ext4_wait_block_bitmap(struct super_block *sb, |
---|
2382 | 2607 | ext4_group_t block_group, |
---|
2383 | 2608 | struct buffer_head *bh); |
---|
.. | .. |
---|
2551 | 2776 | struct dx_hash_info *hinfo); |
---|
2552 | 2777 | |
---|
2553 | 2778 | /* ialloc.c */ |
---|
| 2779 | +extern int ext4_mark_inode_used(struct super_block *sb, int ino); |
---|
2554 | 2780 | extern struct inode *__ext4_new_inode(handle_t *, struct inode *, umode_t, |
---|
2555 | 2781 | const struct qstr *qstr, __u32 goal, |
---|
2556 | 2782 | uid_t *owner, __u32 i_flags, |
---|
.. | .. |
---|
2576 | 2802 | ext4_group_t group, int barrier); |
---|
2577 | 2803 | extern void ext4_end_bitmap_read(struct buffer_head *bh, int uptodate); |
---|
2578 | 2804 | |
---|
| 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 | + |
---|
2579 | 2836 | /* mballoc.c */ |
---|
2580 | 2837 | extern const struct seq_operations ext4_mb_seq_groups_ops; |
---|
2581 | 2838 | extern long ext4_mb_stats; |
---|
2582 | 2839 | extern long ext4_mb_max_to_scan; |
---|
| 2840 | +extern int ext4_seq_mb_stats_show(struct seq_file *seq, void *offset); |
---|
2583 | 2841 | extern int ext4_mb_init(struct super_block *); |
---|
2584 | 2842 | extern int ext4_mb_release(struct super_block *); |
---|
2585 | 2843 | extern ext4_fsblk_t ext4_mb_new_blocks(handle_t *, |
---|
2586 | 2844 | struct ext4_allocation_request *, int *); |
---|
2587 | 2845 | 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); |
---|
2589 | 2847 | extern int __init ext4_init_mballoc(void); |
---|
2590 | 2848 | 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 | + |
---|
2591 | 2855 | extern void ext4_free_blocks(handle_t *handle, struct inode *inode, |
---|
2592 | 2856 | struct buffer_head *bh, ext4_fsblk_t block, |
---|
2593 | 2857 | unsigned long count, int flags); |
---|
.. | .. |
---|
2599 | 2863 | ext4_fsblk_t block, unsigned long count); |
---|
2600 | 2864 | extern int ext4_trim_fs(struct super_block *, struct fstrim_range *); |
---|
2601 | 2865 | 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); |
---|
2602 | 2868 | |
---|
2603 | 2869 | /* inode.c */ |
---|
| 2870 | +void ext4_inode_csum_set(struct inode *inode, struct ext4_inode *raw, |
---|
| 2871 | + struct ext4_inode_info *ei); |
---|
2604 | 2872 | int ext4_inode_is_fast_symlink(struct inode *inode); |
---|
2605 | 2873 | struct buffer_head *ext4_getblk(handle_t *, struct inode *, ext4_lblk_t, int); |
---|
2606 | 2874 | struct buffer_head *ext4_bread(handle_t *, struct inode *, ext4_lblk_t, int); |
---|
.. | .. |
---|
2610 | 2878 | struct buffer_head *bh_result, int create); |
---|
2611 | 2879 | int ext4_get_block(struct inode *inode, sector_t iblock, |
---|
2612 | 2880 | 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); |
---|
2615 | 2881 | int ext4_da_get_block_prep(struct inode *inode, sector_t iblock, |
---|
2616 | 2882 | struct buffer_head *bh, int create); |
---|
2617 | 2883 | int ext4_walk_page_buffers(handle_t *handle, |
---|
.. | .. |
---|
2629 | 2895 | typedef enum { |
---|
2630 | 2896 | EXT4_IGET_NORMAL = 0, |
---|
2631 | 2897 | 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 */ |
---|
2633 | 2901 | } ext4_iget_flags; |
---|
2634 | 2902 | |
---|
2635 | 2903 | extern struct inode *__ext4_iget(struct super_block *sb, unsigned long ino, |
---|
.. | .. |
---|
2649 | 2917 | extern void ext4_dirty_inode(struct inode *, int); |
---|
2650 | 2918 | extern int ext4_change_inode_journal_flag(struct inode *, int); |
---|
2651 | 2919 | 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); |
---|
2652 | 2922 | extern int ext4_inode_attach_jinode(struct inode *inode); |
---|
2653 | 2923 | extern int ext4_can_truncate(struct inode *inode); |
---|
2654 | 2924 | extern int ext4_truncate(struct inode *); |
---|
2655 | 2925 | 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); |
---|
2659 | 2928 | extern int ext4_alloc_da_blocks(struct inode *inode); |
---|
2660 | 2929 | extern void ext4_set_aops(struct inode *inode); |
---|
2661 | 2930 | extern int ext4_writepage_trans_blocks(struct inode *); |
---|
2662 | 2931 | extern int ext4_chunk_trans_blocks(struct inode *, int nrblocks); |
---|
2663 | 2932 | extern int ext4_zero_partial_blocks(handle_t *handle, struct inode *inode, |
---|
2664 | 2933 | 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); |
---|
2667 | 2936 | extern qsize_t *ext4_get_reserved_space(struct inode *inode); |
---|
2668 | 2937 | extern int ext4_get_projid(struct inode *inode, kprojid_t *projid); |
---|
| 2938 | +extern void ext4_da_release_space(struct inode *inode, int to_free); |
---|
2669 | 2939 | extern void ext4_da_update_reserve_space(struct inode *inode, |
---|
2670 | 2940 | int used, int quota_claim); |
---|
2671 | 2941 | extern int ext4_issue_zeroout(struct inode *inode, ext4_lblk_t lblk, |
---|
.. | .. |
---|
2674 | 2944 | /* indirect.c */ |
---|
2675 | 2945 | extern int ext4_ind_map_blocks(handle_t *handle, struct inode *inode, |
---|
2676 | 2946 | struct ext4_map_blocks *map, int flags); |
---|
2677 | | -extern int ext4_ind_calc_metadata_amount(struct inode *inode, sector_t lblock); |
---|
2678 | 2947 | extern int ext4_ind_trans_blocks(struct inode *inode, int nrblocks); |
---|
2679 | 2948 | extern void ext4_ind_truncate(handle_t *, struct inode *inode); |
---|
2680 | 2949 | extern int ext4_ind_remove_space(handle_t *handle, struct inode *inode, |
---|
.. | .. |
---|
2683 | 2952 | /* ioctl.c */ |
---|
2684 | 2953 | extern long ext4_ioctl(struct file *, unsigned int, unsigned long); |
---|
2685 | 2954 | extern long ext4_compat_ioctl(struct file *, unsigned int, unsigned long); |
---|
| 2955 | +extern void ext4_reset_inode_seed(struct inode *inode); |
---|
2686 | 2956 | |
---|
2687 | 2957 | /* migrate.c */ |
---|
2688 | 2958 | extern int ext4_ext_migrate(struct inode *); |
---|
2689 | 2959 | extern int ext4_ind_migrate(struct inode *inode); |
---|
2690 | 2960 | |
---|
2691 | 2961 | /* 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); |
---|
2694 | 2966 | extern int ext4_orphan_add(handle_t *, struct inode *); |
---|
2695 | 2967 | extern int ext4_orphan_del(handle_t *, struct inode *); |
---|
2696 | 2968 | extern int ext4_htree_fill_tree(struct file *dir_file, __u32 start_hash, |
---|
.. | .. |
---|
2702 | 2974 | struct ext4_filename *fname, |
---|
2703 | 2975 | ext4_lblk_t lblk, unsigned int offset, |
---|
2704 | 2976 | 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, |
---|
2707 | 2978 | struct ext4_dir_entry_2 *de_del, |
---|
2708 | 2979 | ext4_lblk_t lblk, |
---|
2709 | 2980 | struct buffer_head *bh, |
---|
.. | .. |
---|
2724 | 2995 | /* super.c */ |
---|
2725 | 2996 | extern struct buffer_head *ext4_sb_bread(struct super_block *sb, |
---|
2726 | 2997 | 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); |
---|
2727 | 3006 | extern int ext4_seq_options_show(struct seq_file *seq, void *offset); |
---|
2728 | 3007 | extern int ext4_calculate_overhead(struct super_block *sb); |
---|
2729 | 3008 | 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); |
---|
2732 | 3009 | extern int ext4_alloc_flex_bg_array(struct super_block *sb, |
---|
2733 | 3010 | ext4_group_t ngroup); |
---|
2734 | 3011 | extern const char *ext4_decode_error(struct super_block *sb, int errno, |
---|
.. | .. |
---|
2736 | 3013 | extern void ext4_mark_group_bitmap_corrupted(struct super_block *sb, |
---|
2737 | 3014 | ext4_group_t block_group, |
---|
2738 | 3015 | unsigned int flags); |
---|
| 3016 | +extern unsigned int ext4_num_base_meta_blocks(struct super_block *sb, |
---|
| 3017 | + ext4_group_t block_group); |
---|
2739 | 3018 | |
---|
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, |
---|
2742 | 3021 | 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 *, ...); |
---|
2746 | 3025 | extern __printf(5, 6) |
---|
2747 | 3026 | void __ext4_error_file(struct file *, const char *, unsigned int, ext4_fsblk_t, |
---|
2748 | 3027 | const char *, ...); |
---|
2749 | 3028 | extern void __ext4_std_error(struct super_block *, const char *, |
---|
2750 | 3029 | 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, |
---|
2753 | 3032 | const char *, ...); |
---|
2754 | 3033 | extern __printf(4, 5) |
---|
2755 | 3034 | void __ext4_warning(struct super_block *, const char *, unsigned int, |
---|
.. | .. |
---|
2770 | 3049 | #define EXT4_ERROR_INODE(inode, fmt, a...) \ |
---|
2771 | 3050 | ext4_error_inode((inode), __func__, __LINE__, 0, (fmt), ## a) |
---|
2772 | 3051 | |
---|
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) |
---|
2775 | 3058 | |
---|
2776 | 3059 | #define EXT4_ERROR_FILE(file, block, fmt, a...) \ |
---|
2777 | 3060 | ext4_error_file((file), __func__, __LINE__, (block), (fmt), ## a) |
---|
.. | .. |
---|
2779 | 3062 | #ifdef CONFIG_PRINTK |
---|
2780 | 3063 | |
---|
2781 | 3064 | #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__) |
---|
2783 | 3069 | #define ext4_error_file(file, func, line, block, fmt, ...) \ |
---|
2784 | 3070 | __ext4_error_file(file, func, line, block, fmt, ##__VA_ARGS__) |
---|
2785 | 3071 | #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__) |
---|
2789 | 3077 | #define ext4_warning(sb, fmt, ...) \ |
---|
2790 | 3078 | __ext4_warning(sb, __func__, __LINE__, fmt, ##__VA_ARGS__) |
---|
2791 | 3079 | #define ext4_warning_inode(inode, fmt, ...) \ |
---|
.. | .. |
---|
2803 | 3091 | #define ext4_error_inode(inode, func, line, block, fmt, ...) \ |
---|
2804 | 3092 | do { \ |
---|
2805 | 3093 | 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, " "); \ |
---|
2807 | 3100 | } while (0) |
---|
2808 | 3101 | #define ext4_error_file(file, func, line, block, fmt, ...) \ |
---|
2809 | 3102 | do { \ |
---|
.. | .. |
---|
2813 | 3106 | #define ext4_error(sb, fmt, ...) \ |
---|
2814 | 3107 | do { \ |
---|
2815 | 3108 | no_printk(fmt, ##__VA_ARGS__); \ |
---|
2816 | | - __ext4_error(sb, "", 0, " "); \ |
---|
| 3109 | + __ext4_error(sb, "", 0, 0, 0, " "); \ |
---|
2817 | 3110 | } while (0) |
---|
2818 | | -#define ext4_abort(sb, fmt, ...) \ |
---|
| 3111 | +#define ext4_error_err(sb, err, fmt, ...) \ |
---|
2819 | 3112 | do { \ |
---|
2820 | 3113 | 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, " "); \ |
---|
2822 | 3120 | } while (0) |
---|
2823 | 3121 | #define ext4_warning(sb, fmt, ...) \ |
---|
2824 | 3122 | do { \ |
---|
.. | .. |
---|
2845 | 3143 | |
---|
2846 | 3144 | #endif |
---|
2847 | 3145 | |
---|
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); |
---|
2854 | 3146 | extern ext4_fsblk_t ext4_block_bitmap(struct super_block *sb, |
---|
2855 | 3147 | struct ext4_group_desc *bg); |
---|
2856 | 3148 | extern ext4_fsblk_t ext4_inode_bitmap(struct super_block *sb, |
---|
.. | .. |
---|
2901 | 3193 | return ext4_has_feature_gdt_csum(sb) || ext4_has_metadata_csum(sb); |
---|
2902 | 3194 | } |
---|
2903 | 3195 | |
---|
| 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 | + |
---|
2904 | 3201 | static inline ext4_fsblk_t ext4_blocks_count(struct ext4_super_block *es) |
---|
2905 | 3202 | { |
---|
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); |
---|
2908 | 3204 | } |
---|
2909 | 3205 | |
---|
2910 | 3206 | static inline ext4_fsblk_t ext4_r_blocks_count(struct ext4_super_block *es) |
---|
2911 | 3207 | { |
---|
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); |
---|
2914 | 3209 | } |
---|
2915 | 3210 | |
---|
2916 | 3211 | static inline ext4_fsblk_t ext4_free_blocks_count(struct ext4_super_block *es) |
---|
2917 | 3212 | { |
---|
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); |
---|
2920 | 3214 | } |
---|
2921 | 3215 | |
---|
2922 | 3216 | static inline void ext4_blocks_count_set(struct ext4_super_block *es, |
---|
.. | .. |
---|
2955 | 3249 | { |
---|
2956 | 3250 | raw_inode->i_size_lo = cpu_to_le32(i_size); |
---|
2957 | 3251 | 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]; |
---|
2971 | 3252 | } |
---|
2972 | 3253 | |
---|
2973 | 3254 | /* |
---|
.. | .. |
---|
3042 | 3323 | |
---|
3043 | 3324 | struct ext4_group_info { |
---|
3044 | 3325 | unsigned long bb_state; |
---|
| 3326 | +#ifdef AGGRESSIVE_CHECK |
---|
| 3327 | + unsigned long bb_check_counter; |
---|
| 3328 | +#endif |
---|
3045 | 3329 | struct rb_root bb_free_root; |
---|
3046 | 3330 | ext4_grpblk_t bb_first_free; /* first free block */ |
---|
3047 | 3331 | ext4_grpblk_t bb_free; /* total free blocks */ |
---|
.. | .. |
---|
3066 | 3350 | (1 << EXT4_GROUP_INFO_BBITMAP_CORRUPT_BIT) |
---|
3067 | 3351 | #define EXT4_GROUP_INFO_IBITMAP_CORRUPT \ |
---|
3068 | 3352 | (1 << EXT4_GROUP_INFO_IBITMAP_CORRUPT_BIT) |
---|
| 3353 | +#define EXT4_GROUP_INFO_BBITMAP_READ_BIT 4 |
---|
3069 | 3354 | |
---|
3070 | 3355 | #define EXT4_MB_GRP_NEED_INIT(grp) \ |
---|
3071 | 3356 | (test_bit(EXT4_GROUP_INFO_NEED_INIT_BIT, &((grp)->bb_state))) |
---|
.. | .. |
---|
3080 | 3365 | (set_bit(EXT4_GROUP_INFO_WAS_TRIMMED_BIT, &((grp)->bb_state))) |
---|
3081 | 3366 | #define EXT4_MB_GRP_CLEAR_TRIMMED(grp) \ |
---|
3082 | 3367 | (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))) |
---|
3083 | 3370 | |
---|
3084 | 3371 | #define EXT4_MAX_CONTENTION 8 |
---|
3085 | 3372 | #define EXT4_CONTENTION_THRESHOLD 2 |
---|
.. | .. |
---|
3145 | 3432 | /* dir.c */ |
---|
3146 | 3433 | extern const struct file_operations ext4_dir_operations; |
---|
3147 | 3434 | |
---|
3148 | | -#ifdef CONFIG_UNICODE |
---|
3149 | | -extern const struct dentry_operations ext4_dentry_ops; |
---|
3150 | | -#endif |
---|
3151 | | - |
---|
3152 | 3435 | /* file.c */ |
---|
3153 | 3436 | extern const struct inode_operations ext4_file_inode_operations; |
---|
3154 | 3437 | extern const struct file_operations ext4_file_operations; |
---|
.. | .. |
---|
3193 | 3476 | extern int ext4_read_inline_dir(struct file *filp, |
---|
3194 | 3477 | struct dir_context *ctx, |
---|
3195 | 3478 | 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); |
---|
3201 | 3484 | extern struct buffer_head *ext4_find_inline_entry(struct inode *dir, |
---|
3202 | 3485 | struct ext4_filename *fname, |
---|
3203 | 3486 | struct ext4_dir_entry_2 **res_dir, |
---|
.. | .. |
---|
3236 | 3519 | struct ext4_dir_entry_2 *de, |
---|
3237 | 3520 | int blocksize, int csum_size, |
---|
3238 | 3521 | 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); |
---|
3244 | 3530 | |
---|
3245 | 3531 | #define S_SHIFT 12 |
---|
3246 | 3532 | static const unsigned char ext4_type_by_mode[(S_IFMT >> S_SHIFT) + 1] = { |
---|
.. | .. |
---|
3261 | 3547 | } |
---|
3262 | 3548 | |
---|
3263 | 3549 | /* 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); |
---|
3267 | 3552 | extern int __init ext4_init_post_read_processing(void); |
---|
3268 | 3553 | extern void ext4_exit_post_read_processing(void); |
---|
3269 | 3554 | |
---|
.. | .. |
---|
3288 | 3573 | unsigned int count); |
---|
3289 | 3574 | extern int ext4_check_blockref(const char *, unsigned int, |
---|
3290 | 3575 | 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 | + |
---|
3291 | 3579 | |
---|
3292 | 3580 | /* extents.c */ |
---|
3293 | 3581 | struct ext4_ext_path; |
---|
.. | .. |
---|
3299 | 3587 | */ |
---|
3300 | 3588 | #define EXT_MAX_BLOCKS 0xffffffff |
---|
3301 | 3589 | |
---|
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); |
---|
3304 | 3591 | extern int ext4_ext_index_trans_blocks(struct inode *inode, int extents); |
---|
3305 | 3592 | extern int ext4_ext_map_blocks(handle_t *handle, struct inode *inode, |
---|
3306 | 3593 | struct ext4_map_blocks *map, int flags); |
---|
.. | .. |
---|
3313 | 3600 | loff_t len); |
---|
3314 | 3601 | extern int ext4_convert_unwritten_extents(handle_t *handle, struct inode *inode, |
---|
3315 | 3602 | 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); |
---|
3316 | 3605 | extern int ext4_map_blocks(handle_t *handle, struct inode *inode, |
---|
3317 | 3606 | struct ext4_map_blocks *map, int flags); |
---|
3318 | | -extern int ext4_ext_calc_metadata_amount(struct inode *inode, |
---|
3319 | | - ext4_lblk_t lblocks); |
---|
3320 | 3607 | extern int ext4_ext_calc_credits_for_single_extent(struct inode *inode, |
---|
3321 | 3608 | int num, |
---|
3322 | 3609 | 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); |
---|
3326 | 3610 | extern int ext4_ext_insert_extent(handle_t *, struct inode *, |
---|
3327 | 3611 | struct ext4_ext_path **, |
---|
3328 | 3612 | struct ext4_extent *, int); |
---|
.. | .. |
---|
3331 | 3615 | int flags); |
---|
3332 | 3616 | extern void ext4_ext_drop_refs(struct ext4_ext_path *); |
---|
3333 | 3617 | 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); |
---|
3338 | 3618 | extern ext4_lblk_t ext4_ext_next_allocated_block(struct ext4_ext_path *path); |
---|
3339 | 3619 | extern int ext4_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, |
---|
3340 | 3620 | __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); |
---|
3341 | 3624 | 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); |
---|
3344 | 3625 | extern int ext4_swap_extents(handle_t *handle, struct inode *inode1, |
---|
3345 | 3626 | struct inode *inode2, ext4_lblk_t lblk1, |
---|
3346 | 3627 | ext4_lblk_t lblk2, ext4_lblk_t count, |
---|
3347 | 3628 | 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 | + |
---|
3348 | 3639 | |
---|
3349 | 3640 | /* move_extent.c */ |
---|
3350 | 3641 | extern void ext4_double_down_write_data_sem(struct inode *first, |
---|
.. | .. |
---|
3371 | 3662 | int len, |
---|
3372 | 3663 | struct writeback_control *wbc, |
---|
3373 | 3664 | 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); |
---|
3374 | 3667 | |
---|
3375 | 3668 | /* mmp.c */ |
---|
3376 | 3669 | 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); |
---|
3377 | 3673 | |
---|
3378 | 3674 | /* verity.c */ |
---|
3379 | 3675 | extern const struct fsverity_operations ext4_verityops; |
---|
.. | .. |
---|
3428 | 3724 | } |
---|
3429 | 3725 | |
---|
3430 | 3726 | 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 | +} |
---|
3431 | 3742 | |
---|
3432 | 3743 | #endif /* __KERNEL__ */ |
---|
3433 | 3744 | |
---|