Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp838224pxb; Thu, 15 Apr 2021 07:47:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJywXLDECQra7ivAj/sQDN9N1GLVxgA0JiPLbdFGWYzJl3LTyLX+V+5wMGum4GnViWqYfduK X-Received: by 2002:a17:90a:9a2:: with SMTP id 31mr4332825pjo.206.1618498057032; Thu, 15 Apr 2021 07:47:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618498057; cv=none; d=google.com; s=arc-20160816; b=nLg+haq1D7s3QvZWvIDc7I0Vr2AB18VxCzbI7hZKyFiYYPNq5n3ghtrLMdNwzH8Izp QDB5du47zOrl4YXeBOpVO2I18jbmF9z5XDbwM8QVoIIUJCYeDvS7gCQqAYOQwNZ0y9N4 DAD0OKJDmj0ddVFMdaRbSECR0O3JomNTO64uHJRJbG0kjHTwImC2VUPlbHjoTuxGW7nM KQCc4NRQdqPG+YBfpW02c9zDd9bD/iL1SwsmrzjFkUgK2uz8nvMiWvpBrady7XqbR3QU AgS1aee9BXo9186MX51Qh+R6Z15os9E7kgKp+lvJE/5Bi1+LWD4sazMv67OVqRu/4iFg 7njA== 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=DCBSWmrCJfa4/K3AiPkI+ofdOr4wt6uSHRs4glxHxFA=; b=lV2s3Pb6MbmYt1nC2Mm2x+yFFq2131J0DBZVS4TOMEIVcb/zAKeDMKaLbPv2fmleUV BZaprW2WPMStaQSWpMdklf/ec0mo95XLBwv/2R7O+4pv7TK7mtsz0CA7mmOeySLVxXgK VzFqB3qSoVYJEJyHjnJlMMAqxIEgC7n7thdoZczHYQJc2qTGZMCtbAMHIKJKkTdsxluC LSeeVZiy3RaCGnnsxec8MHEe95Hx9xXGz3ns/QhDHvtc2xc3Jffpn7NreLd3P/kOmcAI SU5wv/fX36ouWp9IFSJM5zyaj1StNJW8s0QfuQF2B9xJjbiyDfzDWdHRhrG8+pPMzG4l CnXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=Y+SU13o4; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l14si3193887pgc.150.2021.04.15.07.47.22; Thu, 15 Apr 2021 07:47:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=Y+SU13o4; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232767AbhDOOqf (ORCPT + 99 others); Thu, 15 Apr 2021 10:46:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231549AbhDOOqf (ORCPT ); Thu, 15 Apr 2021 10:46:35 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E024C061574; Thu, 15 Apr 2021 07:46:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; 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=DCBSWmrCJfa4/K3AiPkI+ofdOr4wt6uSHRs4glxHxFA=; b=Y+SU13o4f/rB7+MpjS20NagpYq LX6fOqzSkFgPWF7e9gqGYrFUBjeYp7D0hxGzlAa9B+T23MaDxGDzfDZEkXqs9yL7tyeiSdf9y/cHw oAfonrP8Y1GLpCf3Cz3JmsXSp27BhVNx8RAlnneIBw0ySQKiGCFPDl6o4R6Xjl1t0YVseBr2WzE2X WWane+zKD97RdoYp2FXMJX4hEGUnrcSfcYhpyNIScNx9kCVRmssg+w91fR/1Oy9YlgnGNVlCqVUZ2 LI1knadXLG0YjrNUrsgHwXgEHGiYyjaUDYb0S/q1SyrhYfiq/NmltofBq1//+4CxH/kc7bg15XXCy 5Z3pJioQ==; Received: from hch by casper.infradead.org with local (Exim 4.94 #2 (Red Hat Linux)) id 1lX3Fo-008glT-7F; Thu, 15 Apr 2021 14:46:03 +0000 Date: Thu, 15 Apr 2021 15:46:00 +0100 From: Christoph Hellwig To: Zhang Yi Cc: linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org, tytso@mit.edu, adilger.kernel@dilger.ca, jack@suse.cz, yukuai3@huawei.com Subject: Re: [RFC PATCH v2 4/7] jbd2: do not free buffers in jbd2_journal_try_to_free_buffers() Message-ID: <20210415144600.GB2069063@infradead.org> References: <20210414134737.2366971-1-yi.zhang@huawei.com> <20210414134737.2366971-5-yi.zhang@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210414134737.2366971-5-yi.zhang@huawei.com> X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Wed, Apr 14, 2021 at 09:47:34PM +0800, Zhang Yi wrote: > static int blkdev_releasepage(struct page *page, gfp_t wait) > { > struct super_block *super = BDEV_I(page->mapping->host)->bdev.bd_super; > + int ret = 0; > > if (super && super->s_op->bdev_try_to_free_page) > + ret = super->s_op->bdev_try_to_free_page(super, page, wait); > + if (!ret) > + return try_to_free_buffers(page); > + return 0; This would rea much better as: if (super && super->s_op->bdev_try_to_free_page && super->s_op->bdev_try_to_free_page(super, page, wait) return 0; return try_to_free_buffers(page); and I think changing ->bdev_try_to_free_page to return a bool where true means "yes, free the buffers" and false means "don't free buffers" would be a better calling convention. Also please split the changes to the method signature from the ext4 internal cleanups.