From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org
Cc: Gou Hao <gouhao@uniontech.com>, Jan Kara <jack@suse.cz>,
Theodore Ts'o <tytso@mit.edu>, Sasha Levin <sashal@kernel.org>
Subject: [PATCH 6.1.y 3/6] ext4: delete redundant calculations in ext4_mb_get_buddy_page_lock()
Date: Wed, 25 Feb 2026 08:22:59 -0500 [thread overview]
Message-ID: <20260225132302.222887-3-sashal@kernel.org> (raw)
In-Reply-To: <20260225132302.222887-1-sashal@kernel.org>
From: Gou Hao <gouhao@uniontech.com>
[ Upstream commit f2fec3e99a32d7c14dbf63c824f8286ebc94b18d ]
'blocks_per_page' is always 1 after 'if (blocks_per_page >= 2)',
'pnum' and 'block' are equal in this case.
Signed-off-by: Gou Hao <gouhao@uniontech.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20231024035215.29474-1-gouhao@uniontech.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Stable-dep-of: bdc56a9c46b2 ("ext4: fix e4b bitmap inconsistency reports")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/ext4/mballoc.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index e44dd404fe407..11454fcee3a62 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -1372,9 +1372,8 @@ static int ext4_mb_get_buddy_page_lock(struct super_block *sb,
return 0;
}
- block++;
- pnum = block / blocks_per_page;
- page = find_or_create_page(inode->i_mapping, pnum, gfp);
+ /* blocks_per_page == 1, hence we need another page for the buddy */
+ page = find_or_create_page(inode->i_mapping, block + 1, gfp);
if (!page)
return -ENOMEM;
BUG_ON(page->mapping != inode->i_mapping);
--
2.51.0
next prev parent reply other threads:[~2026-02-25 13:23 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-24 21:45 FAILED: patch "[PATCH] ext4: fix e4b bitmap inconsistency reports" failed to apply to 6.1-stable tree gregkh
2026-02-25 13:22 ` [PATCH 6.1.y 1/6] ext4: remove unnecessary e4b->bd_buddy_page check in ext4_mb_load_buddy_gfp Sasha Levin
2026-02-25 13:22 ` [PATCH 6.1.y 2/6] ext4: convert some BUG_ON's in mballoc to use WARN_RATELIMITED instead Sasha Levin
2026-02-25 13:22 ` Sasha Levin [this message]
2026-02-25 13:23 ` [PATCH 6.1.y 4/6] ext4: convert bd_bitmap_page to bd_bitmap_folio Sasha Levin
2026-02-25 13:23 ` [PATCH 6.1.y 5/6] ext4: convert bd_buddy_page to bd_buddy_folio Sasha Levin
2026-02-25 13:23 ` [PATCH 6.1.y 6/6] ext4: fix e4b bitmap inconsistency reports Sasha Levin
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=20260225132302.222887-3-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=gouhao@uniontech.com \
--cc=jack@suse.cz \
--cc=stable@vger.kernel.org \
--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