Skip to contentSkip to conversation

f2fs: enlarge block plug coverage

PATCH Superseded Chao Yu 2 participants 11 messages Apr 4, 2018 – Apr 13, 2018 F2FS file system

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Chao Yu

author
#0 lore raw

PATCH 1/1 f2fs: enlarge block plug coverage

This patch enlarges block plug coverage in __issue_discard_cmd, in order to collect more pending bios before issuing them, to avoid being disturbed by previous discard I/O in IO aware discard mode.

---
 fs/f2fs/segment.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
fs/f2fs/segment.c +5 -2
index 8f0b5ba46315..4287e208c040 100644
@@ -1208,10 +1208,12 @@ static int __issue_discard_cmd(struct f2fs_sb_info *sbi,
 		pend_list = &dcc->pend_list[i];
 
 		mutex_lock(&dcc->cmd_lock);
+
+		blk_start_plug(&plug);
+
 		if (list_empty(pend_list))
 			goto next;
 		f2fs_bug_on(sbi, !__check_rb_tree_consistence(sbi, &dcc->root));
-		blk_start_plug(&plug);
 		list_for_each_entry_safe(dc, tmp, pend_list, list) {
 			f2fs_bug_on(sbi, dc->state != D_PREP);
 
@@ -1227,8 +1229,9 @@ static int __issue_discard_cmd(struct f2fs_sb_info *sbi,
 			if (++iter >= dpolicy->max_requests)
 				break;
 		}
-		blk_finish_plug(&plug);
 next:
+		blk_finish_plug(&plug);
+
 		mutex_unlock(&dcc->cmd_lock);
 
 		if (iter >= dpolicy->max_requests)
Signature · 1 line
2.15.0.55.gc2ece9dc4de6
maintainer
#1 lore raw
Quoted 3 lines · Chao Yu

This patch enlarges block plug coverage in __issue_discard_cmd, in order to collect more pending bios before issuing them, to avoid being disturbed by previous discard I/O in IO aware discard mode.

Hmm, then we need to wait for huge discard IO for over 10 secs, which will affect following read/write IOs accordingly. In order to avoid that, we actually need to limit the discard size.

Thanks,

Quoted 37 lines
---
 fs/f2fs/segment.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
fs/f2fs/segment.c +5 -2
index 8f0b5ba46315..4287e208c040 100644
@@ -1208,10 +1208,12 @@ static int __issue_discard_cmd(struct f2fs_sb_info *sbi,
 		pend_list = &dcc->pend_list[i];
 
 		mutex_lock(&dcc->cmd_lock);
+
+		blk_start_plug(&plug);
+
 		if (list_empty(pend_list))
 			goto next;
 		f2fs_bug_on(sbi, !__check_rb_tree_consistence(sbi, &dcc->root));
-		blk_start_plug(&plug);
 		list_for_each_entry_safe(dc, tmp, pend_list, list) {
 			f2fs_bug_on(sbi, dc->state != D_PREP);
 
@@ -1227,8 +1229,9 @@ static int __issue_discard_cmd(struct f2fs_sb_info *sbi,
 			if (++iter >= dpolicy->max_requests)
 				break;
 		}
-		blk_finish_plug(&plug);
 next:
+		blk_finish_plug(&plug);
+
 		mutex_unlock(&dcc->cmd_lock);
 
 		if (iter >= dpolicy->max_requests)
Signature · 1 line
2.15.0.55.gc2ece9dc4de6
author
#2 lore raw
Quoted 6 lines · Jaegeuk Kim
Quoted 3 lines · Chao Yu

This patch enlarges block plug coverage in __issue_discard_cmd, in order to collect more pending bios before issuing them, to avoid being disturbed by previous discard I/O in IO aware discard mode.

Hmm, then we need to wait for huge discard IO for over 10 secs, which

We found that total discard latency is rely on total discard number we issued last time instead of range or length discard covered. IMO, if we don't change .max_requests value, we will not suffer longer latency.

Quoted 2 lines

will affect following read/write IOs accordingly. In order to avoid that, we actually need to limit the discard size.

If you are worry about I/O interference in between discard and rw, I suggest to decrease .max_requests value.

Thanks,

Quoted 43 lines

Thanks,

Quoted 37 lines
---
 fs/f2fs/segment.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
fs/f2fs/segment.c +5 -2
index 8f0b5ba46315..4287e208c040 100644
@@ -1208,10 +1208,12 @@ static int __issue_discard_cmd(struct f2fs_sb_info *sbi,
 		pend_list = &dcc->pend_list[i];
 
 		mutex_lock(&dcc->cmd_lock);
+
+		blk_start_plug(&plug);
+
 		if (list_empty(pend_list))
 			goto next;
 		f2fs_bug_on(sbi, !__check_rb_tree_consistence(sbi, &dcc->root));
-		blk_start_plug(&plug);
 		list_for_each_entry_safe(dc, tmp, pend_list, list) {
 			f2fs_bug_on(sbi, dc->state != D_PREP);
 
@@ -1227,8 +1229,9 @@ static int __issue_discard_cmd(struct f2fs_sb_info *sbi,
 			if (++iter >= dpolicy->max_requests)
 				break;
 		}
-		blk_finish_plug(&plug);
 next:
+		blk_finish_plug(&plug);
+
 		mutex_unlock(&dcc->cmd_lock);
 
 		if (iter >= dpolicy->max_requests)
Signature · 1 line
2.15.0.55.gc2ece9dc4de6

.

maintainer
#3 lore raw
Quoted 12 lines · Chao Yu
Quoted 6 lines · Jaegeuk Kim
Quoted 3 lines · Chao Yu

This patch enlarges block plug coverage in __issue_discard_cmd, in order to collect more pending bios before issuing them, to avoid being disturbed by previous discard I/O in IO aware discard mode.

Hmm, then we need to wait for huge discard IO for over 10 secs, which

We found that total discard latency is rely on total discard number we issued last time instead of range or length discard covered. IMO, if we don't change .max_requests value, we will not suffer longer latency.

Quoted 5 lines
Quoted 2 lines

will affect following read/write IOs accordingly. In order to avoid that, we actually need to limit the discard size.

If you are worry about I/O interference in between discard and rw, I suggest to decrease .max_requests value.

What do you mean? This will produce more pending requests in the queue?

Quoted 46 lines

Thanks,

Quoted 43 lines

Thanks,

Quoted 37 lines
---
 fs/f2fs/segment.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
fs/f2fs/segment.c +5 -2
index 8f0b5ba46315..4287e208c040 100644
@@ -1208,10 +1208,12 @@ static int __issue_discard_cmd(struct f2fs_sb_info *sbi,
 		pend_list = &dcc->pend_list[i];
 
 		mutex_lock(&dcc->cmd_lock);
+
+		blk_start_plug(&plug);
+
 		if (list_empty(pend_list))
 			goto next;
 		f2fs_bug_on(sbi, !__check_rb_tree_consistence(sbi, &dcc->root));
-		blk_start_plug(&plug);
 		list_for_each_entry_safe(dc, tmp, pend_list, list) {
 			f2fs_bug_on(sbi, dc->state != D_PREP);
 
@@ -1227,8 +1229,9 @@ static int __issue_discard_cmd(struct f2fs_sb_info *sbi,
 			if (++iter >= dpolicy->max_requests)
 				break;
 		}
-		blk_finish_plug(&plug);
 next:
+		blk_finish_plug(&plug);
+
 		mutex_unlock(&dcc->cmd_lock);
 
 		if (iter >= dpolicy->max_requests)
Signature · 1 line
2.15.0.55.gc2ece9dc4de6

.

author
#4 lore raw
Quoted 7 lines · Jaegeuk Kim
Quoted 6 lines · Chao Yu
Quoted 5 lines · Jaegeuk Kim
Quoted 3 lines · Chao Yu

This patch enlarges block plug coverage in __issue_discard_cmd, in order to collect more pending bios before issuing them, to avoid being disturbed by previous discard I/O in IO aware discard mode.

Quoted 8 lines
Quoted 8 lines
Quoted 1 line

Hmm, then we need to wait for huge discard IO for over 10 secs, which

We found that total discard latency is rely on total discard number we issued last time instead of range or length discard covered. IMO, if we don't change .max_requests value, we will not suffer longer latency.

Quoted 2 lines

will affect following read/write IOs accordingly. In order to avoid that, we actually need to limit the discard size.

Do you mean limit discard count or discard length?

Quoted 5 lines
Quoted 3 lines

If you are worry about I/O interference in between discard and rw, I suggest to decrease .max_requests value.

What do you mean? This will produce more pending requests in the queue?

I mean after applying this patch, we can queue more discard IOs in plug inside task, otherwise, previous issued discard in block layer can make is_idle() be false, then it can stop IO awared user to issue pending discard command.

Thanks,

Quoted 50 lines
Quoted 47 lines

Thanks,

Quoted 43 lines

Thanks,

Quoted 37 lines
---
 fs/f2fs/segment.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
fs/f2fs/segment.c +5 -2
index 8f0b5ba46315..4287e208c040 100644
@@ -1208,10 +1208,12 @@ static int __issue_discard_cmd(struct f2fs_sb_info *sbi,
 		pend_list = &dcc->pend_list[i];
 
 		mutex_lock(&dcc->cmd_lock);
+
+		blk_start_plug(&plug);
+
 		if (list_empty(pend_list))
 			goto next;
 		f2fs_bug_on(sbi, !__check_rb_tree_consistence(sbi, &dcc->root));
-		blk_start_plug(&plug);
 		list_for_each_entry_safe(dc, tmp, pend_list, list) {
 			f2fs_bug_on(sbi, dc->state != D_PREP);
 
@@ -1227,8 +1229,9 @@ static int __issue_discard_cmd(struct f2fs_sb_info *sbi,
 			if (++iter >= dpolicy->max_requests)
 				break;
 		}
-		blk_finish_plug(&plug);
 next:
+		blk_finish_plug(&plug);
+
 		mutex_unlock(&dcc->cmd_lock);
 
 		if (iter >= dpolicy->max_requests)
Signature · 1 line
2.15.0.55.gc2ece9dc4de6

.

.

maintainer
#5 lore raw
Quoted 10 lines · Chao Yu
Quoted 9 lines · Jaegeuk Kim
Quoted 8 lines · Chao Yu
Quoted 6 lines · Jaegeuk Kim
Quoted 3 lines · Chao Yu

This patch enlarges block plug coverage in __issue_discard_cmd, in order to collect more pending bios before issuing them, to avoid being disturbed by previous discard I/O in IO aware discard mode.

Hmm, then we need to wait for huge discard IO for over 10 secs, which

Quoted 8 lines
Quoted 6 lines
Quoted 6 lines

We found that total discard latency is rely on total discard number we issued last time instead of range or length discard covered. IMO, if we don't change .max_requests value, we will not suffer longer latency.

Quoted 2 lines

will affect following read/write IOs accordingly. In order to avoid that, we actually need to limit the discard size.

Do you mean limit discard count or discard length?

Both of them.

Quoted 10 lines
Quoted 6 lines
Quoted 4 lines

If you are worry about I/O interference in between discard and rw, I suggest to decrease .max_requests value.

What do you mean? This will produce more pending requests in the queue?

I mean after applying this patch, we can queue more discard IOs in plug inside task, otherwise, previous issued discard in block layer can make is_idle() be false, then it can stop IO awared user to issue pending discard command.

Then, unplug will issue lots of discard commands, which affects the following rw latencies. My preference would be issuing discard commands one by one as much as possible.

Quoted 53 lines

Thanks,

Quoted 50 lines
Quoted 47 lines

Thanks,

Quoted 43 lines

Thanks,

Quoted 37 lines
---
 fs/f2fs/segment.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
fs/f2fs/segment.c +5 -2
index 8f0b5ba46315..4287e208c040 100644
@@ -1208,10 +1208,12 @@ static int __issue_discard_cmd(struct f2fs_sb_info *sbi,
 		pend_list = &dcc->pend_list[i];
 
 		mutex_lock(&dcc->cmd_lock);
+
+		blk_start_plug(&plug);
+
 		if (list_empty(pend_list))
 			goto next;
 		f2fs_bug_on(sbi, !__check_rb_tree_consistence(sbi, &dcc->root));
-		blk_start_plug(&plug);
 		list_for_each_entry_safe(dc, tmp, pend_list, list) {
 			f2fs_bug_on(sbi, dc->state != D_PREP);
 
@@ -1227,8 +1229,9 @@ static int __issue_discard_cmd(struct f2fs_sb_info *sbi,
 			if (++iter >= dpolicy->max_requests)
 				break;
 		}
-		blk_finish_plug(&plug);
 next:
+		blk_finish_plug(&plug);
+
 		mutex_unlock(&dcc->cmd_lock);
 
 		if (iter >= dpolicy->max_requests)
Signature · 1 line
2.15.0.55.gc2ece9dc4de6

.

.

author
#6 lore raw
Quoted 29 lines · Jaegeuk Kim
Quoted 10 lines · Chao Yu
Quoted 9 lines · Jaegeuk Kim
Quoted 8 lines · Chao Yu
Quoted 6 lines · Jaegeuk Kim
Quoted 3 lines · Chao Yu

This patch enlarges block plug coverage in __issue_discard_cmd, in order to collect more pending bios before issuing them, to avoid being disturbed by previous discard I/O in IO aware discard mode.

Hmm, then we need to wait for huge discard IO for over 10 secs, which

Quoted 8 lines
Quoted 6 lines
Quoted 6 lines

We found that total discard latency is rely on total discard number we issued last time instead of range or length discard covered. IMO, if we don't change .max_requests value, we will not suffer longer latency.

Quoted 2 lines

will affect following read/write IOs accordingly. In order to avoid that, we actually need to limit the discard size.

Do you mean limit discard count or discard length?

Both of them.

Quoted 7 lines
Quoted 6 lines
Quoted 4 lines

If you are worry about I/O interference in between discard and rw, I suggest to decrease .max_requests value.

What do you mean? This will produce more pending requests in the queue?

Quoted 7 lines
Quoted 3 lines

I mean after applying this patch, we can queue more discard IOs in plug inside task, otherwise, previous issued discard in block layer can make is_idle() be false, then it can stop IO awared user to issue pending discard command.

Then, unplug will issue lots of discard commands, which affects the following rw latencies. My preference would be issuing discard commands one by one as much as possible.

Hmm.. for you concern, we can turn down IO priority of discard from background?

Thanks,

Quoted 57 lines
Quoted 54 lines

Thanks,

Quoted 50 lines
Quoted 47 lines

Thanks,

Quoted 43 lines

Thanks,

Quoted 37 lines
---
 fs/f2fs/segment.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
fs/f2fs/segment.c +5 -2
index 8f0b5ba46315..4287e208c040 100644
@@ -1208,10 +1208,12 @@ static int __issue_discard_cmd(struct f2fs_sb_info *sbi,
 		pend_list = &dcc->pend_list[i];
 
 		mutex_lock(&dcc->cmd_lock);
+
+		blk_start_plug(&plug);
+
 		if (list_empty(pend_list))
 			goto next;
 		f2fs_bug_on(sbi, !__check_rb_tree_consistence(sbi, &dcc->root));
-		blk_start_plug(&plug);
 		list_for_each_entry_safe(dc, tmp, pend_list, list) {
 			f2fs_bug_on(sbi, dc->state != D_PREP);
 
@@ -1227,8 +1229,9 @@ static int __issue_discard_cmd(struct f2fs_sb_info *sbi,
 			if (++iter >= dpolicy->max_requests)
 				break;
 		}
-		blk_finish_plug(&plug);
 next:
+		blk_finish_plug(&plug);
+
 		mutex_unlock(&dcc->cmd_lock);
 
 		if (iter >= dpolicy->max_requests)
Signature · 1 line
2.15.0.55.gc2ece9dc4de6

.

.

.

maintainer
#7 lore raw
Quoted 34 lines · Chao Yu
Quoted 33 lines · Jaegeuk Kim
Quoted 10 lines · Chao Yu
Quoted 9 lines · Jaegeuk Kim
Quoted 8 lines · Chao Yu
Quoted 6 lines · Jaegeuk Kim
Quoted 3 lines · Chao Yu

This patch enlarges block plug coverage in __issue_discard_cmd, in order to collect more pending bios before issuing them, to avoid being disturbed by previous discard I/O in IO aware discard mode.

Hmm, then we need to wait for huge discard IO for over 10 secs, which

Quoted 8 lines
Quoted 6 lines
Quoted 6 lines

We found that total discard latency is rely on total discard number we issued last time instead of range or length discard covered. IMO, if we don't change .max_requests value, we will not suffer longer latency.

Quoted 2 lines

will affect following read/write IOs accordingly. In order to avoid that, we actually need to limit the discard size.

Do you mean limit discard count or discard length?

Both of them.

Quoted 10 lines
Quoted 6 lines
Quoted 4 lines

If you are worry about I/O interference in between discard and rw, I suggest to decrease .max_requests value.

What do you mean? This will produce more pending requests in the queue?

I mean after applying this patch, we can queue more discard IOs in plug inside task, otherwise, previous issued discard in block layer can make is_idle() be false, then it can stop IO awared user to issue pending discard command.

Quoted 5 lines
Quoted 3 lines

Then, unplug will issue lots of discard commands, which affects the following rw latencies. My preference would be issuing discard commands one by one as much as possible.

Hmm.. for you concern, we can turn down IO priority of discard from background?

That makes much more sense to me. :P

Quoted 60 lines

Thanks,

Quoted 57 lines
Quoted 54 lines

Thanks,

Quoted 50 lines
Quoted 47 lines

Thanks,

Quoted 43 lines

Thanks,

Quoted 37 lines
---
 fs/f2fs/segment.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
fs/f2fs/segment.c +5 -2
index 8f0b5ba46315..4287e208c040 100644
@@ -1208,10 +1208,12 @@ static int __issue_discard_cmd(struct f2fs_sb_info *sbi,
 		pend_list = &dcc->pend_list[i];
 
 		mutex_lock(&dcc->cmd_lock);
+
+		blk_start_plug(&plug);
+
 		if (list_empty(pend_list))
 			goto next;
 		f2fs_bug_on(sbi, !__check_rb_tree_consistence(sbi, &dcc->root));
-		blk_start_plug(&plug);
 		list_for_each_entry_safe(dc, tmp, pend_list, list) {
 			f2fs_bug_on(sbi, dc->state != D_PREP);
 
@@ -1227,8 +1229,9 @@ static int __issue_discard_cmd(struct f2fs_sb_info *sbi,
 			if (++iter >= dpolicy->max_requests)
 				break;
 		}
-		blk_finish_plug(&plug);
 next:
+		blk_finish_plug(&plug);
+
 		mutex_unlock(&dcc->cmd_lock);
 
 		if (iter >= dpolicy->max_requests)
Signature · 1 line
2.15.0.55.gc2ece9dc4de6

.

.

.

author
#8 lore raw
Quoted 35 lines · Jaegeuk Kim
Quoted 34 lines · Chao Yu
Quoted 33 lines · Jaegeuk Kim
Quoted 10 lines · Chao Yu
Quoted 9 lines · Jaegeuk Kim
Quoted 8 lines · Chao Yu
Quoted 6 lines · Jaegeuk Kim
Quoted 3 lines · Chao Yu

This patch enlarges block plug coverage in __issue_discard_cmd, in order to collect more pending bios before issuing them, to avoid being disturbed by previous discard I/O in IO aware discard mode.

Hmm, then we need to wait for huge discard IO for over 10 secs, which

Quoted 8 lines
Quoted 6 lines
Quoted 6 lines

We found that total discard latency is rely on total discard number we issued last time instead of range or length discard covered. IMO, if we don't change .max_requests value, we will not suffer longer latency.

Quoted 2 lines

will affect following read/write IOs accordingly. In order to avoid that, we actually need to limit the discard size.

Do you mean limit discard count or discard length?

Both of them.

Quoted 10 lines
Quoted 6 lines
Quoted 4 lines

If you are worry about I/O interference in between discard and rw, I suggest to decrease .max_requests value.

What do you mean? This will produce more pending requests in the queue?

I mean after applying this patch, we can queue more discard IOs in plug inside task, otherwise, previous issued discard in block layer can make is_idle() be false, then it can stop IO awared user to issue pending discard command.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

Then, unplug will issue lots of discard commands, which affects the following rw latencies. My preference would be issuing discard commands one by one as much as possible.

Hmm.. for you concern, we can turn down IO priority of discard from background?

That makes much more sense to me. :P

Then, this patch which enlarge plug coverage will not still a problem, right? ;)

Thanks,

Quoted 64 lines
Quoted 61 lines

Thanks,

Quoted 57 lines
Quoted 54 lines

Thanks,

Quoted 50 lines
Quoted 47 lines

Thanks,

Quoted 43 lines

Thanks,

Quoted 37 lines
---
 fs/f2fs/segment.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
fs/f2fs/segment.c +5 -2
index 8f0b5ba46315..4287e208c040 100644
@@ -1208,10 +1208,12 @@ static int __issue_discard_cmd(struct f2fs_sb_info *sbi,
 		pend_list = &dcc->pend_list[i];
 
 		mutex_lock(&dcc->cmd_lock);
+
+		blk_start_plug(&plug);
+
 		if (list_empty(pend_list))
 			goto next;
 		f2fs_bug_on(sbi, !__check_rb_tree_consistence(sbi, &dcc->root));
-		blk_start_plug(&plug);
 		list_for_each_entry_safe(dc, tmp, pend_list, list) {
 			f2fs_bug_on(sbi, dc->state != D_PREP);
 
@@ -1227,8 +1229,9 @@ static int __issue_discard_cmd(struct f2fs_sb_info *sbi,
 			if (++iter >= dpolicy->max_requests)
 				break;
 		}
-		blk_finish_plug(&plug);
 next:
+		blk_finish_plug(&plug);
+
 		mutex_unlock(&dcc->cmd_lock);
 
 		if (iter >= dpolicy->max_requests)
Signature · 1 line
2.15.0.55.gc2ece9dc4de6

.

.

.

.

maintainer
#9 lore raw
Quoted 40 lines · Chao Yu
Quoted 39 lines · Jaegeuk Kim
Quoted 38 lines · Chao Yu
Quoted 36 lines · Jaegeuk Kim
Quoted 10 lines · Chao Yu
Quoted 9 lines · Jaegeuk Kim
Quoted 8 lines · Chao Yu
Quoted 6 lines · Jaegeuk Kim
Quoted 3 lines · Chao Yu

This patch enlarges block plug coverage in __issue_discard_cmd, in order to collect more pending bios before issuing them, to avoid being disturbed by previous discard I/O in IO aware discard mode.

Hmm, then we need to wait for huge discard IO for over 10 secs, which

Quoted 8 lines
Quoted 6 lines
Quoted 6 lines

We found that total discard latency is rely on total discard number we issued last time instead of range or length discard covered. IMO, if we don't change .max_requests value, we will not suffer longer latency.

Quoted 2 lines

will affect following read/write IOs accordingly. In order to avoid that, we actually need to limit the discard size.

Do you mean limit discard count or discard length?

Both of them.

Quoted 10 lines
Quoted 6 lines
Quoted 4 lines

If you are worry about I/O interference in between discard and rw, I suggest to decrease .max_requests value.

What do you mean? This will produce more pending requests in the queue?

I mean after applying this patch, we can queue more discard IOs in plug inside task, otherwise, previous issued discard in block layer can make is_idle() be false, then it can stop IO awared user to issue pending discard command.

Then, unplug will issue lots of discard commands, which affects the following rw latencies. My preference would be issuing discard commands one by one as much as possible.

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Hmm.. for you concern, we can turn down IO priority of discard from background?

That makes much more sense to me. :P

Then, this patch which enlarge plug coverage will not still a problem, right? ;)

This is different one.

Quoted 67 lines

Thanks,

Quoted 64 lines
Quoted 61 lines

Thanks,

Quoted 57 lines
Quoted 54 lines

Thanks,

Quoted 50 lines
Quoted 47 lines

Thanks,

Quoted 43 lines

Thanks,

Quoted 37 lines
---
 fs/f2fs/segment.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
fs/f2fs/segment.c +5 -2
index 8f0b5ba46315..4287e208c040 100644
@@ -1208,10 +1208,12 @@ static int __issue_discard_cmd(struct f2fs_sb_info *sbi,
 		pend_list = &dcc->pend_list[i];
 
 		mutex_lock(&dcc->cmd_lock);
+
+		blk_start_plug(&plug);
+
 		if (list_empty(pend_list))
 			goto next;
 		f2fs_bug_on(sbi, !__check_rb_tree_consistence(sbi, &dcc->root));
-		blk_start_plug(&plug);
 		list_for_each_entry_safe(dc, tmp, pend_list, list) {
 			f2fs_bug_on(sbi, dc->state != D_PREP);
 
@@ -1227,8 +1229,9 @@ static int __issue_discard_cmd(struct f2fs_sb_info *sbi,
 			if (++iter >= dpolicy->max_requests)
 				break;
 		}
-		blk_finish_plug(&plug);
 next:
+		blk_finish_plug(&plug);
+
 		mutex_unlock(&dcc->cmd_lock);
 
 		if (iter >= dpolicy->max_requests)
Signature · 1 line
2.15.0.55.gc2ece9dc4de6

.

.

.

.

author
#10 lore raw
Quoted 41 lines · Jaegeuk Kim
Quoted 40 lines · Chao Yu
Quoted 39 lines · Jaegeuk Kim
Quoted 38 lines · Chao Yu
Quoted 36 lines · Jaegeuk Kim
Quoted 10 lines · Chao Yu
Quoted 9 lines · Jaegeuk Kim
Quoted 8 lines · Chao Yu
Quoted 6 lines · Jaegeuk Kim
Quoted 3 lines · Chao Yu

This patch enlarges block plug coverage in __issue_discard_cmd, in order to collect more pending bios before issuing them, to avoid being disturbed by previous discard I/O in IO aware discard mode.

Hmm, then we need to wait for huge discard IO for over 10 secs, which

Quoted 8 lines
Quoted 6 lines
Quoted 6 lines

We found that total discard latency is rely on total discard number we issued last time instead of range or length discard covered. IMO, if we don't change .max_requests value, we will not suffer longer latency.

Quoted 2 lines

will affect following read/write IOs accordingly. In order to avoid that, we actually need to limit the discard size.

Do you mean limit discard count or discard length?

Both of them.

Quoted 10 lines
Quoted 6 lines
Quoted 4 lines

If you are worry about I/O interference in between discard and rw, I suggest to decrease .max_requests value.

What do you mean? This will produce more pending requests in the queue?

I mean after applying this patch, we can queue more discard IOs in plug inside task, otherwise, previous issued discard in block layer can make is_idle() be false, then it can stop IO awared user to issue pending discard command.

Then, unplug will issue lots of discard commands, which affects the following rw latencies. My preference would be issuing discard commands one by one as much as possible.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Hmm.. for you concern, we can turn down IO priority of discard from background?

That makes much more sense to me. :P

Then, this patch which enlarge plug coverage will not still a problem, right? ;)

This is different one.

Yup, if there will be no IO interference as you concerned before, can we accept it now?

Thanks,

Quoted 71 lines
Quoted 68 lines

Thanks,

Quoted 64 lines
Quoted 61 lines

Thanks,

Quoted 57 lines
Quoted 54 lines

Thanks,

Quoted 50 lines
Quoted 47 lines

Thanks,

Quoted 43 lines

Thanks,

Quoted 37 lines
---
 fs/f2fs/segment.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
fs/f2fs/segment.c +5 -2
index 8f0b5ba46315..4287e208c040 100644
@@ -1208,10 +1208,12 @@ static int __issue_discard_cmd(struct f2fs_sb_info *sbi,
 		pend_list = &dcc->pend_list[i];
 
 		mutex_lock(&dcc->cmd_lock);
+
+		blk_start_plug(&plug);
+
 		if (list_empty(pend_list))
 			goto next;
 		f2fs_bug_on(sbi, !__check_rb_tree_consistence(sbi, &dcc->root));
-		blk_start_plug(&plug);
 		list_for_each_entry_safe(dc, tmp, pend_list, list) {
 			f2fs_bug_on(sbi, dc->state != D_PREP);
 
@@ -1227,8 +1229,9 @@ static int __issue_discard_cmd(struct f2fs_sb_info *sbi,
 			if (++iter >= dpolicy->max_requests)
 				break;
 		}
-		blk_finish_plug(&plug);
 next:
+		blk_finish_plug(&plug);
+
 		mutex_unlock(&dcc->cmd_lock);
 
 		if (iter >= dpolicy->max_requests)
Signature · 1 line
2.15.0.55.gc2ece9dc4de6

.

.

.

.

.