Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp17121073rwd; Mon, 26 Jun 2023 21:24:34 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ42q/q0zTmQk76dvsMGf5/HiKlcGlPvLG69mFNBkkOqWzkZN0A1qJ62cjop39dNvLs2//b5 X-Received: by 2002:a05:6a00:b8c:b0:673:aca1:a0b0 with SMTP id g12-20020a056a000b8c00b00673aca1a0b0mr8712526pfj.3.1687839874355; Mon, 26 Jun 2023 21:24:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687839874; cv=none; d=google.com; s=arc-20160816; b=XfIpIRNq4hidh6cukovor3q3iL5I+dU1Z06+clRIaZJJQyCLxV4nX9qPRbHZcMexBa +oV/MAzhLrxSIvgA35JUzf1MlYBNZhuXkZ9PdkL8wOYCvG6UNCTB7MTKyXHVbhSNO5tp bYrIrUUNzlo+2TYYy1nSHdcdCUR0ZiYBDmpH32kar6WIegup1bJI6ZG10EhI90mZn8J2 tmKeQJhr12C2Br9R/w8oLjkkPjPQaaAncyczAuYTVuXRYPuSA278J4ueUS1cu/zJFCAl NEWnhTi2biPweoYRw5ahOBKwcwXEBpDuPC7OGlq81tPYCtKweqUFmURGQTkSLPdZlOGZ s2hQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=BLmHsyqPufGEDqWhK4TW18ghrPJRAcuDI9St068tosg=; fh=gGe1bAmqosunpnKx861aPvPnisbppe3AO8eAJI9yG5k=; b=LrHvDRAA9bORMcLmSubXllPbmRXFFUJ5hCAV4d/oTQRVB4ipk1Y29L9oGuEmyQZNE/ ydpE9cJsZla8WDJrEvqHJmZpUfmmqyuXCf0aODwS0zg0Tzl9EW3Sj++BCFDO70aFLuwu 9Y2u1YLsns5HMQQLCNLG3+18BImwLyGAivIfYkClPXaqlygOHhWkgqwbMSc3ubzuEHKm vURUPUOtK7Octu066Jn8h5qmW9U4KKNMBAIJ15pALGLN47WSHBMlvkgtRS/QpBSY/VUZ jTck49WpDEDJ/kU+nFvudkWWJizBi/HB0tpw6QKbBEs19vMs4GrpxzEN1Yglxlgi/GOE 2/Wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=1DFDuaCt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i62-20020a638741000000b005443ff97149si6796205pge.331.2023.06.26.21.24.22; Mon, 26 Jun 2023 21:24:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=1DFDuaCt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229900AbjF0EMN (ORCPT + 99 others); Tue, 27 Jun 2023 00:12:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229453AbjF0EML (ORCPT ); Tue, 27 Jun 2023 00:12:11 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2750A10FC; Mon, 26 Jun 2023 21:12:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=BLmHsyqPufGEDqWhK4TW18ghrPJRAcuDI9St068tosg=; b=1DFDuaCtDRl1uZpfCO7uKXpBIV VDMYxiOdi74H4VKK0YxlX2JekqT4HUmiYgQPXywh0R+d45YLFWDNUWk0mQ50cgiq+BhpjeAWJjb8e 6ispYPCbW3c/ywQj5scvFylnY4HlmWrzQjfmuKmz3whr32i11q69fE/KGMIMkcKIxDi+LR1kCtYkj 43K2Nu0OrWxrLsmg4dK1XhD5UypUcCAZLftXfQXNA6o7CsUiaj4gabHIFX1GdHPK1FoBCy2QcNLfn hdEcMx7gK6McDE2GiEjX6drIj4rAcEyw/TgBHKZK6AUPLp0JSeR6+t/3gg3HCyw9uMzC3MfunDvkI 26BF9OoQ==; Received: from hch by bombadil.infradead.org with local (Exim 4.96 #2 (Red Hat Linux)) id 1qE03j-00Bf19-36; Tue, 27 Jun 2023 04:12:07 +0000 Date: Mon, 26 Jun 2023 21:12:07 -0700 From: Christoph Hellwig To: "Matthew Wilcox (Oracle)" Cc: linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Jan Kara , David Howells Subject: Re: [PATCH 03/12] writeback: Factor should_writeback_folio() out of write_cache_pages() Message-ID: References: <20230626173521.459345-1-willy@infradead.org> <20230626173521.459345-4-willy@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230626173521.459345-4-willy@infradead.org> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > + if (folio_test_writeback(folio)) { > + if (wbc->sync_mode != WB_SYNC_NONE) > + folio_wait_writeback(folio); > + else > + return false; > + } Please reorder this to avoid the else and return earlier while you're at it: if (folio_test_writeback(folio)) { if (wbc->sync_mode == WB_SYNC_NONE) return false; folio_wait_writeback(folio); } (that's what actually got me started on my little cleanup spree while checking some details of the writeback waiting..) > + BUG_ON(folio_test_writeback(folio)); > + if (!folio_clear_dirty_for_io(folio)) > + return false; > + > + return true; .. return folio_clear_dirty_for_io(folio); ?