From patchwork Wed Oct 7 01:05:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jerome Glisse X-Patchwork-Id: 11819519 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 78572139F for ; Wed, 7 Oct 2020 01:07:26 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 195B02078E for ; Wed, 7 Oct 2020 01:07:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="IOyzJ/wO" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 195B02078E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 43E516B0068; Tue, 6 Oct 2020 21:07:25 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 3F7C86B006C; Tue, 6 Oct 2020 21:07:25 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2DC48900002; Tue, 6 Oct 2020 21:07:25 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0180.hostedemail.com [216.40.44.180]) by kanga.kvack.org (Postfix) with ESMTP id F25376B0068 for ; Tue, 6 Oct 2020 21:07:24 -0400 (EDT) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 8F5938249980 for ; Wed, 7 Oct 2020 01:07:24 +0000 (UTC) X-FDA: 77343341208.25.glue75_5813701271cb Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin25.hostedemail.com (Postfix) with ESMTP id 6AACE1804E3A0 for ; Wed, 7 Oct 2020 01:07:24 +0000 (UTC) X-Spam-Summary: 1,0,0,,d41d8cd98f00b204,jglisse@redhat.com,,RULES_HIT:30054:30079:30090,0,RBL:216.205.24.124:@redhat.com:.lbl8.mailshell.net-62.18.0.100 64.10.201.10;04y839gc1kwypzerowr69esafixyyypee89ymksjj7debh3u3g1zzsgjhrwdtyy.iq8rteiuh4q88kpc1xiiz8b1qnz1qisfz3dksiw3j1z5aqia461bw9xb7z3z6qo.o-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:ft,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:24,LUA_SUMMARY:none X-HE-Tag: glue75_5813701271cb X-Filterd-Recvd-Size: 5107 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by imf09.hostedemail.com (Postfix) with ESMTP for ; Wed, 7 Oct 2020 01:07:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602032843; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8PSJcheqUDDToEl8LyLenCmOLYWMUxgCUNnl1drojhw=; b=IOyzJ/wOCbW4HGjSmT/KdHIo+R+ANRQpLKMTRGCIHbzjTiLzzlDtW/q50XKkgF8W6Hcmal mJMIIfovkydvLFPLc1lO8VKCN+NSCqBEfxGPlKqWw/VJWHHg0neAXEN6HD4sTY1BR6b/x0 djlX5Q38Zl6QL5w72+WOWHZLRFwiIh8= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-447-HUx6P1GsOLGRZdvH5bgm_w-1; Tue, 06 Oct 2020 21:07:19 -0400 X-MC-Unique: HUx6P1GsOLGRZdvH5bgm_w-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 62944803F5D; Wed, 7 Oct 2020 01:07:17 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-119-161.rdu2.redhat.com [10.10.119.161]) by smtp.corp.redhat.com (Postfix) with ESMTP id A1F955D9D2; Wed, 7 Oct 2020 01:07:13 +0000 (UTC) From: jglisse@redhat.com To: linux-kernel@vger.kernel.org Cc: =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, Alexander Viro , Tejun Heo , Jan Kara , Josef Bacik , Andrew Morton Subject: [PATCH 03/14] fs: directly use a_ops->freepage() instead of a local copy of it. Date: Tue, 6 Oct 2020 21:05:52 -0400 Message-Id: <20201007010603.3452458-4-jglisse@redhat.com> In-Reply-To: <20201007010603.3452458-1-jglisse@redhat.com> References: <20201007010603.3452458-1-jglisse@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Jérôme Glisse Coccinelle is confuse with function pointer, convert to directly use a_ops->freepage() to be nice to coccinelle. Signed-off-by: Jérôme Glisse Cc: linux-fsdevel@vger.kernel.org Cc: linux-mm@kvack.org Cc: Alexander Viro Cc: Tejun Heo Cc: Jan Kara Cc: Josef Bacik Cc: Andrew Morton --- mm/filemap.c | 12 ++++-------- mm/vmscan.c | 7 ++----- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/mm/filemap.c b/mm/filemap.c index 2cdbbffc55522..ba892599a2717 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -242,11 +242,8 @@ void __delete_from_page_cache(struct page *page, void *shadow) static void page_cache_free_page(struct address_space *mapping, struct page *page) { - void (*freepage)(struct page *); - - freepage = mapping->a_ops->freepage; - if (freepage) - freepage(page); + if (mapping->a_ops->freepage) + mapping->a_ops->freepage(page); if (PageTransHuge(page) && !PageHuge(page)) { page_ref_sub(page, HPAGE_PMD_NR); @@ -790,7 +787,6 @@ EXPORT_SYMBOL(file_write_and_wait_range); int replace_page_cache_page(struct page *old, struct page *new, gfp_t gfp_mask) { struct address_space *mapping = old->mapping; - void (*freepage)(struct page *) = mapping->a_ops->freepage; pgoff_t offset = old->index; XA_STATE(xas, &mapping->i_pages, offset); unsigned long flags; @@ -819,8 +815,8 @@ int replace_page_cache_page(struct page *old, struct page *new, gfp_t gfp_mask) if (PageSwapBacked(new)) __inc_lruvec_page_state(new, NR_SHMEM); xas_unlock_irqrestore(&xas, flags); - if (freepage) - freepage(old); + if (mapping->a_ops->freepage) + mapping->a_ops->freepage(old); put_page(old); return 0; diff --git a/mm/vmscan.c b/mm/vmscan.c index 466fc3144fffc..6db869339073d 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -903,9 +903,6 @@ static int __remove_mapping(struct address_space *mapping, struct page *page, xa_unlock_irqrestore(&mapping->i_pages, flags); put_swap_page(page, swap); } else { - void (*freepage)(struct page *); - - freepage = mapping->a_ops->freepage; /* * Remember a shadow entry for reclaimed file cache in * order to detect refaults, thus thrashing, later on. @@ -928,8 +925,8 @@ static int __remove_mapping(struct address_space *mapping, struct page *page, __delete_from_page_cache(page, shadow); xa_unlock_irqrestore(&mapping->i_pages, flags); - if (freepage != NULL) - freepage(page); + if (mapping->a_ops->freepage != NULL) + mapping->a_ops->freepage(page); } return 1;