Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp7857277ybi; Thu, 6 Jun 2019 02:39:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqwRerhl0q5d8kvZOTCJ4AVx7hykFG+vV9udZaAUO1DDsj35iwnvAqt7g7H6KouQkQQF6mz7 X-Received: by 2002:a17:90a:d34f:: with SMTP id i15mr18159622pjx.1.1559813992745; Thu, 06 Jun 2019 02:39:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559813992; cv=none; d=google.com; s=arc-20160816; b=ZqYz0i8iYMutIAwNEZL+ln4u1qQlH3y1W5jWwU/DFVCib2RfwH5pLLD7sZa11RosT8 Sza85moyOKtHOaIZtvjN2SAvkRxZlCIhhrurPIr9icnGVAKYt3vj6UjnrZXWv5XWb7+q +jiNgs6MLJN5/Rijtz4cKy9OLNHTU9UoXH3vLa1msdGXFbewjaTCTcJIoKOvQm4OYkAs glUYfbLaHDSIXgafgEhUaZRa9N43akOQ/EESExU+AdOleORV9J9TQNDcmYl2e5xpjTry bifupLKSnmBAm2V90LIzFs0JqzCkAbt6lDL3PkzETM7Uw1bB95FQzVefLFcb+duLBe6U 70Wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dmarc-filter:dkim-signature:dkim-signature; bh=EpM0hncBhCbNW87vPgxFlMl8MkRRWcXptJbG+FdULdA=; b=KkkXiqn6m850hjnuFGkeN0g+5PjuqERpLL0275aTqG9LicQchcMDhjzL9pTDQk++kp rpCXh+xokwKXy+YxwAWi5kcNr+gHaO6oacmgtlE0D1L/WaiDkMEuJ/w8YHBPNUy4ZIcU P7Z1OvOFgmt1sozAH+4E8VSX/KDP/ec4CA/C/dkKsDnB2DMkIp9NVMDPlfH5jJK/Nno3 6iikfFuQ0qlzboniVLttzAJ3OUB+qGZNx2fNYEhnRFmleoa1DpUYYR3f0qVlI5bftggC vlqnFKREsLRV8WAyVGgdJNARor00DtdiDFpsrhFjCg0mRFoJgVyKz7gugiHUYVi1HCCe cXHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b="g7fnb/zh"; dkim=pass header.i=@codeaurora.org header.s=default header.b=HZaFc5gR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f1si1709489pgi.432.2019.06.06.02.39.36; Thu, 06 Jun 2019 02:39:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b="g7fnb/zh"; dkim=pass header.i=@codeaurora.org header.s=default header.b=HZaFc5gR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727825AbfFFJi0 (ORCPT + 99 others); Thu, 6 Jun 2019 05:38:26 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:52412 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727359AbfFFJiZ (ORCPT ); Thu, 6 Jun 2019 05:38:25 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id D266E60FEB; Thu, 6 Jun 2019 09:38:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1559813904; bh=tsqL//XVJSyHPsn4WnbGr5Qz0DMSjGS8jSJVKedC0gA=; h=From:To:Cc:Subject:Date:From; b=g7fnb/zhTz/exA2ecO/+qVG4B7WFy4UzhxYZr3rIkg6w9Nn3h7mfU4NSYmFlH16D6 eLBg6HARf3cEifaVGm5kv9fU5ZnbAjNvJSS/l2RX0JTwh4iO/0RXIBGC0EGL19rFKh J0cZg9qFglVCw/uurYFaJf5FObBPn0R/4UD8USN0= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_INVALID,DKIM_SIGNED,SPF_NONE autolearn=no autolearn_force=no version=3.4.0 Received: from codeaurora.org (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: stummala@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id E43CF60255; Thu, 6 Jun 2019 09:38:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1559813903; bh=tsqL//XVJSyHPsn4WnbGr5Qz0DMSjGS8jSJVKedC0gA=; h=From:To:Cc:Subject:Date:From; b=HZaFc5gRGbuyS+uPsJOXHvLIc16i7lWVrelWKdHiOZCIZaJ4IaH5XQmk2kk0ESAPW U+3D/41cvMHrA6AUO1xd2+JccF7soEZuOWpO6yUNgcetn9eBp4GSHHLtMFujXvIc5i HI5X7MWbx0zNSxgpjkLk03sMqLf1mXFd5is10zpc= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org E43CF60255 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=stummala@codeaurora.org From: Sahitya Tummala To: Jaegeuk Kim , Chao Yu , linux-f2fs-devel@lists.sourceforge.net Cc: Sahitya Tummala , linux-kernel@vger.kernel.org Subject: [PATCH] f2fs: fix is_idle() check for discard type Date: Thu, 6 Jun 2019 15:08:13 +0530 Message-Id: <1559813893-23452-1-git-send-email-stummala@codeaurora.org> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The discard thread should issue upto dpolicy->max_requests at once and wait for all those discard requests at once it reaches dpolicy->max_requests. It should then sleep for dpolicy->min_interval timeout before issuing the next batch of discard requests. But in the current code of is_idle(), it checks for dcc_info->queued_discard and aborts issuing the discard batch of max_requests. This dcc_info->queued_discard will be true always once one discard command is issued. It is thus resulting into this type of discard request pattern - - Issue discard request#1 - is_idle() returns false, discard thread waits for request#1 and then sleeps for min_interval 50ms. - Issue discard request#2 - is_idle() returns false, discard thread waits for request#2 and then sleeps for min_interval 50ms. - and so on for all other discard requests, assuming f2fs is idle w.r.t other conditions. With this fix, the pattern will look like this - - Issue discard request#1 - Issue discard request#2 and so on upto max_requests of 8 - Issue discard request#8 - wait for min_interval 50ms. Signed-off-by: Sahitya Tummala --- fs/f2fs/f2fs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 95adedb..ea34fef 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -2209,7 +2209,7 @@ static inline bool is_idle(struct f2fs_sb_info *sbi, int type) get_pages(sbi, F2FS_DIO_WRITE)) return false; - if (SM_I(sbi) && SM_I(sbi)->dcc_info && + if (type != DISCARD_TIME && SM_I(sbi) && SM_I(sbi)->dcc_info && atomic_read(&SM_I(sbi)->dcc_info->queued_discard)) return false; -- Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc. Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.