summaryrefslogtreecommitdiff
path: root/fs/f2fs/segment.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/f2fs/segment.c')
-rw-r--r--fs/f2fs/segment.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index ed38644907ba..52b133725b7f 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -653,6 +653,9 @@ static void __remove_discard_cmd(struct f2fs_sb_info *sbi, struct discard_cmd *d
{
int err = dc->bio->bi_error;
+ if (dc->state == D_DONE)
+ atomic_dec(&(SM_I(sbi)->dcc_info->submit_discard));
+
if (err == -EOPNOTSUPP)
err = 0;
@@ -678,6 +681,7 @@ void f2fs_wait_discard_bio(struct f2fs_sb_info *sbi, block_t blkaddr)
if (dc->state == D_PREP) {
dc->state = D_SUBMIT;
submit_bio(dc->bio);
+ atomic_inc(&dcc->submit_discard);
}
wait_for_completion_io(&dc->wait);
@@ -723,6 +727,7 @@ repeat:
if (dc->state == D_PREP) {
dc->state = D_SUBMIT;
submit_bio(dc->bio);
+ atomic_inc(&dcc->submit_discard);
if (iter++ > DISCARD_ISSUE_RATE)
break;
} else if (dc->state == D_DONE) {
@@ -1049,6 +1054,7 @@ int create_discard_cmd_control(struct f2fs_sb_info *sbi)
INIT_LIST_HEAD(&dcc->discard_entry_list);
INIT_LIST_HEAD(&dcc->discard_cmd_list);
mutex_init(&dcc->cmd_lock);
+ atomic_set(&dcc->submit_discard, 0);
dcc->nr_discards = 0;
dcc->max_discards = 0;