diff mbox series

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

Message ID 20230421104943.11878-1-frank.li@vivo.com (mailing list archive)
State New
Headers show
Series [f2fs-dev] f2fs: make __issue_discard_cmd() return more appropriate error code | expand

Commit Message

Yangtao Li April 21, 2023, 10:49 a.m. UTC
Returns -EBUSY when __issue_discard() is interrupted by io,
instead of returning -1.

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

Patch

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;