[PATCH 5.5 118/257] erofs: correct the remaining shrink objects

From: Greg Kroah-Hartman
Date: Thu Apr 16 2020 - 11:40:38 EST


From: Gao Xiang <gaoxiang25@xxxxxxxxxx>

commit 9d5a09c6f3b5fb85af20e3a34827b5d27d152b34 upstream.

The remaining count should not include successful
shrink attempts.

Fixes: e7e9a307be9d ("staging: erofs: introduce workstation for decompression")
Cc: <stable@xxxxxxxxxxxxxxx> # 4.19+
Link: https://lore.kernel.org/r/20200226081008.86348-1-gaoxiang25@xxxxxxxxxx
Reviewed-by: Chao Yu <yuchao0@xxxxxxxxxx>
Signed-off-by: Gao Xiang <gaoxiang25@xxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

---
fs/erofs/utils.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- a/fs/erofs/utils.c
+++ b/fs/erofs/utils.c
@@ -293,7 +293,7 @@ static unsigned long erofs_shrink_scan(s
spin_unlock(&erofs_sb_list_lock);
sbi->shrinker_run_no = run_no;

- freed += erofs_shrink_workstation(sbi, nr);
+ freed += erofs_shrink_workstation(sbi, nr - freed);

spin_lock(&erofs_sb_list_lock);
/* Get the next list element before we move this one */