From patchwork Thu Jun 29 21:51:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepak R Varma X-Patchwork-Id: 114453 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp9943399vqr; Thu, 29 Jun 2023 15:10:19 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7hoKwuqMQNukG9hxd9fSKmV5FffsfpRrv20Mk1lqykaHOw09CyLlAv40rcmMHcr7bZaIA+ X-Received: by 2002:aca:e109:0:b0:3a1:d4c4:ac4b with SMTP id y9-20020acae109000000b003a1d4c4ac4bmr628473oig.3.1688076619656; Thu, 29 Jun 2023 15:10:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688076619; cv=none; d=google.com; s=arc-20160816; b=hVvfEPq0qp7wFaubBKm2Bz2xZrQbQaQ7RGPfsTdJmU1/fQj5oBK9uFD8AFbFmT13ep WkyS68RMcrIZs4KfeKnhft4ELbr0Uv3P3mIpzPeSjq5sLyBRsaOv0QHzgj8TahqJiEjN joMTaHKX2pPzjYoi7B9b7SCmfrbeMnnUxL099EDJ5QGIrlej7OT8oeKXb/N4BLoZ+T3+ wVJsZy9KECSKf62J3hddc/1mprK6VbNK7ZpamxnjaXsLPdHNqCeHJGCFZfDWIVbo38NI 906l5XFGxkr53uznYqUqbFx1l1At+PIGxKyRBX2S9QLHE+IRr/LGhutyYToQjKO+kA63 w3Ow== 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=VqAL1afVs3VwQQxoVXsOQ91yHzULT56tCGgI4gabYgw=; fh=2/OepbD16sII06AHmQTJgD7xcw2OMNoUEY9t7KuTeGw=; b=U344dhGHyPOSRgafCdWXdAzIcTTcWi94mf9CGMKVBboFR88S5eNkKyWmClosiUNQg+ J2TDp8DTxaMNx8FrL9p6Gn0QjH2y0ZYcF5gDoIlL683vOlt9E7stllW52D3ofmUOB5IA 7YR4IG/RPMwHSIGjXpUNU3S2O1ruJwUiNZoVuc/4MJVoQFlHVEy4iQ9+Oow9m2DqMD85 1xvyssewxAIltoU5/WhJXFSWIcd9C9gqpRxU6bFy2takR758zBxj2EEBJ+0vIH+oQZdm iNt8zwFCqIJvoZJdpsWZ8aJFBDGzV63JRKmAiWxDb/MnLQuaQvrdSl6bJ/4wIcmWlXZt Dn0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b=QMyCcPAU; 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.10.03; Thu, 29 Jun 2023 15:10:19 -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=QMyCcPAU; 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 S231653AbjF2Vve (ORCPT + 99 others); Thu, 29 Jun 2023 17:51:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229742AbjF2Vvc (ORCPT ); Thu, 29 Jun 2023 17:51:32 -0400 Received: from msg-2.mailo.com (msg-2.mailo.com [213.182.54.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7180730D1 for ; Thu, 29 Jun 2023 14:51:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1688075487; bh=C7lSYHOPm/Z4sI0GQts4IYgG0YiR3DHTQkmvN2BfzJ4=; h=X-EA-Auth:Date:From:To:Cc:Subject:Message-ID:References: MIME-Version:Content-Type:In-Reply-To; b=QMyCcPAU/yNJ7M8ZoRbSzy+TrDT7NltcM2XbOYbAuqoUHgof5TyMaFqFkhP+XrsxV 4OamwRXXx4SMlX+QsORhYPxfNVfIbf5ZKOF2GrnCVzzH5RFoG+qCaNqj4Il/RC1s3d 3oGZ3w/Cqg8MdcOw68SSXakl6nPfeZUkYxtaExvU= Received: by b221-1.in.mailobj.net [192.168.90.21] with ESMTP via ip-20.mailobj.net [213.182.54.20] Thu, 29 Jun 2023 23:51:27 +0200 (CEST) X-EA-Auth: P5HCG1ciElwbYgm7onYtMKqytCsT9R2NvTWwxi5496GTptuJln+k/TlBbmf/Liqh+qR0xtiWqaFWGGY8kby6/5SK7yiAPc69 Date: Fri, 30 Jun 2023 03:21:17 +0530 From: Deepak R Varma To: Bob Peterson , Andreas Gruenbacher , cluster-devel@redhat.com, linux-kernel@vger.kernel.org Cc: Ira Weiny , "Fabio M. De Francesco" , Sumitra Sharma , Deepak R Varma Subject: [PATCH v3 4/6] gfs2: Replace kmap_atomic() by kmap_local_page() in lops.c Message-ID: <4817527acb9e015b3c6929517993ea50ba3427ad.1688073459.git.drv@mailo.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770076629241577581?= X-GMAIL-MSGID: =?utf-8?q?1770076629241577581?= kmap_atomic() is deprecated in favor of kmap_local_{folio,page}(). Therefore, replace kmap_atomic() with kmap_local_page() in following functions of lops.c: - gfs2_jhead_pg_srch() - gfs2_check_magic() - gfs2_before_commit() kmap_atomic() disables page-faults and preemption (the latter only for !PREEMPT_RT kernels), However, the code within the mapping/un-mapping in stuffed_readpage() 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 Signed-off-by: Deepak R Varma --- Changes in v3: - Patch included in patch series Changes in v2: - None fs/gfs2/lops.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/fs/gfs2/lops.c b/fs/gfs2/lops.c index 1902413d5d12..a7c2296cb3c6 100644 --- a/fs/gfs2/lops.c +++ b/fs/gfs2/lops.c @@ -427,7 +427,7 @@ static bool gfs2_jhead_pg_srch(struct gfs2_jdesc *jd, { struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode); struct gfs2_log_header_host lh; - void *kaddr = kmap_atomic(page); + void *kaddr = kmap_local_page(page); unsigned int offset; bool ret = false; @@ -441,7 +441,7 @@ static bool gfs2_jhead_pg_srch(struct gfs2_jdesc *jd, } } } - kunmap_atomic(kaddr); + kunmap_local(kaddr); return ret; } @@ -626,11 +626,11 @@ static void gfs2_check_magic(struct buffer_head *bh) __be32 *ptr; clear_buffer_escaped(bh); - kaddr = kmap_atomic(bh->b_page); + kaddr = kmap_local_page(bh->b_page); ptr = kaddr + bh_offset(bh); if (*ptr == cpu_to_be32(GFS2_MAGIC)) set_buffer_escaped(bh); - kunmap_atomic(kaddr); + kunmap_local(kaddr); } static int blocknr_cmp(void *priv, const struct list_head *a, @@ -699,10 +699,10 @@ static void gfs2_before_commit(struct gfs2_sbd *sdp, unsigned int limit, void *kaddr; page = mempool_alloc(gfs2_page_pool, GFP_NOIO); ptr = page_address(page); - kaddr = kmap_atomic(bd2->bd_bh->b_page); + kaddr = kmap_local_page(bd2->bd_bh->b_page); memcpy(ptr, kaddr + bh_offset(bd2->bd_bh), bd2->bd_bh->b_size); - kunmap_atomic(kaddr); + kunmap_local(kaddr); *(__be32 *)ptr = 0; clear_buffer_escaped(bd2->bd_bh); unlock_buffer(bd2->bd_bh);