* [PATCH] fs: remove useless plus one in super_cache_scan()
@ 2025-04-28 13:50 alexjlzheng
2025-04-29 9:54 ` Jan Kara
2025-04-29 11:08 ` Christian Brauner
0 siblings, 2 replies; 3+ messages in thread
From: alexjlzheng @ 2025-04-28 13:50 UTC (permalink / raw)
To: viro, brauner, jack; +Cc: linux-fsdevel, linux-kernel, Jinliang Zheng
From: Jinliang Zheng <alexjlzheng@tencent.com>
After commit 475d0db742e3 ("fs: Fix theoretical division by 0 in
super_cache_scan()."), there's no need to plus one to prevent
division by zero.
Remove it to simplify the code.
Signed-off-by: Jinliang Zheng <alexjlzheng@tencent.com>
---
fs/super.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/super.c b/fs/super.c
index 97a17f9d9023..6bbdb7e59a8d 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -201,7 +201,7 @@ static unsigned long super_cache_scan(struct shrinker *shrink,
inodes = list_lru_shrink_count(&sb->s_inode_lru, sc);
dentries = list_lru_shrink_count(&sb->s_dentry_lru, sc);
- total_objects = dentries + inodes + fs_objects + 1;
+ total_objects = dentries + inodes + fs_objects;
if (!total_objects)
total_objects = 1;
--
2.49.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] fs: remove useless plus one in super_cache_scan()
2025-04-28 13:50 [PATCH] fs: remove useless plus one in super_cache_scan() alexjlzheng
@ 2025-04-29 9:54 ` Jan Kara
2025-04-29 11:08 ` Christian Brauner
1 sibling, 0 replies; 3+ messages in thread
From: Jan Kara @ 2025-04-29 9:54 UTC (permalink / raw)
To: alexjlzheng
Cc: viro, brauner, jack, linux-fsdevel, linux-kernel, Jinliang Zheng
On Mon 28-04-25 21:50:50, alexjlzheng@gmail.com wrote:
> From: Jinliang Zheng <alexjlzheng@tencent.com>
>
> After commit 475d0db742e3 ("fs: Fix theoretical division by 0 in
> super_cache_scan()."), there's no need to plus one to prevent
> division by zero.
>
> Remove it to simplify the code.
>
> Signed-off-by: Jinliang Zheng <alexjlzheng@tencent.com>
Fair enough. Feel free to add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
> ---
> fs/super.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/super.c b/fs/super.c
> index 97a17f9d9023..6bbdb7e59a8d 100644
> --- a/fs/super.c
> +++ b/fs/super.c
> @@ -201,7 +201,7 @@ static unsigned long super_cache_scan(struct shrinker *shrink,
>
> inodes = list_lru_shrink_count(&sb->s_inode_lru, sc);
> dentries = list_lru_shrink_count(&sb->s_dentry_lru, sc);
> - total_objects = dentries + inodes + fs_objects + 1;
> + total_objects = dentries + inodes + fs_objects;
> if (!total_objects)
> total_objects = 1;
>
> --
> 2.49.0
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] fs: remove useless plus one in super_cache_scan()
2025-04-28 13:50 [PATCH] fs: remove useless plus one in super_cache_scan() alexjlzheng
2025-04-29 9:54 ` Jan Kara
@ 2025-04-29 11:08 ` Christian Brauner
1 sibling, 0 replies; 3+ messages in thread
From: Christian Brauner @ 2025-04-29 11:08 UTC (permalink / raw)
To: alexjlzheng
Cc: Christian Brauner, linux-fsdevel, linux-kernel, Jinliang Zheng,
viro, jack
On Mon, 28 Apr 2025 21:50:50 +0800, alexjlzheng@gmail.com wrote:
> After commit 475d0db742e3 ("fs: Fix theoretical division by 0 in
> super_cache_scan()."), there's no need to plus one to prevent
> division by zero.
>
> Remove it to simplify the code.
>
>
> [...]
Applied to the vfs-6.16.misc branch of the vfs/vfs.git tree.
Patches in the vfs-6.16.misc branch should appear in linux-next soon.
Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.
It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.
Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs-6.16.misc
[1/1] fs: remove useless plus one in super_cache_scan()
https://git.kernel.org/vfs/vfs/c/9f81d707022c
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-04-29 11:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-28 13:50 [PATCH] fs: remove useless plus one in super_cache_scan() alexjlzheng
2025-04-29 9:54 ` Jan Kara
2025-04-29 11:08 ` Christian Brauner
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).