Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1645687 > unrolled thread

[PATCH 1/3] f2fs: show more info if fail to issue discard

Started byChao Yu <chao@kernel.org>
First post2017-05-19 17:50 +0200
Last post2017-05-19 18:00 +0200
Articles 2 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH 1/3] f2fs: show more info if fail to issue discard Chao Yu <chao@kernel.org> - 2017-05-19 17:50 +0200
    [PATCH 3/3] f2fs: wait discard IO completion without cmd_lock held Chao Yu <chao@kernel.org> - 2017-05-19 18:00 +0200

#1645687 — [PATCH 1/3] f2fs: show more info if fail to issue discard

FromChao Yu <chao@kernel.org>
Date2017-05-19 17:50 +0200
Subject[PATCH 1/3] f2fs: show more info if fail to issue discard
Message-ID<tISk9-4bg-13@gated-at.bofh.it>
From: Chao Yu <yuchao0@huawei.com>

Signed-off-by: Chao Yu <yuchao0@huawei.com>
---
 fs/f2fs/segment.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index a29919330e27..d310b82caef1 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -740,7 +740,8 @@ static void __remove_discard_cmd(struct f2fs_sb_info *sbi,
 
 	if (dc->error)
 		f2fs_msg(sbi->sb, KERN_INFO,
-				"Issue discard failed, ret: %d", dc->error);
+			"Issue discard(%u, %u, %u) failed, ret: %d",
+			dc->lstart, dc->start, dc->len, dc->error);
 	__detach_discard_cmd(dcc, dc);
 }
 
-- 
2.12.2.575.gb14f27f

[toc] | [next] | [standalone]


#1645716 — [PATCH 3/3] f2fs: wait discard IO completion without cmd_lock held

FromChao Yu <chao@kernel.org>
Date2017-05-19 18:00 +0200
Subject[PATCH 3/3] f2fs: wait discard IO completion without cmd_lock held
Message-ID<tIStR-4fG-63@gated-at.bofh.it>
In reply to#1645687
From: Chao Yu <yuchao0@huawei.com>

Wait discard IO completion outside cmd_lock to avoid long latency
of holding cmd_lock in IO busy scenario.

Signed-off-by: Chao Yu <yuchao0@huawei.com>
---
 fs/f2fs/segment.c | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 2b11119d9071..2b926db0588b 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -1005,17 +1005,34 @@ static void __wait_discard_cmd(struct f2fs_sb_info *sbi, bool wait_cond)
 	struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info;
 	struct list_head *wait_list = &(dcc->wait_list);
 	struct discard_cmd *dc, *tmp;
+	bool need_wait;
+
+next:
+	need_wait = false;
 
 	mutex_lock(&dcc->cmd_lock);
 	list_for_each_entry_safe(dc, tmp, wait_list, list) {
-		if (!wait_cond || dc->state == D_DONE) {
-			if (dc->ref)
-				continue;
+		if (!wait_cond || (dc->state == D_DONE && !dc->ref)) {
 			wait_for_completion_io(&dc->wait);
 			__remove_discard_cmd(sbi, dc);
+		} else {
+			dc->ref++;
+			need_wait = true;
+			break;
 		}
 	}
 	mutex_unlock(&dcc->cmd_lock);
+
+	if (need_wait) {
+		wait_for_completion_io(&dc->wait);
+		mutex_lock(&dcc->cmd_lock);
+		f2fs_bug_on(sbi, dc->state != D_DONE);
+		dc->ref--;
+		if (!dc->ref)
+			__remove_discard_cmd(sbi, dc);
+		mutex_unlock(&dcc->cmd_lock);
+		goto next;
+	}
 }
 
 /* This should be covered by global mutex, &sit_i->sentry_lock */
-- 
2.12.2.575.gb14f27f

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web