2023-11-25 08:13:25

by Kemeng Shi

[permalink] [raw]
Subject: [PATCH 0/8] Some random cleanups to mballoc

This series contains some random cleanups to mballoc. No function change
is intended except patch 8 may fix a potential memleak if non-used
preallocation spaces of inode could be greater than UNIT_MAX.
More details can be found in respective patches. Thanks!

Kemeng Shi (8):
ext4: remove unused return value of __mb_check_buddy
ext4: remove unused parameter group in ext4_mb_choose_next_group_*()
ext4: remove unneeded return value of ext4_mb_release_context
ext4: remove unused ext4_allocation_context::ac_groups_considered
ext4: remove unused return value of ext4_mb_release
ext4: remove unused return value of ext4_mb_release_inode_pa
ext4: remove unused return value of ext4_mb_release_group_pa
ext4: remove unnecessary parameter "needed" in
ext4_discard_preallocations

fs/ext4/ext4.h | 4 ++--
fs/ext4/extents.c | 10 +++++-----
fs/ext4/file.c | 2 +-
fs/ext4/indirect.c | 2 +-
fs/ext4/inode.c | 6 +++---
fs/ext4/ioctl.c | 2 +-
fs/ext4/mballoc.c | 46 ++++++++++++++++---------------------------
fs/ext4/mballoc.h | 1 -
fs/ext4/move_extent.c | 4 ++--
fs/ext4/super.c | 2 +-
10 files changed, 33 insertions(+), 46 deletions(-)

--
2.30.0



2023-11-25 08:13:34

by Kemeng Shi

[permalink] [raw]
Subject: [PATCH 1/8] ext4: remove unused return value of __mb_check_buddy

Remove unused return value of __mb_check_buddy.

Signed-off-by: Kemeng Shi <[email protected]>
---
fs/ext4/mballoc.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 454d56126..9f9b8dd06 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -677,7 +677,7 @@ do { \
} \
} while (0)

-static int __mb_check_buddy(struct ext4_buddy *e4b, char *file,
+static void __mb_check_buddy(struct ext4_buddy *e4b, char *file,
const char *function, int line)
{
struct super_block *sb = e4b->bd_sb;
@@ -696,7 +696,7 @@ static int __mb_check_buddy(struct ext4_buddy *e4b, char *file,
void *buddy2;

if (e4b->bd_info->bb_check_counter++ % 10)
- return 0;
+ return;

while (order > 1) {
buddy = mb_find_buddy(e4b, order, &max);
@@ -758,7 +758,7 @@ static int __mb_check_buddy(struct ext4_buddy *e4b, char *file,

grp = ext4_get_group_info(sb, e4b->bd_group);
if (!grp)
- return NULL;
+ return;
list_for_each(cur, &grp->bb_prealloc_list) {
ext4_group_t groupnr;
struct ext4_prealloc_space *pa;
@@ -768,7 +768,6 @@ static int __mb_check_buddy(struct ext4_buddy *e4b, char *file,
for (i = 0; i < pa->pa_len; i++)
MB_CHECK_ASSERT(mb_test_bit(k + i, buddy));
}
- return 0;
}
#undef MB_CHECK_ASSERT
#define mb_check_buddy(e4b) __mb_check_buddy(e4b, \
--
2.30.0


2024-01-02 13:00:57

by Jan Kara

[permalink] [raw]
Subject: Re: [PATCH 1/8] ext4: remove unused return value of __mb_check_buddy

On Sun 26-11-23 00:11:36, Kemeng Shi wrote:
> Remove unused return value of __mb_check_buddy.
>
> Signed-off-by: Kemeng Shi <[email protected]>

Looks good. Feel free to add:

Reviewed-by: Jan Kara <[email protected]>

Honza

> ---
> fs/ext4/mballoc.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
> index 454d56126..9f9b8dd06 100644
> --- a/fs/ext4/mballoc.c
> +++ b/fs/ext4/mballoc.c
> @@ -677,7 +677,7 @@ do { \
> } \
> } while (0)
>
> -static int __mb_check_buddy(struct ext4_buddy *e4b, char *file,
> +static void __mb_check_buddy(struct ext4_buddy *e4b, char *file,
> const char *function, int line)
> {
> struct super_block *sb = e4b->bd_sb;
> @@ -696,7 +696,7 @@ static int __mb_check_buddy(struct ext4_buddy *e4b, char *file,
> void *buddy2;
>
> if (e4b->bd_info->bb_check_counter++ % 10)
> - return 0;
> + return;
>
> while (order > 1) {
> buddy = mb_find_buddy(e4b, order, &max);
> @@ -758,7 +758,7 @@ static int __mb_check_buddy(struct ext4_buddy *e4b, char *file,
>
> grp = ext4_get_group_info(sb, e4b->bd_group);
> if (!grp)
> - return NULL;
> + return;
> list_for_each(cur, &grp->bb_prealloc_list) {
> ext4_group_t groupnr;
> struct ext4_prealloc_space *pa;
> @@ -768,7 +768,6 @@ static int __mb_check_buddy(struct ext4_buddy *e4b, char *file,
> for (i = 0; i < pa->pa_len; i++)
> MB_CHECK_ASSERT(mb_test_bit(k + i, buddy));
> }
> - return 0;
> }
> #undef MB_CHECK_ASSERT
> #define mb_check_buddy(e4b) __mb_check_buddy(e4b, \
> --
> 2.30.0
>
>
--
Jan Kara <[email protected]>
SUSE Labs, CR