Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1664140imu; Thu, 13 Dec 2018 21:02:44 -0800 (PST) X-Google-Smtp-Source: AFSGD/UvVLU3IKbaTufP5HEEwSNkLTnlkxKgaQw6FZGYktmyksKjQV39iyTw2KJYIwD17hFVq/wr X-Received: by 2002:a62:cdd:: with SMTP id 90mr1499854pfm.219.1544763764571; Thu, 13 Dec 2018 21:02:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544763764; cv=none; d=google.com; s=arc-20160816; b=Qf9Fdb5FWr8RB98UG6a+Z5xK82HbUcvkHgeFjBzy0EglWxEV5o4KlmoYimZCvHs1sf Uk+eMaif4LrkzEcGEg7jTC1EkMlMgL5k18eoQ4enVKTdepP1kk4sZ94bANkv40WEtl+a JZmQrdjiNTaE3NORbkX1WLpjaoN8egsKCoDX5kUrcowlsEwMSmR0K9c5Eqf4bcjGSD19 oyW1EDpAjnHrPt7JVBVgFhEW3CHs4uFIdSNKwHvgIIBNYiloxkdxC38P8AIa49UFz2de 57/j0esHEJoJFLBTGBYhHdO6pR09twdasZUD31sdBufqVgfIJf2K+KIYjOQMeMqS7G71 8/Yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=/NeT9/kEBaT8fBvZmsal8G4l5sc5X9mKzJhapFtzc4c=; b=zGhRsPgw8iZfTyGd9PWf0qIsSWeyrCqyqRIqyslCux9IG+AcEHuUQ/IbIw5iu/a1iV u9jtpjGEn9G1ClYRC4ekRS11TLa9CXUPO753fTDBir2NfXsLYCssI9Io9MnwRdMr4kOU hrrYRgE6oo129ibvT1/Q5o+jYPCGE9dL/redytgOno9pHg6MDWxGgFbFEg3XpwMBsvEn 83CHAxLmTLEx1gQiNELRlMRlCOiUy4iQ+1CO36YhDhv8xhEZ/9hWmEkMzwk+pdyL8/fk UOAq7MXO19130aS7taOfbwJbl3Sr6yW4QlWFWzrFvoYasKTeF6AT05BVWe61ybOvGMA8 4orQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CvVlj0OX; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z5si844687plh.133.2018.12.13.21.02.29; Thu, 13 Dec 2018 21:02:44 -0800 (PST) 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=@kernel.org header.s=default header.b=CvVlj0OX; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727099AbeLNFBb (ORCPT + 99 others); Fri, 14 Dec 2018 00:01:31 -0500 Received: from mail.kernel.org ([198.145.29.99]:60886 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726604AbeLNFBa (ORCPT ); Fri, 14 Dec 2018 00:01:30 -0500 Received: from localhost (unknown [104.132.0.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 63E6820892; Fri, 14 Dec 2018 05:01:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1544763690; bh=Tpzrwyk0FRh7zMpjqK9YCm+lq4Jj9gYQXggiSPATu/g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CvVlj0OXUsNPwNEl7qGBuMoMyi3JweAaj81fFn7OlM8EAZ5u+srvhVKjqO4ygEh+C 6Ru9VJ7em/f/XZa7YmcgHdaYBSyUAAUCs6d3DP+0etU8gYSEk3us15s5b6UHTqZAJL NFd6lng3ZsMVc1mytCJyrYFrf7YPaFEk08g6QdUA= From: Jaegeuk Kim To: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Cc: Jaegeuk Kim Subject: [PATCH 3/3] f2fs: flush stale issued discard candidates Date: Thu, 13 Dec 2018 21:01:27 -0800 Message-Id: <20181214050127.45025-3-jaegeuk@kernel.org> X-Mailer: git-send-email 2.19.0.605.g01d371f741-goog In-Reply-To: <20181214050127.45025-1-jaegeuk@kernel.org> References: <20181214050127.45025-1-jaegeuk@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Sometimes, I could observe # of issuing_discard to be 1 which blocks background jobs due to is_idle()=false. The only way to get out of it was to trigger gc_urgent. This patch avoids that by checking any candidates as done in the list. Signed-off-by: Jaegeuk Kim --- fs/f2fs/segment.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 49ea9009ab5a..acbbc924e518 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -1651,6 +1651,10 @@ static int issue_discard_thread(void *data) if (dcc->discard_wake) dcc->discard_wake = 0; + /* clean up pending candidates before going to sleep */ + if (atomic_read(&dcc->queued_discard)) + __wait_all_discard_cmd(sbi, NULL); + if (try_to_freeze()) continue; if (f2fs_readonly(sbi->sb)) -- 2.19.0.605.g01d371f741-goog