[v3,6/6] gfs2: Replace kmap_atomic() by kmap_local_page() in gfs2_write_buf_to_page
Message ID | 4bed561513ba76486ea3fc87f97e6c646f98cbe7.1688073459.git.drv@mailo.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp9944954vqr; Thu, 29 Jun 2023 15:13:16 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5iH2+S3ZB7TReddR77nUoXwCd/olAxkNcSWUNVAg/YyOjPzsDo508kpri6Ug32FeonLRQt X-Received: by 2002:a05:6a20:8e01:b0:123:149b:a34f with SMTP id y1-20020a056a208e0100b00123149ba34fmr1288628pzj.1.1688076795652; Thu, 29 Jun 2023 15:13:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688076795; cv=none; d=google.com; s=arc-20160816; b=foQScbAbEbmyb4w0+y77ln++dZforcx1Z03oAWN02AXkClL36m3rZ+mSCdeV3R+jqM OJ/2QQBGsJZ+pmq9Z5SjZX3QRRAUjboFDq/51oVgdFelThwHL6EvsHXXgW+ACgoX0kr9 M0xL/rpuHkVuXL3+qkOUospsD1qRSPpQX0P7D3zP3/tIP9jbhd48SajliPkegEUrGKfc CMUT1/FZtJXyU6rUKYZiU8RJXOn0Nie/5M8BTLpbcgA08mAOw1isxMczSSKHb9+lYzUJ QE9P9XwQDns+1mxPJ6czWyufKccoJ/b720zmvm4ttcDf9wPMSg6dz6vyKohNHXSgKDCM LT3A== 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=Dn4FxUBt1nJ2/5Cw/yPMrck6RPvZ2RavcA0IvoH9SbU=; fh=2/OepbD16sII06AHmQTJgD7xcw2OMNoUEY9t7KuTeGw=; b=zgEB25dXuuKmdjUKuJub86Z7JZfwa3Ep5TwIW3mGn1snPa8c2HNrCrfTBHVSBirqlo joSECAae2Ig9HP+/3UyCWVDVOsUC/HtpH4lMo4O2pfqnkxIJcZjTQ2VKa6ltJY5OeKuF fa/0f83YZsNZBXrkxEVCAWJ+AgDrrQEGP5q7n1nKDWZUOfzABTHJYOzyPgdtjZLypIqi YnbWKs31BtVT/5qXwS8ETATSiyziV6YkmD7pR9OI3ifomjDIyuuiHOvmZ4htOP7ad9tt XAKbalXQtAh6VQaPM9CYOshVsF49eWyQF8dQiNvWcV33iJyTP1Pz5Z7mfiNsnc/auPKx M7jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b=jROdF5sK; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mailo.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z16-20020a656650000000b005574bf28174si11316901pgv.491.2023.06.29.15.13.02; Thu, 29 Jun 2023 15:13:15 -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=fail header.i=@mailo.com header.s=mailo header.b=jROdF5sK; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mailo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232139AbjF2Vwn (ORCPT <rfc822;ivan.orlov0322@gmail.com> + 99 others); Thu, 29 Jun 2023 17:52:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232125AbjF2Vwl (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 29 Jun 2023 17:52:41 -0400 Received: from msg-4.mailo.com (msg-4.mailo.com [213.182.54.15]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB41D30C4 for <linux-kernel@vger.kernel.org>; Thu, 29 Jun 2023 14:52:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1688075556; bh=UA/oPXEOCkpLvdvEKZfva8LkSO3tk7fFipNWehdBuOA=; h=X-EA-Auth:Date:From:To:Cc:Subject:Message-ID:References: MIME-Version:Content-Type:In-Reply-To; b=jROdF5sKV/UphvUFU2txfGwyrTjsaRUbPT4TQa58ZW19BxibusSFDDztO1qgzlsyA YcyR1gW1BBlDJgqCWuGxBDr2NTTWyZzc2XsAmJG8/Le2odaW5y/ufJi8wq2+CGdl5Y f6AbJ5dIIJ7cUFUEqV8whZmHs2ch3/yWwjoVoT8E= Received: by b221-2.in.mailobj.net [192.168.90.22] with ESMTP via ip-20.mailobj.net [213.182.54.20] Thu, 29 Jun 2023 23:52:36 +0200 (CEST) X-EA-Auth: Rz1yyKWhBlZLKK+E7BgmFVdgRQu2DOQ6nBvjfd3qC+VEec0HVUJnMCWv71/GeS1XHqO4oOENrwt389pQ/71L0tyeKcGUbMkM Date: Fri, 30 Jun 2023 03:22:27 +0530 From: Deepak R Varma <drv@mailo.com> To: Bob Peterson <rpeterso@redhat.com>, Andreas Gruenbacher <agruenba@redhat.com>, cluster-devel@redhat.com, linux-kernel@vger.kernel.org Cc: Ira Weiny <ira.weiny@intel.com>, "Fabio M. De Francesco" <fmdefrancesco@gmail.com>, Sumitra Sharma <sumitraartsy@gmail.com>, Deepak R Varma <drv@mailo.com> Subject: [PATCH v3 6/6] gfs2: Replace kmap_atomic() by kmap_local_page() in gfs2_write_buf_to_page Message-ID: <4bed561513ba76486ea3fc87f97e6c646f98cbe7.1688073459.git.drv@mailo.com> References: <cover.1688073459.git.drv@mailo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <cover.1688073459.git.drv@mailo.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770076814210199230?= X-GMAIL-MSGID: =?utf-8?q?1770076814210199230?= |
Series |
gfs2: kmap{_atomic} conversion to kmap_local_{page/folio}
|
|
Commit Message
Deepak R Varma
June 29, 2023, 9:52 p.m. UTC
kmap_atomic() is deprecated in favor of kmap_local_{folio,page}().
Therefore, replace kmap_atomic() with kmap_local_page() in
gfs2_write_buf_to_page().
kmap_atomic() disables page-faults and preemption (the latter only for
!PREEMPT_RT kernels), However, the code within the mapping/un-mapping in
gfs2_write_buf_to_page() does not depend on the above-mentioned side
effects.
Therefore, a mere replacement of the old API with the new one is all that
is required (i.e., there is no need to explicitly add any calls to
pagefault_disable() and/or preempt_disable()).
Suggested-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
Signed-off-by: Deepak R Varma <drv@mailo.com>
---
Changes in v3:
- Patch included in patch set
Changes in v2:
- None
fs/gfs2/quota.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Comments
On giovedì 29 giugno 2023 23:52:27 CEST Deepak R Varma wrote: > kmap_atomic() is deprecated in favor of kmap_local_{folio,page}(). Deepak, Again please refer to documentation and/or Ira's deprecation patch. The reasons why are in one of my previous messages. > Therefore, replace kmap_atomic() with kmap_local_page() in > gfs2_write_buf_to_page(). > > kmap_atomic() disables page-faults and preemption (the latter only for > !PREEMPT_RT kernels), However, the code within the mapping/un-mapping in > gfs2_write_buf_to_page() does not depend on the above-mentioned side > effects. > > Therefore, a mere replacement of the old API with the new one is all that > is required (i.e., there is no need to explicitly add any calls to > pagefault_disable() and/or preempt_disable()). > > Suggested-by: Fabio M. De Francesco <fmdefrancesco@gmail.com> > Signed-off-by: Deepak R Varma <drv@mailo.com> > --- > Changes in v3: > - Patch included in patch set > > Changes in v2: > - None > > > fs/gfs2/quota.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c > index 386ca770ce2e..e5767133aeea 100644 > --- a/fs/gfs2/quota.c > +++ b/fs/gfs2/quota.c > @@ -764,10 +764,10 @@ static int gfs2_write_buf_to_page(struct gfs2_inode *ip, > unsigned long index, } > > /* Write to the page, now that we have setup the buffer(s) */ > - kaddr = kmap_atomic(page); > + kaddr = kmap_local_page(page); > Well, if this page could come from HIGHMEM, how about memcpy_to_page()? Otherwise, (if it cannot come from HIGHMEM) we don't need to kmap*() it. Can you please take a look at the allocation's flags? Thanks, Fabio > > memcpy(kaddr + off, buf, bytes); > flush_dcache_page(page); > - kunmap_atomic(kaddr); > + kunmap_local(kaddr); > unlock_page(page); > put_page(page); > > -- > 2.34.1
On Sat, Jul 01, 2023 at 03:54:06PM +0200, Fabio M. De Francesco wrote: > On giovedì 29 giugno 2023 23:52:27 CEST Deepak R Varma wrote: > > kmap_atomic() is deprecated in favor of kmap_local_{folio,page}(). > > Deepak, > > Again please refer to documentation and/or Ira's deprecation patch. The > reasons why are in one of my previous messages. Hi Fabio, This change was already added by Andreas. So my patchset can be dropped. However, your feedback on the individual patches is agreed to and accepted. I will keep your suggestions in mind when I submit next patches. Thank you :) Deepak. > > > Therefore, replace kmap_atomic() with kmap_local_page() in > > -- > > 2.34.1 > > > >
diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c index 386ca770ce2e..e5767133aeea 100644 --- a/fs/gfs2/quota.c +++ b/fs/gfs2/quota.c @@ -764,10 +764,10 @@ static int gfs2_write_buf_to_page(struct gfs2_inode *ip, unsigned long index, } /* Write to the page, now that we have setup the buffer(s) */ - kaddr = kmap_atomic(page); + kaddr = kmap_local_page(page); memcpy(kaddr + off, buf, bytes); flush_dcache_page(page); - kunmap_atomic(kaddr); + kunmap_local(kaddr); unlock_page(page); put_page(page);