[PATCH] f2fs: make __issue_discard_cmd() return more appropriate error code

From: Yangtao Li
Date: Fri Apr 21 2023 - 06:50:17 EST


Returns -EBUSY when __issue_discard() is interrupted by io,
instead of returning -1.

Signed-off-by: Yangtao Li <frank.li@xxxxxxxx>
---
fs/f2fs/segment.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 6db410f1bb8c..a005948dca93 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -1604,7 +1604,7 @@ static int __issue_discard_cmd(struct f2fs_sb_info *sbi,
}

if (!issued && io_interrupted)
- issued = -1;
+ issued = -EBUSY;

return issued;
}
@@ -1829,7 +1829,7 @@ static int issue_discard_thread(void *data)
if (issued > 0) {
__wait_all_discard_cmd(sbi, &dpolicy);
wait_ms = dpolicy.min_interval;
- } else if (issued == -1) {
+ } else if (issued == -EBUSY) {
wait_ms = f2fs_time_to_wait(sbi, DISCARD_TIME);
if (!wait_ms)
wait_ms = dpolicy.mid_interval;
--
2.39.0