Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp564558pxj; Thu, 27 May 2021 06:49:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzuu4tblLglqkeQMN7rkEvXrFeX6OjR3cUYWER4UwdaDT0Ks5i+8MITtA+gNdHae25Sbb6z X-Received: by 2002:a05:6e02:547:: with SMTP id i7mr3036468ils.281.1622123365541; Thu, 27 May 2021 06:49:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622123365; cv=none; d=google.com; s=arc-20160816; b=Bm/jLz14xPbb795J59Hc4Dpv1oBq2DQR6ftUIS2G4Vy2mYoHV6aL+Ls7Y+2ggHQJvZ sxm2HMrev5lUSUoQeuzoKeHKnSg2sJWZlzhHg8cjAXH8BuZdImtvFfPpiMpj2fJ6Cn8J OfyWMSfo4ViYhy7lCNfZilbj1++EBO5IatnSM82qqIeXOZgsPrjDuFhOTYufVYPh+85m xfmlQjUBMrH1pfMeME7j0QuiGSU2ccaSTEkNE5hvssx0QTkiSEMEqSJbrR262HXiU2/6 lW8Lnhb1n4NAvflG/BlOGhdUIKp5jz8eChMmM8huGI1wBtuRnD28IXF/FtvvVQbKHYiH u3TQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=RNA+uxGRkhB9beXNJTE2NZFzMSNTaHB3PL95VvrduZI=; b=F6kCPrI8Y2ahICYigksbSP4HgiQf7JKoaX9178KkdjPNIAkPucKFxZ6Uqbdw3e3vei wkd0ohTybloQX58uXo3oTwYLtiPYRibO5dwiXA+jxfSSxIdu0vq3QEwCsfvaEEyjkNlp xB+u4IrL3cCUaDRWQ9alTjBoPWFOjUc45dcoSE9ofkhr0ooncsQqdEDTsd5mocyRoSY6 lnT+/d0n8Un8KSTMwvAWus+YyKQqG0O6776DdgT71DlhVnKbjuAKMYUh7vC2PJGlg4Xl 2v6r96ihGn25Bh3U9T0S/B+HwSxpHVItLhRHMw0c+YR2rGyJrxRuqDnYlIkXw/HnQcaE +Fwg== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t2si2347500ilg.26.2021.05.27.06.49.12; Thu, 27 May 2021 06:49:25 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236593AbhE0NtB (ORCPT + 99 others); Thu, 27 May 2021 09:49:01 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:2504 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236535AbhE0Nsz (ORCPT ); Thu, 27 May 2021 09:48:55 -0400 Received: from dggeme752-chm.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4FrTZc006nzYr8G; Thu, 27 May 2021 21:44:39 +0800 (CST) Received: from huawei.com (10.175.127.227) by dggeme752-chm.china.huawei.com (10.3.19.98) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Thu, 27 May 2021 21:47:19 +0800 From: Zhang Yi To: CC: , , , , Subject: [RFC PATCH v3 7/8] ext4: remove bdev_try_to_free_page() callback Date: Thu, 27 May 2021 21:56:40 +0800 Message-ID: <20210527135641.420514-8-yi.zhang@huawei.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20210527135641.420514-1-yi.zhang@huawei.com> References: <20210527135641.420514-1-yi.zhang@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.127.227] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggeme752-chm.china.huawei.com (10.3.19.98) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org After we introduce a jbd2 shrinker to release checkpointed buffer's journal head, we could free buffer without bdev_try_to_free_page() under memory pressure. So this patch remove the whole bdev_try_to_free_page() callback directly. It also remove many use-after-free issues relate to it together. Signed-off-by: Zhang Yi --- fs/ext4/super.c | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/fs/ext4/super.c b/fs/ext4/super.c index bf6d0085e1b7..b778236d06e6 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -1442,26 +1442,6 @@ static int ext4_nfs_commit_metadata(struct inode *inode) return ext4_write_inode(inode, &wbc); } -/* - * Try to release metadata pages (indirect blocks, directories) which are - * mapped via the block device. Since these pages could have journal heads - * which would prevent try_to_free_buffers() from freeing them, we must use - * jbd2 layer's try_to_free_buffers() function to release them. - */ -static int bdev_try_to_free_page(struct super_block *sb, struct page *page, - gfp_t wait) -{ - journal_t *journal = EXT4_SB(sb)->s_journal; - - WARN_ON(PageChecked(page)); - if (!page_has_buffers(page)) - return 0; - if (journal) - return jbd2_journal_try_to_free_buffers(journal, page); - - return try_to_free_buffers(page); -} - #ifdef CONFIG_FS_ENCRYPTION static int ext4_get_context(struct inode *inode, void *ctx, size_t len) { @@ -1656,7 +1636,6 @@ static const struct super_operations ext4_sops = { .quota_write = ext4_quota_write, .get_dquots = ext4_get_dquots, #endif - .bdev_try_to_free_page = bdev_try_to_free_page, }; static const struct export_operations ext4_export_ops = { -- 2.25.4