From: Jan Kara <jack@suse.cz>
To: Ojaswin Mujoo <ojaswin@linux.ibm.com>
Cc: linux-ext4@vger.kernel.org, Theodore Ts'o <tytso@mit.edu>,
Ritesh Harjani <riteshh@linux.ibm.com>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
Jan Kara <jack@suse.cz>, rookxu <brookxu.cn@gmail.com>
Subject: Re: [PATCH v4 6/9] ext4: Fix best extent lstart adjustment logic in ext4_mb_new_inode_pa()
Date: Mon, 27 Feb 2023 13:01:27 +0100 [thread overview]
Message-ID: <20230227120127.ki3ydzdbi25d5wmp@quack3> (raw)
In-Reply-To: <79b5240a6168171577b1bb9ef7a27c0c52676d37.1676634592.git.ojaswin@linux.ibm.com>
On Fri 17-02-23 17:44:15, Ojaswin Mujoo wrote:
> When the length of best extent found is less than the length of goal extent
> we need to make sure that the best extent atleast covers the start of the
> original request. This is done by adjusting the ac_b_ex.fe_logical (logical
> start) of the extent.
>
> While doing so, the current logic sometimes results in the best extent's logical
> range overflowing the goal extent. Since this best extent is later added to the
> inode preallocation list, we have a possibility of introducing overlapping
> preallocations. This is discussed in detail here [1].
>
> To fix this, replace the existing logic with the below logic for adjusting best
> extent as it keeps fragmentation in check while ensuring logical range of best
> extent doesn't overflow out of goal extent:
>
> 1. Check if best extent can be kept at end of goal range and still cover
> original start.
> 2. Else, check if best extent can be kept at start of goal range and still cover
> original start.
> 3. Else, keep the best extent at start of original request.
>
> Also, add a few extra BUG_ONs that might help catch errors faster.
>
> [1] https://lore.kernel.org/r/Y+OGkVvzPN0RMv0O@li-bb2b2a4c-3307-11b2-a85c-8fa5c3a69313.ibm.com
>
> Signed-off-by: Ojaswin Mujoo <ojaswin@linux.ibm.com>
Looks good to me. Feel free to add:
Reviewed-by: Jan Kara <jack@suse.cz>
Just one style nit below.
> + /*
> + * Use the below logic for adjusting best extent as it keeps
> + * fragmentation in check while ensuring logical range of best
> + * extent doesn't overflow out of goal extent:
> + *
> + * 1. Check if best ex can be kept at end of goal and still
> + * cover original start
> + * 2. Else, check if best ex can be kept at start of goal and
> + * still cover original start
> + * 3. Else, keep the best ex at start of original request.
> + */
> + new_bex_end = ac->ac_g_ex.fe_logical +
> + EXT4_C2B(sbi, ac->ac_g_ex.fe_len);
> + new_bex_start = new_bex_end - EXT4_C2B(sbi, ac->ac_b_ex.fe_len);
> + if (ac->ac_o_ex.fe_logical >= new_bex_start)
> + goto adjust_bex;
^^^ The indentation looks too big here
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
next prev parent reply other threads:[~2023-02-27 12:01 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-17 12:14 [PATCH v4 0/9] ext4: Convert inode preallocation list to an rbtree Ojaswin Mujoo
2023-02-17 12:14 ` [PATCH v4 1/9] ext4: Stop searching if PA doesn't satisfy non-extent file Ojaswin Mujoo
2023-02-17 12:14 ` [PATCH v4 2/9] ext4: Refactor code related to freeing PAs Ojaswin Mujoo
2023-02-17 12:14 ` [PATCH v4 3/9] ext4: Refactor code in ext4_mb_normalize_request() and ext4_mb_use_preallocated() Ojaswin Mujoo
2023-02-17 12:14 ` [PATCH v4 4/9] ext4: Move overlap assert logic into a separate function Ojaswin Mujoo
2023-02-17 12:14 ` [PATCH v4 5/9] ext4: Abstract out overlap fix/check logic in ext4_mb_normalize_request() Ojaswin Mujoo
2023-02-17 12:14 ` [PATCH v4 6/9] ext4: Fix best extent lstart adjustment logic in ext4_mb_new_inode_pa() Ojaswin Mujoo
2023-02-17 17:18 ` Ritesh Harjani
2023-02-27 12:01 ` Jan Kara [this message]
2023-02-17 12:14 ` [PATCH v4 7/9] ext4: Convert pa->pa_inode_list and pa->pa_obj_lock into a union Ojaswin Mujoo
2023-02-17 12:14 ` [PATCH v4 8/9] ext4: Use rbtrees to manage PAs instead of inode i_prealloc_list Ojaswin Mujoo
2023-02-18 1:33 ` Ritesh Harjani
2023-02-27 12:19 ` Jan Kara
2023-03-01 6:44 ` Ojaswin Mujoo
2023-02-17 12:14 ` [PATCH v4 9/9] ext4: Remove the logic to trim inode PAs Ojaswin Mujoo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230227120127.ki3ydzdbi25d5wmp@quack3 \
--to=jack@suse.cz \
--cc=brookxu.cn@gmail.com \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ojaswin@linux.ibm.com \
--cc=riteshh@linux.ibm.com \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox