From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 93C82EB64D8 for ; Wed, 14 Jun 2023 16:12:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232151AbjFNQMi (ORCPT ); Wed, 14 Jun 2023 12:12:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232050AbjFNQMg (ORCPT ); Wed, 14 Jun 2023 12:12:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E29D21FFF for ; Wed, 14 Jun 2023 09:12:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 72FF060ECD for ; Wed, 14 Jun 2023 16:12:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B66E7C433C0; Wed, 14 Jun 2023 16:12:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686759154; bh=FEAvt09O6YlhBhsJVN7XSwEaTIxjO3rTJIGM+hEU564=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=I+bdARuVnMWdw4t+E5ZTma/ibxUmcJ7ShxJ9VNEwWMqpy/xF5Y6fRnDbxYZLInq3o Sz/2uxYawHv0/oz732UW121Q2zelg4oo+9zyScjRiBjosdyV8WL4U6F836U0ImOZH6 5WnXuKNguk+my7Er9pftjkkNLZccC1VXtybFP2OwgqIXhAnlzGlyjKlCOIvtU9hZHm XcchYq7dPA9udSqGe27mHkmCUTz5FmCYwyviG8RnmVrbL+bqsHiWbV9JlNMQTYsm40 xpVD1mC3yog/JPFHtKdShRyb5xj8LpnlEa2IWDpXWEovId8Q6jX7zIZOXVnjgYqdyX 5V4rvSjySnTmg== Date: Wed, 14 Jun 2023 09:12:33 -0700 From: Jaegeuk Kim To: Daejun Park Cc: "linux-kernel@vger.kernel.org" , "linux-f2fs-devel@lists.sourceforge.net" Subject: Re: [f2fs-dev] [PATCH] f2fs: do not issue small discard commands during checkpoint Message-ID: References: <20230613203947.2745943-1-jaegeuk@kernel.org> <20230614060757epcms2p4e11a8f8bf2fa44eac99a5bb7f47f8dcd@epcms2p4> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230614060757epcms2p4e11a8f8bf2fa44eac99a5bb7f47f8dcd@epcms2p4> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Daejun, On 06/14, Daejun Park wrote: > Hi Jaegeuk, > > > If there're huge # of small discards, this will increase checkpoint latency > > insanely. Let's issue small discards only by trim. > > > > Signed-off-by: Jaegeuk Kim > > --- > > fs/f2fs/segment.c | 5 ++--- > > 1 file changed, 2 insertions(+), 3 deletions(-) > > > > diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c > > index 0c0c033c4bdd..ef46bb085385 100644 > > --- a/fs/f2fs/segment.c > > +++ b/fs/f2fs/segment.c > > @@ -2178,7 +2178,7 @@ void f2fs_clear_prefree_segments(struct f2fs_sb_info *sbi, > >          } > >          mutex_unlock(&dirty_i->seglist_lock); > > > > -        if (!f2fs_block_unit_discard(sbi)) > > +        if (!f2fs_block_unit_discard(sbi) || !force) > > If we don't handle the discard entries here, dcc->entry_list will still have them, > so stale discard entries may be handled by trim, causing incorrect discards to be issued. > Therefore, I think this patch should also prevent the creation of discard entries > in add_discard_addrs(), unless it is a checkpoint caused by trim. > This would further reduce the latency caused by the creation of a discard entry. I found this causes some objects were not reclaimed when removing the module. Hence I'm testing v2. > > Thanks, > Daejun >