aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-11-14 15:59:42 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2017-11-14 15:59:42 -0500
commitae9a8c4bdc91202b4236372eed53c54d2297c71b (patch)
tree4596680ee808334d246ad2f93bdd743d76c3741a
parent32190f0afbf4f1c0a9142e5a886a078ee0b794fd (diff)
parent232530680290ba94ca37852ab10d9556ea28badf (diff)
Merge tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
Pull ext4 updates from Ted Ts'o: - Add support for online resizing of file systems with bigalloc - Fix a two data corruption bugs involving DAX, as well as a corruption bug after a crash during a racing fallocate and delayed allocation. - Finally, a number of cleanups and optimizations. * tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4: ext4: improve smp scalability for inode generation ext4: add support for online resizing with bigalloc ext4: mention noload when recovering on read-only device Documentation: fix little inconsistencies ext4: convert timers to use timer_setup() jbd2: convert timers to use timer_setup() ext4: remove duplicate extended attributes defs ext4: add ext4_should_use_dax() ext4: add sanity check for encryption + DAX ext4: prevent data corruption with journaling + DAX ext4: prevent data corruption with inline data + DAX ext4: fix interaction between i_size, fallocate, and delalloc after a crash ext4: retry allocations conservatively ext4: Switch to iomap for SEEK_HOLE / SEEK_DATA ext4: Add iomap support for inline data iomap: Add IOMAP_F_DATA_INLINE flag iomap: Switch from blkno to disk offset
-rw-r--r--fs/buffer.c4
-rw-r--r--fs/dax.c2
-rw-r--r--fs/ext2/inode.c4
-rw-r--r--fs/ext4/Kconfig1
-rw-r--r--fs/ext4/balloc.c15
-rw-r--r--fs/ext4/ext4.h50
-rw-r--r--fs/ext4/extents.c6
-rw-r--r--fs/ext4/file.c263
-rw-r--r--fs/ext4/ialloc.c4
-rw-r--r--fs/ext4/inline.c43
-rw-r--r--fs/ext4/inode.c153
-rw-r--r--fs/ext4/ioctl.c30
-rw-r--r--fs/ext4/mballoc.c28
-rw-r--r--fs/ext4/resize.c104
-rw-r--r--fs/ext4/super.c27
-rw-r--r--fs/iomap.c13
-rw-r--r--fs/jbd2/journal.c9
-rw-r--r--fs/nfsd/blocklayout.c4
-rw-r--r--fs/xfs/xfs_iomap.c6
-rw-r--r--include/linux/iomap.h15
20 files changed, 274 insertions, 507 deletions
diff --git a/fs/buffer.c b/fs/buffer.c
index 32ce01f0f95f..49b7e9bdcd1d 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -1979,8 +1979,8 @@ iomap_to_bh(struct inode *inode, sector_t block, struct buffer_head *bh,
1979 case IOMAP_MAPPED: 1979 case IOMAP_MAPPED:
1980 if (offset >= i_size_read(inode)) 1980 if (offset >= i_size_read(inode))
1981 set_buffer_new(bh); 1981 set_buffer_new(bh);
1982 bh->b_blocknr = (iomap->blkno >> (inode->i_blkbits - 9)) + 1982 bh->b_blocknr = (iomap->addr + offset - iomap->offset) >>
1983 ((offset - iomap->offset) >> inode->i_blkbits); 1983 inode->i_blkbits;
1984 set_buffer_mapped(bh); 1984 set_buffer_mapped(bh);
1985 break; 1985 break;
1986 } 1986 }
diff --git a/fs/dax.c b/fs/dax.c
index f001d8c72a06..f3a44a7c14b3 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -938,7 +938,7 @@ EXPORT_SYMBOL_GPL(__dax_zero_page_range);
938 938
939static sector_t dax_iomap_sector(struct iomap *iomap, loff_t pos) 939static sector_t dax_iomap_sector(struct iomap *iomap, loff_t pos)
940{ 940{
941 return iomap->blkno + (((pos & PAGE_MASK) - iomap->offset) >> 9); 941 return (iomap->addr + (pos & PAGE_MASK) - iomap->offset) >> 9;
942} 942}
943 943
944static loff_t 944static loff_t
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c
index 1442a4c734c8..9b2ac55ac34f 100644
--- a/fs/ext2/inode.c
+++ b/fs/ext2/inode.c
@@ -821,11 +821,11 @@ static int ext2_iomap_begin(struct inode *inode, loff_t offset, loff_t length,
821 821
822 if (ret == 0) { 822 if (ret == 0) {
823 iomap->type = IOMAP_HOLE; 823 iomap->type = IOMAP_HOLE;
824 iomap->blkno = IOMAP_NULL_BLOCK; 824 iomap->addr = IOMAP_NULL_ADDR;
825 iomap->length = 1 << blkbits; 825 iomap->length = 1 << blkbits;
826 } else { 826 } else {
827 iomap->type = IOMAP_MAPPED; 827 iomap->type = IOMAP_MAPPED;
828 iomap->blkno = (sector_t)bno << (blkbits - 9); 828 iomap->addr = (u64)bno << blkbits;
829 iomap->length = (u64)ret << blkbits; 829 iomap->length = (u64)ret << blkbits;
830 iomap->flags |= IOMAP_F_MERGED; 830 iomap->flags |= IOMAP_F_MERGED;
831 } 831 }
diff --git a/fs/ext4/Kconfig b/fs/ext4/Kconfig
index e38039fd96ff..73b850f5659c 100644
--- a/fs/ext4/Kconfig
+++ b/fs/ext4/Kconfig
@@ -37,6 +37,7 @@ config EXT4_FS
37 select CRC16 37 select CRC16
38 select CRYPTO 38 select CRYPTO
39 select CRYPTO_CRC32C 39 select CRYPTO_CRC32C
40 select FS_IOMAP
40 help 41 help
41 This is the next generation of the ext3 filesystem. 42 This is the next generation of the ext3 filesystem.
42 43
diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
index d5ddfb96c83c..a943e568292e 100644
--- a/fs/ext4/balloc.c
+++ b/fs/ext4/balloc.c
@@ -601,22 +601,21 @@ int ext4_claim_free_clusters(struct ext4_sb_info *sbi,
601 * ext4_should_retry_alloc() is called when ENOSPC is returned, and if 601 * ext4_should_retry_alloc() is called when ENOSPC is returned, and if
602 * it is profitable to retry the operation, this function will wait 602 * it is profitable to retry the operation, this function will wait
603 * for the current or committing transaction to complete, and then 603 * for the current or committing transaction to complete, and then
604 * return TRUE. 604 * return TRUE. We will only retry once.
605 *
606 * if the total number of retries exceed three times, return FALSE.
607 */ 605 */
608int ext4_should_retry_alloc(struct super_block *sb, int *retries) 606int ext4_should_retry_alloc(struct super_block *sb, int *retries)
609{ 607{
610 if (!ext4_has_free_clusters(EXT4_SB(sb), 1, 0) || 608 if (!ext4_has_free_clusters(EXT4_SB(sb), 1, 0) ||
611 (*retries)++ > 3 || 609 (*retries)++ > 1 ||
612 !EXT4_SB(sb)->s_journal) 610 !EXT4_SB(sb)->s_journal)
613 return 0; 611 return 0;
614 612
615 jbd_debug(1, "%s: retrying operation after ENOSPC\n", sb->s_id);
616
617 smp_mb(); 613 smp_mb();
618 if (EXT4_SB(sb)->s_mb_free_pending) 614 if (EXT4_SB(sb)->s_mb_free_pending == 0)
619 jbd2_journal_force_commit_nested(EXT4_SB(sb)->s_journal); 615 return 0;
616
617 jbd_debug(1, "%s: retrying operation after ENOSPC\n", sb->s_id);
618 jbd2_journal_force_commit_nested(EXT4_SB(sb)->s_journal);
620 return 1; 619 return 1;
621} 620}
622 621
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index 27f38bb5046d..4e091eae38b1 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -544,8 +544,8 @@ struct ext4_new_group_data {
544 __u64 inode_table; 544 __u64 inode_table;
545 __u32 blocks_count; 545 __u32 blocks_count;
546 __u16 reserved_blocks; 546 __u16 reserved_blocks;
547 __u16 unused; 547 __u16 mdata_blocks;
548 __u32 free_blocks_count; 548 __u32 free_clusters_count;
549}; 549};
550 550
551/* Indexes used to index group tables in ext4_new_group_data */ 551/* Indexes used to index group tables in ext4_new_group_data */
@@ -643,43 +643,6 @@ enum {
643#define EXT4_IOC_GET_ENCRYPTION_PWSALT FS_IOC_GET_ENCRYPTION_PWSALT 643#define EXT4_IOC_GET_ENCRYPTION_PWSALT FS_IOC_GET_ENCRYPTION_PWSALT
644#define EXT4_IOC_GET_ENCRYPTION_POLICY FS_IOC_GET_ENCRYPTION_POLICY 644#define EXT4_IOC_GET_ENCRYPTION_POLICY FS_IOC_GET_ENCRYPTION_POLICY
645 645
646#ifndef FS_IOC_FSGETXATTR
647/* Until the uapi changes get merged for project quota... */
648
649#define FS_IOC_FSGETXATTR _IOR('X', 31, struct fsxattr)
650#define FS_IOC_FSSETXATTR _IOW('X', 32, struct fsxattr)
651
652/*
653 * Structure for FS_IOC_FSGETXATTR and FS_IOC_FSSETXATTR.
654 */
655struct fsxattr {
656 __u32 fsx_xflags; /* xflags field value (get/set) */
657 __u32 fsx_extsize; /* extsize field value (get/set)*/
658 __u32 fsx_nextents; /* nextents field value (get) */
659 __u32 fsx_projid; /* project identifier (get/set) */
660 unsigned char fsx_pad[12];
661};
662
663/*
664 * Flags for the fsx_xflags field
665 */
666#define FS_XFLAG_REALTIME 0x00000001 /* data in realtime volume */
667#define FS_XFLAG_PREALLOC 0x00000002 /* preallocated file extents */
668#define FS_XFLAG_IMMUTABLE 0x00000008 /* file cannot be modified */
669#define FS_XFLAG_APPEND 0x00000010 /* all writes append */
670#define FS_XFLAG_SYNC 0x00000020 /* all writes synchronous */
671#define FS_XFLAG_NOATIME 0x00000040 /* do not update access time */
672#define FS_XFLAG_NODUMP 0x00000080 /* do not include in backups */
673#define FS_XFLAG_RTINHERIT 0x00000100 /* create with rt bit set */
674#define FS_XFLAG_PROJINHERIT 0x00000200 /* create with parents projid */
675#define FS_XFLAG_NOSYMLINKS 0x00000400 /* disallow symlink creation */
676#define FS_XFLAG_EXTSIZE 0x00000800 /* extent size allocator hint */
677#define FS_XFLAG_EXTSZINHERIT 0x00001000 /* inherit inode extent size */
678#define FS_XFLAG_NODEFRAG 0x00002000 /* do not defragment */
679#define FS_XFLAG_FILESTREAM 0x00004000 /* use filestream allocator */
680#define FS_XFLAG_HASATTR 0x80000000 /* no DIFLAG for this */
681#endif /* !defined(FS_IOC_FSGETXATTR) */
682
683#define EXT4_IOC_FSGETXATTR FS_IOC_FSGETXATTR 646#define EXT4_IOC_FSGETXATTR FS_IOC_FSGETXATTR
684#define EXT4_IOC_FSSETXATTR FS_IOC_FSSETXATTR 647#define EXT4_IOC_FSSETXATTR FS_IOC_FSSETXATTR
685 648
@@ -1391,8 +1354,6 @@ struct ext4_sb_info {
1391 int s_first_ino; 1354 int s_first_ino;
1392 unsigned int s_inode_readahead_blks; 1355 unsigned int s_inode_readahead_blks;
1393 unsigned int s_inode_goal; 1356 unsigned int s_inode_goal;
1394 spinlock_t s_next_gen_lock;
1395 u32 s_next_generation;
1396 u32 s_hash_seed[4]; 1357 u32 s_hash_seed[4];
1397 int s_def_hash_version; 1358 int s_def_hash_version;
1398 int s_hash_unsigned; /* 3 if hash should be signed, 0 if not */ 1359 int s_hash_unsigned; /* 3 if hash should be signed, 0 if not */
@@ -2514,9 +2475,6 @@ extern void ext4_da_update_reserve_space(struct inode *inode,
2514 int used, int quota_claim); 2475 int used, int quota_claim);
2515extern int ext4_issue_zeroout(struct inode *inode, ext4_lblk_t lblk, 2476extern int ext4_issue_zeroout(struct inode *inode, ext4_lblk_t lblk,
2516 ext4_fsblk_t pblk, ext4_lblk_t len); 2477 ext4_fsblk_t pblk, ext4_lblk_t len);
2517extern int ext4_get_next_extent(struct inode *inode, ext4_lblk_t lblk,
2518 unsigned int