From: Yang Guo guoyang2@huawei.com
mainline inclusion from mainline-v5.13-rc1 commit 3cd461712cb450ea6aa8a8200f35f24eb296bfb2 category: performance bugzilla: https://gitee.com/openeuler/kernel/issues/I7D878 CVE: NA
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?i...
---------------------------
The buffer uptodate state has been checked in function set_buffer_uptodate, there is no need use buffer_uptodate before calling set_buffer_uptodate and delete it.
Cc: "Theodore Ts'o" tytso@mit.edu Cc: Andreas Dilger adilger.kernel@dilger.ca Signed-off-by: Yang Guo guoyang2@huawei.com Signed-off-by: Shaokun Zhang zhangshaokun@hisilicon.com Reviewed-by: Ritesh Harjani ritesh.list@gmail.com Link: https://lore.kernel.org/r/1617260610-29770-1-git-send-email-zhangshaokun@his... Signed-off-by: Theodore Ts'o tytso@mit.edu Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com (cherry picked from commit 47b62d723ea118619e7eb35888996024a8031c9e) --- fs/ext4/inode.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index f26d9b88d48d..690f7866dc0c 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -1061,8 +1061,7 @@ static int ext4_block_write_begin(struct page *page, loff_t pos, unsigned len, block_end = block_start + blocksize; if (block_end <= from || block_start >= to) { if (PageUptodate(page)) { - if (!buffer_uptodate(bh)) - set_buffer_uptodate(bh); + set_buffer_uptodate(bh); } continue; } @@ -1087,8 +1086,7 @@ static int ext4_block_write_begin(struct page *page, loff_t pos, unsigned len, } } if (PageUptodate(page)) { - if (!buffer_uptodate(bh)) - set_buffer_uptodate(bh); + set_buffer_uptodate(bh); continue; } if (!buffer_uptodate(bh) && !buffer_delay(bh) &&