Commit fbeea4db authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'ext4_for_linus-6.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4

Pull ext4 updates from Ted Ts'o:
 "New features and improvements for the ext4 file system:
   - Optimize online defragmentation by using folios instead of
     individual buffer heads
   - Improve error codes stored in the superblock when the journal
     aborts
   - Minor cleanups and clarifications in ext4_map_blocks()
   - Add documentation of the casefold and encrypt flags
   - Add support for file systems with a blocksize greater than the
     pagesize
   - Improve performance by enabling the caching the fact that an inode
     does not have a Posix ACL

  Various Bug Fixes:
   - Fix false positive complaints from smatch
   - Fix error code which is returned by ext4fs_dirhash() when Siphash
     is used without the encryption key
   - Fix races when writing to inline data files which could trigger a
     BUG
   - Fix potential NULL dereference when there is an corrupt file system
     with an extended attribute value stored in a inode
   - Fix false positive lockdep report when syzbot uses ext4 and ocfs2
     together
   - Fix false positive reported by DEPT by adjusting lock annotation
   - Avoid a potential BUG_ON in jbd2 when a file system is massively
     corrupted
   - Fix a WARN_ON when superblock is corrupted with a non-NULL
     terminated mount options field
   - Add check if the userspace passes in a non-NULL terminated mount
     options field to EXT4_IOC_SET_TUNE_SB_PARAM
   - Fix a potential journal checksum failure whena file system is
     copied while it is mounted read-only
   - Fix a potential potential orphan file tracking error which only
     showed on 32-bit systems
   - Fix assertion checks in mballoc (which have to be explicitly enbled
     by manually enabling AGGRESSIVE_CHECKS and recompiling)
   - Avoid complaining about overly large orphan files created by mke2fs
     with with file systems with a 64k block size"

* tag 'ext4_for_linus-6.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4: (58 commits)
  ext4: mark inodes without acls in __ext4_iget()
  ext4: enable block size larger than page size
  ext4: add checks for large folio incompatibilities when BS > PS
  ext4: support verifying data from large folios with fs-verity
  ext4: make data=journal support large block size
  ext4: support large block size in __ext4_block_zero_page_range()
  ext4: support large block size in mpage_prepare_extent_to_map()
  ext4: support large block size in mpage_map_and_submit_buffers()
  ext4: support large block size in ext4_block_write_begin()
  ext4: support large block size in ext4_mpage_readpages()
  ext4: rename 'page' references to 'folio' in multi-block allocator
  ext4: prepare buddy cache inode for BS > PS with large folios
  ext4: support large block size in ext4_mb_init_cache()
  ext4: support large block size in ext4_mb_get_buddy_page_lock()
  ext4: support large block size in ext4_mb_load_buddy_gfp()
  ext4: add EXT4_LBLK_TO_PG and EXT4_PG_TO_LBLK for block/page conversion
  ext4: add EXT4_LBLK_TO_B macro for logical block to bytes conversion
  ext4: support large block size in ext4_readdir()
  ext4: support large block size in ext4_calculate_overhead()
  ext4: introduce s_min_folio_order for future BS > PS support
  ...
parents afcbce74 91ef18b5
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -297,6 +297,8 @@ The ``i_flags`` field is a combination of these values:
     - Inode has inline data (EXT4_INLINE_DATA_FL).
   * - 0x20000000
     - Create children with the same project ID (EXT4_PROJINHERIT_FL).
   * - 0x40000000
     - Use case-insensitive lookups for directory contents (EXT4_CASEFOLD_FL).
   * - 0x80000000
     - Reserved for ext4 library (EXT4_RESERVED_FL).
   * -
+3 −1
Original line number Diff line number Diff line
@@ -671,7 +671,9 @@ following:
   * - 0x8000
     - Data in inode (INCOMPAT_INLINE_DATA).
   * - 0x10000
     - Encrypted inodes are present on the filesystem. (INCOMPAT_ENCRYPT).
     - Encrypted inodes can be present. (INCOMPAT_ENCRYPT).
   * - 0x20000
     - Directories can be marked case-insensitive. (INCOMPAT_CASEFOLD).

.. _super_rocompat:

+1 −1
Original line number Diff line number Diff line
@@ -752,7 +752,7 @@ ext4_fsblk_t ext4_new_meta_blocks(handle_t *handle, struct inode *inode,
		*count = ar.len;
	/*
	 * Account for the allocated meta blocks.  We will never
	 * fail EDQUOT for metdata, but we do account for it.
	 * fail EDQUOT for metadata, but we do account for it.
	 */
	if (!(*errp) && (flags & EXT4_MB_DELALLOC_RESERVED)) {
		dquot_alloc_block_nofail(inode,
+4 −4
Original line number Diff line number Diff line
@@ -192,13 +192,13 @@ static int ext4_readdir(struct file *file, struct dir_context *ctx)
			continue;
		}
		if (err > 0) {
			pgoff_t index = map.m_pblk >>
					(PAGE_SHIFT - inode->i_blkbits);
			pgoff_t index = map.m_pblk << inode->i_blkbits >>
					PAGE_SHIFT;
			if (!ra_has_index(&file->f_ra, index))
				page_cache_sync_readahead(
					sb->s_bdev->bd_mapping,
					&file->f_ra, file,
					index, 1);
					&file->f_ra, file, index,
					1 << EXT4_SB(sb)->s_min_folio_order);
			file->f_ra.prev_pos = (loff_t)index << PAGE_SHIFT;
			bh = ext4_bread(NULL, inode, map.m_lblk, 0);
			if (IS_ERR(bh)) {
+31 −19
Original line number Diff line number Diff line
@@ -260,6 +260,7 @@ struct ext4_map_blocks {
	ext4_lblk_t m_lblk;
	unsigned int m_len;
	unsigned int m_flags;
	u64 m_seq;
};

/*
@@ -367,7 +368,14 @@ struct ext4_io_submit {
								  blkbits))
#define EXT4_B_TO_LBLK(inode, offset) \
	(round_up((offset), i_blocksize(inode)) >> (inode)->i_blkbits)

#define EXT4_LBLK_TO_B(inode, lblk) ((loff_t)(lblk) << (inode)->i_blkbits)

/* Translate a block number to a page index */
#define EXT4_LBLK_TO_PG(inode, lblk)	(EXT4_LBLK_TO_B((inode), (lblk)) >> \
					 PAGE_SHIFT)
/* Translate a page index to a block number */
#define EXT4_PG_TO_LBLK(inode, pnum)	(((loff_t)(pnum) << PAGE_SHIFT) >> \
					 (inode)->i_blkbits)
/* Translate a block number to a cluster number */
#define EXT4_B2C(sbi, blk)	((blk) >> (sbi)->s_cluster_bits)
/* Translate a cluster number to a block number */
@@ -694,13 +702,22 @@ enum {
	/* Caller is from the delayed allocation writeout path
	 * finally doing the actual allocation of delayed blocks */
#define EXT4_GET_BLOCKS_DELALLOC_RESERVE	0x0004
	/* caller is from the direct IO path, request to creation of an
	unwritten extents if not allocated, split the unwritten
	extent if blocks has been preallocated already*/
#define EXT4_GET_BLOCKS_PRE_IO			0x0008
#define EXT4_GET_BLOCKS_CONVERT			0x0010
#define EXT4_GET_BLOCKS_IO_CREATE_EXT		(EXT4_GET_BLOCKS_PRE_IO|\
	/*
	 * This means that we cannot merge newly allocated extents, and if we
	 * found an unwritten extent, we need to split it.
	 */
#define EXT4_GET_BLOCKS_SPLIT_NOMERGE		0x0008
	/*
	 * Caller is from the dio or dioread_nolock buffered IO, reqest to
	 * create an unwritten extent if it does not exist or split the
	 * found unwritten extent. Also do not merge the newly created
	 * unwritten extent, io end will convert unwritten to written,
	 * and try to merge the written extent.
	 */
#define EXT4_GET_BLOCKS_IO_CREATE_EXT		(EXT4_GET_BLOCKS_SPLIT_NOMERGE|\
					 EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT)
	/* Convert unwritten extent to initialized. */
#define EXT4_GET_BLOCKS_CONVERT			0x0010
	/* Eventual metadata allocation (due to growing extent tree)
	 * should not fail, so try to use reserved blocks for that.*/
#define EXT4_GET_BLOCKS_METADATA_NOFAIL		0x0020
@@ -1138,6 +1155,8 @@ struct ext4_inode_info {
	ext4_lblk_t i_es_shrink_lblk;	/* Offset where we start searching for
					   extents to shrink. Protected by
					   i_es_lock  */
	u64 i_es_seq;			/* Change counter for extents.
					   Protected by i_es_lock */

	/* ialloc */
	ext4_group_t	i_last_alloc_group;
@@ -1685,6 +1704,11 @@ struct ext4_sb_info {
	/* record the last minlen when FITRIM is called. */
	unsigned long s_last_trim_minblks;

	/* minimum folio order of a page cache allocation */
	u16 s_min_folio_order;
	/* supported maximum folio order, 0 means not supported */
	u16 s_max_folio_order;

	/* Precomputed FS UUID checksum for seeding other checksums */
	__u32 s_csum_seed;

@@ -2472,28 +2496,19 @@ static inline unsigned int ext4_dir_rec_len(__u8 name_len,
	return (rec_len & ~EXT4_DIR_ROUND);
}

/*
 * If we ever get support for fs block sizes > page_size, we'll need
 * to remove the #if statements in the next two functions...
 */
static inline unsigned int
ext4_rec_len_from_disk(__le16 dlen, unsigned blocksize)
{
	unsigned len = le16_to_cpu(dlen);

#if (PAGE_SIZE >= 65536)
	if (len == EXT4_MAX_REC_LEN || len == 0)
		return blocksize;
	return (len & 65532) | ((len & 3) << 16);
#else
	return len;
#endif
}

static inline __le16 ext4_rec_len_to_disk(unsigned len, unsigned blocksize)
{
	BUG_ON((len > blocksize) || (blocksize > (1 << 18)) || (len & 3));
#if (PAGE_SIZE >= 65536)
	if (len < 65536)
		return cpu_to_le16(len);
	if (len == blocksize) {
@@ -2503,9 +2518,6 @@ static inline __le16 ext4_rec_len_to_disk(unsigned len, unsigned blocksize)
			return cpu_to_le16(0);
	}
	return cpu_to_le16((len & 65532) | ((len >> 16) & 3));
#else
	return cpu_to_le16(len);
#endif
}

/*
Loading