Commit 51ed42a8 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

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

Pull ext4 updates from Ted Ts'o:
 "Many cleanups and bug fixes in ext4, especially for the fast commit
  feature.

  Also some performance improvements; in particular, improving IOPS and
  throughput on fast devices running Async Direct I/O by up to 20% by
  optimizing jbd2_transaction_committed()"

* tag 'ext4_for_linus-6.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4: (40 commits)
  ext4: make sure the first directory block is not a hole
  ext4: check dot and dotdot of dx_root before making dir indexed
  ext4: sanity check for NULL pointer after ext4_force_shutdown
  jbd2: increase maximum transaction size
  jbd2: drop pointless shrinker batch initialization
  jbd2: avoid infinite transaction commit loop
  jbd2: precompute number of transaction descriptor blocks
  jbd2: make jbd2_journal_get_max_txn_bufs() internal
  jbd2: avoid mount failed when commit block is partial submitted
  ext4: avoid writing unitialized memory to disk in EA inodes
  ext4: don't track ranges in fast_commit if inode has inlined data
  ext4: fix possible tid_t sequence overflows
  ext4: use ext4_update_inode_fsync_trans() helper in inode creation
  ext4: add missing MODULE_DESCRIPTION()
  jbd2: add missing MODULE_DESCRIPTION()
  ext4: use memtostr_pad() for s_volume_name
  jbd2: speed up jbd2_transaction_committed()
  ext4: make ext4_da_map_blocks() buffer_head unaware
  ext4: make ext4_insert_delayed_block() insert multi-blocks
  ext4: factor out a helper to check the cluster allocation state
  ...
parents dddebdec f9ca5159
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -2184,6 +2184,8 @@ static void __block_commit_write(struct folio *folio, size_t from, size_t to)
	struct buffer_head *bh, *head;

	bh = head = folio_buffers(folio);
	if (!bh)
		return;
	blocksize = bh->b_size;

	block_start = 0;
+1 −1
Original line number Diff line number Diff line
@@ -72,7 +72,7 @@ static int add_system_zone(struct ext4_system_blocks *system_blks,
{
	struct ext4_system_zone *new_entry, *entry;
	struct rb_node **n = &system_blks->root.rb_node, *node;
	struct rb_node *parent = NULL, *new_node = NULL;
	struct rb_node *parent = NULL, *new_node;

	while (*n) {
		parent = *n;
+1 −1
Original line number Diff line number Diff line
@@ -1347,7 +1347,7 @@ struct ext4_super_block {
/*60*/	__le32	s_feature_incompat;	/* incompatible feature set */
	__le32	s_feature_ro_compat;	/* readonly-compatible feature set */
/*68*/	__u8	s_uuid[16];		/* 128-bit uuid for volume */
/*78*/	char	s_volume_name[EXT4_LABEL_MAX];	/* volume name */
/*78*/	char	s_volume_name[EXT4_LABEL_MAX] __nonstring; /* volume name */
/*88*/	char	s_last_mounted[64] __nonstring;	/* directory where last mounted */
/*C8*/	__le32	s_algorithm_usage_bitmap; /* For compression */
	/*
+51 −21
Original line number Diff line number Diff line
@@ -310,6 +310,8 @@ void ext4_es_find_extent_range(struct inode *inode,
			       ext4_lblk_t lblk, ext4_lblk_t end,
			       struct extent_status *es)
{
	es->es_lblk = es->es_len = es->es_pblk = 0;

	if (EXT4_SB(inode->i_sb)->s_mount_state & EXT4_FC_REPLAY)
		return;

@@ -2052,34 +2054,49 @@ bool ext4_is_pending(struct inode *inode, ext4_lblk_t lblk)
}

/*
 * ext4_es_insert_delayed_block - adds a delayed block to the extents status
 *                                tree, adding a pending reservation where
 *                                needed
 * ext4_es_insert_delayed_extent - adds some delayed blocks to the extents
 *                                 status tree, adding a pending reservation
 *                                 where needed
 *
 * @inode - file containing the newly added block
 * @lblk - logical block to be added
 * @allocated - indicates whether a physical cluster has been allocated for
 *              the logical cluster that contains the block
 * @lblk - start logical block to be added
 * @len - length of blocks to be added
 * @lclu_allocated/end_allocated - indicates whether a physical cluster has
 *                                 been allocated for the logical cluster
 *                                 that contains the start/end block. Note that
 *                                 end_allocated should always be set to false
 *                                 if the start and the end block are in the
 *                                 same cluster
 */
void ext4_es_insert_delayed_block(struct inode *inode, ext4_lblk_t lblk,
				  bool allocated)
void ext4_es_insert_delayed_extent(struct inode *inode, ext4_lblk_t lblk,
				   ext4_lblk_t len, bool lclu_allocated,
				   bool end_allocated)
{
	struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
	struct extent_status newes;
	ext4_lblk_t end = lblk + len - 1;
	int err1 = 0, err2 = 0, err3 = 0;
	struct extent_status *es1 = NULL;
	struct extent_status *es2 = NULL;
	struct pending_reservation *pr = NULL;
	struct pending_reservation *pr1 = NULL;
	struct pending_reservation *pr2 = NULL;

	if (EXT4_SB(inode->i_sb)->s_mount_state & EXT4_FC_REPLAY)
		return;

	es_debug("add [%u/1) delayed to extent status tree of inode %lu\n",
		 lblk, inode->i_ino);
	es_debug("add [%u/%u) delayed to extent status tree of inode %lu\n",
		 lblk, len, inode->i_ino);
	if (!len)
		return;

	WARN_ON_ONCE((EXT4_B2C(sbi, lblk) == EXT4_B2C(sbi, end)) &&
		     end_allocated);

	newes.es_lblk = lblk;
	newes.es_len = 1;
	newes.es_len = len;
	ext4_es_store_pblock_status(&newes, ~0, EXTENT_STATUS_DELAYED);
	trace_ext4_es_insert_delayed_block(inode, &newes, allocated);
	trace_ext4_es_insert_delayed_extent(inode, &newes, lclu_allocated,
					    end_allocated);

	ext4_es_insert_extent_check(inode, &newes);

@@ -2088,11 +2105,15 @@ void ext4_es_insert_delayed_block(struct inode *inode, ext4_lblk_t lblk,
		es1 = __es_alloc_extent(true);
	if ((err1 || err2) && !es2)
		es2 = __es_alloc_extent(true);
	if ((err1 || err2 || err3) && allocated && !pr)
		pr = __alloc_pending(true);
	if (err1 || err2 || err3) {
		if (lclu_allocated && !pr1)
			pr1 = __alloc_pending(true);
		if (end_allocated && !pr2)
			pr2 = __alloc_pending(true);
	}
	write_lock(&EXT4_I(inode)->i_es_lock);

	err1 = __es_remove_extent(inode, lblk, lblk, NULL, es1);
	err1 = __es_remove_extent(inode, lblk, end, NULL, es1);
	if (err1 != 0)
		goto error;
	/* Free preallocated extent if it didn't get used. */
@@ -2112,13 +2133,22 @@ void ext4_es_insert_delayed_block(struct inode *inode, ext4_lblk_t lblk,
		es2 = NULL;
	}

	if (allocated) {
		err3 = __insert_pending(inode, lblk, &pr);
	if (lclu_allocated) {
		err3 = __insert_pending(inode, lblk, &pr1);
		if (err3 != 0)
			goto error;
		if (pr) {
			__free_pending(pr);
			pr = NULL;
		if (pr1) {
			__free_pending(pr1);
			pr1 = NULL;
		}
	}
	if (end_allocated) {
		err3 = __insert_pending(inode, end, &pr2);
		if (err3 != 0)
			goto error;
		if (pr2) {
			__free_pending(pr2);
			pr2 = NULL;
		}
	}
error:
+3 −2
Original line number Diff line number Diff line
@@ -249,8 +249,9 @@ extern void ext4_exit_pending(void);
extern void ext4_init_pending_tree(struct ext4_pending_tree *tree);
extern void ext4_remove_pending(struct inode *inode, ext4_lblk_t lblk);
extern bool ext4_is_pending(struct inode *inode, ext4_lblk_t lblk);
extern void ext4_es_insert_delayed_block(struct inode *inode, ext4_lblk_t lblk,
					 bool allocated);
extern void ext4_es_insert_delayed_extent(struct inode *inode, ext4_lblk_t lblk,
					  ext4_lblk_t len, bool lclu_allocated,
					  bool end_allocated);
extern unsigned int ext4_es_delayed_clu(struct inode *inode, ext4_lblk_t lblk,
					ext4_lblk_t len);
extern void ext4_clear_inode_es(struct inode *inode);
Loading