* [PATCH 0/2] two clean up patches for mballoc
@ 2023-05-25 12:35 Guoqing Jiang
2023-05-25 12:35 ` [PATCH 1/2] ext4: cleanup ext4_issue_discard Guoqing Jiang
2023-05-25 12:35 ` [PATCH 2/2] ext4: make ext4_mb_release_group_pa returns void Guoqing Jiang
0 siblings, 2 replies; 3+ messages in thread
From: Guoqing Jiang @ 2023-05-25 12:35 UTC (permalink / raw)
To: tytso, adilger.kernel; +Cc: linux-ext4
Hi,
Please review the two patches which clean up code a bit.
Thanks,
Guoqing
Guoqing Jiang (2):
ext4: cleanup ext4_issue_discard
ext4: make ext4_mb_release_group_pa returns void
fs/ext4/mballoc.c | 22 ++++++----------------
1 file changed, 6 insertions(+), 16 deletions(-)
--
2.35.3
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] ext4: cleanup ext4_issue_discard
2023-05-25 12:35 [PATCH 0/2] two clean up patches for mballoc Guoqing Jiang
@ 2023-05-25 12:35 ` Guoqing Jiang
2023-05-25 12:35 ` [PATCH 2/2] ext4: make ext4_mb_release_group_pa returns void Guoqing Jiang
1 sibling, 0 replies; 3+ messages in thread
From: Guoqing Jiang @ 2023-05-25 12:35 UTC (permalink / raw)
To: tytso, adilger.kernel; +Cc: linux-ext4
We can remove the 'biop' parameter and remove the 'if'
branch in ext4_issue_discard, since all call sites pass
NULL to biop with commit 55cdd0af2bc5 ("ext4: get discard
out of jbd2 commit kthread contex").
Signed-off-by: Guoqing Jiang <guoqing.jiang@linux.dev>
---
fs/ext4/mballoc.c | 16 ++++------------
1 file changed, 4 insertions(+), 12 deletions(-)
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 7b2e36d103cb..5fabb34869bf 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -3604,8 +3604,7 @@ int ext4_mb_release(struct super_block *sb)
}
static inline int ext4_issue_discard(struct super_block *sb,
- ext4_group_t block_group, ext4_grpblk_t cluster, int count,
- struct bio **biop)
+ ext4_group_t block_group, ext4_grpblk_t cluster, int count)
{
ext4_fsblk_t discard_block;
@@ -3614,13 +3613,7 @@ static inline int ext4_issue_discard(struct super_block *sb,
count = EXT4_C2B(EXT4_SB(sb), count);
trace_ext4_discard_blocks(sb,
(unsigned long long) discard_block, count);
- if (biop) {
- return __blkdev_issue_discard(sb->s_bdev,
- (sector_t)discard_block << (sb->s_blocksize_bits - 9),
- (sector_t)count << (sb->s_blocksize_bits - 9),
- GFP_NOFS, biop);
- } else
- return sb_issue_discard(sb, discard_block, count, GFP_NOFS, 0);
+ return sb_issue_discard(sb, discard_block, count, GFP_NOFS, 0);
}
static void ext4_free_data_in_buddy(struct super_block *sb,
@@ -6229,8 +6222,7 @@ static void ext4_mb_clear_bb(handle_t *handle, struct inode *inode,
* them with group lock_held
*/
if (test_opt(sb, DISCARD)) {
- err = ext4_issue_discard(sb, block_group, bit, count,
- NULL);
+ err = ext4_issue_discard(sb, block_group, bit, count);
if (err && err != -EOPNOTSUPP)
ext4_msg(sb, KERN_WARNING, "discard request in"
" group:%u block:%d count:%lu failed"
@@ -6568,7 +6560,7 @@ __acquires(bitlock)
*/
mb_mark_used(e4b, &ex);
ext4_unlock_group(sb, group);
- ret = ext4_issue_discard(sb, group, start, count, NULL);
+ ret = ext4_issue_discard(sb, group, start, count);
ext4_lock_group(sb, group);
mb_free_blocks(NULL, e4b, start, ex.fe_len);
return ret;
--
2.35.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] ext4: make ext4_mb_release_group_pa returns void
2023-05-25 12:35 [PATCH 0/2] two clean up patches for mballoc Guoqing Jiang
2023-05-25 12:35 ` [PATCH 1/2] ext4: cleanup ext4_issue_discard Guoqing Jiang
@ 2023-05-25 12:35 ` Guoqing Jiang
1 sibling, 0 replies; 3+ messages in thread
From: Guoqing Jiang @ 2023-05-25 12:35 UTC (permalink / raw)
To: tytso, adilger.kernel; +Cc: linux-ext4
It is always return 0 and no one check the return value too.
Signed-off-by: Guoqing Jiang <guoqing.jiang@linux.dev>
---
fs/ext4/mballoc.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 5fabb34869bf..ae8e6d107347 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -5029,7 +5029,7 @@ ext4_mb_release_inode_pa(struct ext4_buddy *e4b, struct buffer_head *bitmap_bh,
return 0;
}
-static noinline_for_stack int
+static noinline_for_stack void
ext4_mb_release_group_pa(struct ext4_buddy *e4b,
struct ext4_prealloc_space *pa)
{
@@ -5043,13 +5043,11 @@ ext4_mb_release_group_pa(struct ext4_buddy *e4b,
if (unlikely(group != e4b->bd_group && pa->pa_len != 0)) {
ext4_warning(sb, "bad group: expected %u, group %u, pa_start %llu",
e4b->bd_group, group, pa->pa_pstart);
- return 0;
+ return;
}
mb_free_blocks(pa->pa_inode, e4b, bit, pa->pa_len);
atomic_add(pa->pa_len, &EXT4_SB(sb)->s_mb_discarded);
trace_ext4_mballoc_discard(sb, NULL, group, bit, pa->pa_len);
-
- return 0;
}
/*
--
2.35.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-05-25 12:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-25 12:35 [PATCH 0/2] two clean up patches for mballoc Guoqing Jiang
2023-05-25 12:35 ` [PATCH 1/2] ext4: cleanup ext4_issue_discard Guoqing Jiang
2023-05-25 12:35 ` [PATCH 2/2] ext4: make ext4_mb_release_group_pa returns void Guoqing Jiang
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).