* [PATCH 0/2] two cleanups for mballoc
@ 2023-03-11 17:09 Kemeng Shi
2023-03-11 17:09 ` [PATCH 1/2] ext4: fix typos in mballoc Kemeng Shi
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Kemeng Shi @ 2023-03-11 17:09 UTC (permalink / raw)
To: tytso, adilger.kernel; +Cc: linux-ext4, linux-kernel, shikemeng
Hi, this series contain two cleanups to fix typo and remove unnecessary
pointer dereference. Thanks!
Kemeng Shi (2):
ext4: fix typos in mballoc
ext4: avoid unnecessary pointer dereference in
ext4_mb_normalize_request
fs/ext4/mballoc.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
--
2.30.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] ext4: fix typos in mballoc
2023-03-11 17:09 [PATCH 0/2] two cleanups for mballoc Kemeng Shi
@ 2023-03-11 17:09 ` Kemeng Shi
2023-03-13 2:12 ` Ritesh Harjani
2023-03-11 17:09 ` [PATCH 2/2] ext4: avoid unnecessary pointer dereference in ext4_mb_normalize_request Kemeng Shi
2023-03-17 1:52 ` [PATCH 0/2] two cleanups for mballoc Theodore Ts'o
2 siblings, 1 reply; 6+ messages in thread
From: Kemeng Shi @ 2023-03-11 17:09 UTC (permalink / raw)
To: tytso, adilger.kernel; +Cc: linux-ext4, linux-kernel, shikemeng
pa_plen -> pa_len
pa_start -> pa_pstart
Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
---
fs/ext4/mballoc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 85d5e219933f..13dce6f07fa4 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -4146,7 +4146,7 @@ ext4_mb_normalize_request(struct ext4_allocation_context *ac,
* provide gurantee on number of contiguous blocks allocation since that
* depends upon free space left, etc).
* In case of inode pa, later we use the allocated blocks
- * [pa_start + fe_logical - pa_lstart, fe_len/size] from the preallocated
+ * [pa_pstart + fe_logical - pa_lstart, fe_len/size] from the preallocated
* range of goal/best blocks [start, size] to put it at the
* ac_o_ex.fe_logical extent of this inode.
* (See ext4_mb_use_inode_pa() for more details)
@@ -4298,7 +4298,7 @@ static void ext4_mb_use_group_pa(struct ext4_allocation_context *ac,
ac->ac_status = AC_STATUS_FOUND;
ac->ac_pa = pa;
- /* we don't correct pa_pstart or pa_plen here to avoid
+ /* we don't correct pa_pstart or pa_len here to avoid
* possible race when the group is being loaded concurrently
* instead we correct pa later, after blocks are marked
* in on-disk bitmap -- see ext4_mb_release_context()
--
2.30.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] ext4: avoid unnecessary pointer dereference in ext4_mb_normalize_request
2023-03-11 17:09 [PATCH 0/2] two cleanups for mballoc Kemeng Shi
2023-03-11 17:09 ` [PATCH 1/2] ext4: fix typos in mballoc Kemeng Shi
@ 2023-03-11 17:09 ` Kemeng Shi
2023-03-13 2:13 ` Ritesh Harjani
2023-03-17 1:52 ` [PATCH 0/2] two cleanups for mballoc Theodore Ts'o
2 siblings, 1 reply; 6+ messages in thread
From: Kemeng Shi @ 2023-03-11 17:09 UTC (permalink / raw)
To: tytso, adilger.kernel; +Cc: linux-ext4, linux-kernel, shikemeng
Result of EXT4_SB(ac->ac_sb) is already stored in sbi at beginning of
ext4_mb_normalize_request. Use sbi instead of EXT4_SB(ac->ac_sb) to
remove unnecessary pointer dereference.
Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
---
fs/ext4/mballoc.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 13dce6f07fa4..d94eb52dda17 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -4049,7 +4049,7 @@ ext4_mb_normalize_request(struct ext4_allocation_context *ac,
size = 8 * 1024 * 1024;
} else {
start_off = (loff_t) ac->ac_o_ex.fe_logical << bsbits;
- size = (loff_t) EXT4_C2B(EXT4_SB(ac->ac_sb),
+ size = (loff_t) EXT4_C2B(sbi,
ac->ac_o_ex.fe_len) << bsbits;
}
size = size >> bsbits;
@@ -4094,8 +4094,7 @@ ext4_mb_normalize_request(struct ext4_allocation_context *ac,
continue;
}
- pa_end = pa->pa_lstart + EXT4_C2B(EXT4_SB(ac->ac_sb),
- pa->pa_len);
+ pa_end = pa->pa_lstart + EXT4_C2B(sbi, pa->pa_len);
/* PA must not overlap original request */
BUG_ON(!(ac->ac_o_ex.fe_logical >= pa_end ||
@@ -4128,8 +4127,7 @@ ext4_mb_normalize_request(struct ext4_allocation_context *ac,
spin_lock(&pa->pa_lock);
if (pa->pa_deleted == 0) {
- pa_end = pa->pa_lstart + EXT4_C2B(EXT4_SB(ac->ac_sb),
- pa->pa_len);
+ pa_end = pa->pa_lstart + EXT4_C2B(sbi, pa->pa_len);
BUG_ON(!(start >= pa_end || end <= pa->pa_lstart));
}
spin_unlock(&pa->pa_lock);
--
2.30.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] ext4: fix typos in mballoc
2023-03-11 17:09 ` [PATCH 1/2] ext4: fix typos in mballoc Kemeng Shi
@ 2023-03-13 2:12 ` Ritesh Harjani
0 siblings, 0 replies; 6+ messages in thread
From: Ritesh Harjani @ 2023-03-13 2:12 UTC (permalink / raw)
To: Kemeng Shi, tytso, adilger.kernel; +Cc: linux-ext4, linux-kernel, shikemeng
Kemeng Shi <shikemeng@huaweicloud.com> writes:
> pa_plen -> pa_len
> pa_start -> pa_pstart
>
> Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
> ---
> fs/ext4/mballoc.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
Looks good to me. Please feel free to add -
Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
>
> diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
> index 85d5e219933f..13dce6f07fa4 100644
> --- a/fs/ext4/mballoc.c
> +++ b/fs/ext4/mballoc.c
> @@ -4146,7 +4146,7 @@ ext4_mb_normalize_request(struct ext4_allocation_context *ac,
> * provide gurantee on number of contiguous blocks allocation since that
> * depends upon free space left, etc).
> * In case of inode pa, later we use the allocated blocks
> - * [pa_start + fe_logical - pa_lstart, fe_len/size] from the preallocated
> + * [pa_pstart + fe_logical - pa_lstart, fe_len/size] from the preallocated
> * range of goal/best blocks [start, size] to put it at the
> * ac_o_ex.fe_logical extent of this inode.
> * (See ext4_mb_use_inode_pa() for more details)
> @@ -4298,7 +4298,7 @@ static void ext4_mb_use_group_pa(struct ext4_allocation_context *ac,
> ac->ac_status = AC_STATUS_FOUND;
> ac->ac_pa = pa;
>
> - /* we don't correct pa_pstart or pa_plen here to avoid
> + /* we don't correct pa_pstart or pa_len here to avoid
> * possible race when the group is being loaded concurrently
> * instead we correct pa later, after blocks are marked
> * in on-disk bitmap -- see ext4_mb_release_context()
> --
> 2.30.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] ext4: avoid unnecessary pointer dereference in ext4_mb_normalize_request
2023-03-11 17:09 ` [PATCH 2/2] ext4: avoid unnecessary pointer dereference in ext4_mb_normalize_request Kemeng Shi
@ 2023-03-13 2:13 ` Ritesh Harjani
0 siblings, 0 replies; 6+ messages in thread
From: Ritesh Harjani @ 2023-03-13 2:13 UTC (permalink / raw)
To: Kemeng Shi, tytso, adilger.kernel; +Cc: linux-ext4, linux-kernel, shikemeng
Kemeng Shi <shikemeng@huaweicloud.com> writes:
> Result of EXT4_SB(ac->ac_sb) is already stored in sbi at beginning of
> ext4_mb_normalize_request. Use sbi instead of EXT4_SB(ac->ac_sb) to
> remove unnecessary pointer dereference.
>
> Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
> ---
> fs/ext4/mballoc.c | 8 +++-----
> 1 file changed, 3 insertions(+), 5 deletions(-)
>
Looks good to me. Please feel free to add -
Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
> diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
> index 13dce6f07fa4..d94eb52dda17 100644
> --- a/fs/ext4/mballoc.c
> +++ b/fs/ext4/mballoc.c
> @@ -4049,7 +4049,7 @@ ext4_mb_normalize_request(struct ext4_allocation_context *ac,
> size = 8 * 1024 * 1024;
> } else {
> start_off = (loff_t) ac->ac_o_ex.fe_logical << bsbits;
> - size = (loff_t) EXT4_C2B(EXT4_SB(ac->ac_sb),
> + size = (loff_t) EXT4_C2B(sbi,
> ac->ac_o_ex.fe_len) << bsbits;
> }
> size = size >> bsbits;
> @@ -4094,8 +4094,7 @@ ext4_mb_normalize_request(struct ext4_allocation_context *ac,
> continue;
> }
>
> - pa_end = pa->pa_lstart + EXT4_C2B(EXT4_SB(ac->ac_sb),
> - pa->pa_len);
> + pa_end = pa->pa_lstart + EXT4_C2B(sbi, pa->pa_len);
>
> /* PA must not overlap original request */
> BUG_ON(!(ac->ac_o_ex.fe_logical >= pa_end ||
> @@ -4128,8 +4127,7 @@ ext4_mb_normalize_request(struct ext4_allocation_context *ac,
>
> spin_lock(&pa->pa_lock);
> if (pa->pa_deleted == 0) {
> - pa_end = pa->pa_lstart + EXT4_C2B(EXT4_SB(ac->ac_sb),
> - pa->pa_len);
> + pa_end = pa->pa_lstart + EXT4_C2B(sbi, pa->pa_len);
> BUG_ON(!(start >= pa_end || end <= pa->pa_lstart));
> }
> spin_unlock(&pa->pa_lock);
> --
> 2.30.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/2] two cleanups for mballoc
2023-03-11 17:09 [PATCH 0/2] two cleanups for mballoc Kemeng Shi
2023-03-11 17:09 ` [PATCH 1/2] ext4: fix typos in mballoc Kemeng Shi
2023-03-11 17:09 ` [PATCH 2/2] ext4: avoid unnecessary pointer dereference in ext4_mb_normalize_request Kemeng Shi
@ 2023-03-17 1:52 ` Theodore Ts'o
2 siblings, 0 replies; 6+ messages in thread
From: Theodore Ts'o @ 2023-03-17 1:52 UTC (permalink / raw)
To: Kemeng Shi, adilger.kernel; +Cc: Theodore Ts'o, linux-ext4, linux-kernel
On Sun, 12 Mar 2023 01:09:47 +0800, Kemeng Shi wrote:
> pointer dereference. Thanks!
>
> Kemeng Shi (2):
> ext4: fix typos in mballoc
> ext4: avoid unnecessary pointer dereference in
> ext4_mb_normalize_request
>
> [...]
Applied, thanks!
[1/2] ext4: fix typos in mballoc
commit: dac2da4882d847ed83155c2809e93bc2348677c8
[2/2] ext4: avoid unnecessary pointer dereference in ext4_mb_normalize_request
commit: e15eeffe99e11512e658f19af7952a57aede8915
Best regards,
--
Theodore Ts'o <tytso@mit.edu>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-03-17 1:53 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-11 17:09 [PATCH 0/2] two cleanups for mballoc Kemeng Shi
2023-03-11 17:09 ` [PATCH 1/2] ext4: fix typos in mballoc Kemeng Shi
2023-03-13 2:12 ` Ritesh Harjani
2023-03-11 17:09 ` [PATCH 2/2] ext4: avoid unnecessary pointer dereference in ext4_mb_normalize_request Kemeng Shi
2023-03-13 2:13 ` Ritesh Harjani
2023-03-17 1:52 ` [PATCH 0/2] two cleanups for mballoc Theodore Ts'o
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).