Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp17547596rwd; Tue, 27 Jun 2023 04:44:33 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7DBt7a81ztLGLO4BauyPLW0TCblqUFS8aI5zTjPFaud4Sm0WXPNwarf0tICm86pYZ6PfI5 X-Received: by 2002:a17:902:d503:b0:1b8:1243:a4af with SMTP id b3-20020a170902d50300b001b81243a4afmr3074596plg.21.1687866272951; Tue, 27 Jun 2023 04:44:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687866272; cv=none; d=google.com; s=arc-20160816; b=gvMZTc/l3a1/a5q6F5yHsSEMCj/JwsY1HAag++pveSV6EaG9j+x+uMPOrhOtyybhwN GXEcS34EnY+bo4gyjoMDQAwwq4U3vPGUvXRpeNY+4SEKe/AcTp4I/srMyLfm9IdpSEXy k+d25Lj3frOhJuy9Itls6ZMFK+LRF8nkjLMnxyB/IJu4D88oqG6liTc0I2KfyaxSLy2a Ze+0PMSdDsC49+BlnLob7FN2WtN3wTGF5h/s77YTBSGFr2eWIo8+i0mVdTvVClIUgwms WQiccYgeJl6rCEmnfeIdReb550Ugs/iAOY51W7B7VHIE2qHq/sZW/GsKL34Kh4vemaqL ol+w== 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 :dkim-signature; bh=VD4gCHSw4USDEh9b2CAEXtZoeo6S0MoZYWWqACPYVs8=; fh=7AIElrz7fkdjwHpAET9hRtQEBLyYOnUOFcGQpKaXuxw=; b=zjzC3OpwYDYiZM3ZDiLuZ5a8xaSSvwcAv9cUws3vnQ3tgGL3dYzurxSOmHVdTat1ot hytWXhBoWyCRZFg4I1ooMxGgv756zdn5O2XdZKS49N/VZZVmRBaUlfgoKWRQsLVUlMrf YqKwSoXrMIxgqHHGqK3VSEf3nLsr8d6xLgJn4PtZNHFxQPx6mI5RFYPagSFN/DBISgBD TwR4LUkM5A+m+a15UYtDGB0gmSw2yL8Rq4znwWl4bTByYgNg3bqDcmJUN4xOYQGUakfc NBojiDMBgAMyLC5ldxAFLs+C7B3cr4QaAYEhUdYsHIi/knHuqggTCZSuDHzN6t3KvPLW 8hvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=dzEHlwrj; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l11-20020a17090270cb00b001b035819d5csi6444806plt.203.2023.06.27.04.44.19; Tue, 27 Jun 2023 04:44:32 -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=pass header.i=@gmail.com header.s=20221208 header.b=dzEHlwrj; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230486AbjF0LLx (ORCPT + 99 others); Tue, 27 Jun 2023 07:11:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229804AbjF0LLw (ORCPT ); Tue, 27 Jun 2023 07:11:52 -0400 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 171881BE4 for ; Tue, 27 Jun 2023 04:11:51 -0700 (PDT) Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-3090d3e9c92so6120924f8f.2 for ; Tue, 27 Jun 2023 04:11:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687864309; x=1690456309; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=VD4gCHSw4USDEh9b2CAEXtZoeo6S0MoZYWWqACPYVs8=; b=dzEHlwrjAq3l/IoDCt6xjw9i6BF7k8ufg0spNIZ9UqjNxd13I11BAW21Pju0z+hZ0h aMw4OO6iqqFMEDwEzhq7i9vZDccssCRfPHPiPI2+1EiwYggI2sQMwpD67Inu68gS/1un 8nP5FtIC4NNuaaPzx7zzaOAh6whNJr6nAlv1biltWYCJG6uHt+Ci0Ma+Ra8zxy09FZmk Tp0o7+EGqKyZYgbREvjtzv3XK9iis5JSz3DJgODhgIap5/m05mSKMieLu/W2noiYiqg8 fNQSPs/B3wAKNv/ze9YisGOID3fISFoQzBnzRQ2iGa4axNjcJgXVphax52RewIKfy3IZ 2+LA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687864309; x=1690456309; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VD4gCHSw4USDEh9b2CAEXtZoeo6S0MoZYWWqACPYVs8=; b=QLmPpufesnUgjQ87VhFBbiHKZkXEk7zPAnjYolIrlD/46i6rVbCZx7Fij6brhLNbk/ 05d9AMoPZCq7ziLIL9VMG89w9yik1QnhW+RQebLA0CFStcFUK/fzWcgu9ZPZlmctf1xd Fbv5+SHCFIsmB8GR+S8lomBRfm3BL4enNTYgWrfyZo2n2IBEulihRKFXT6mcmZAPyB/t FPJc9AVZoD7AZw4DtJ2HWJKZnGAR0zahU3C71UbJzAgGonOQGCSGVp9ICa/pZsAHEFpg FtmOXtSq58TkWk/fBNLaej9zgRWHLmAqtCL5nip2Z1KDvuSyhvgXl4hyixicIHz/EkFU /VHg== X-Gm-Message-State: AC+VfDyZqGgl0Ecxt4I1vunQM729f5j14z0DT58dynvK5qCE0VAP2jI9 FNA1cBCjXzYH2fGOy5rnLjI= X-Received: by 2002:adf:e585:0:b0:307:8879:6cc1 with SMTP id l5-20020adfe585000000b0030788796cc1mr33160184wrm.71.1687864309194; Tue, 27 Jun 2023 04:11:49 -0700 (PDT) Received: from suse.localnet (host-79-12-109-185.retail.telecomitalia.it. [79.12.109.185]) by smtp.gmail.com with ESMTPSA id t5-20020a05600001c500b00313f7b077fesm3479235wrx.59.2023.06.27.04.11.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jun 2023 04:11:48 -0700 (PDT) From: "Fabio M. De Francesco" To: Bob Peterson , Andreas Gruenbacher , cluster-devel@redhat.com, Deepak R Varma Cc: linux-kernel@vger.kernel.org, Ira Weiny , Sumitra Sharma , Deepak R Varma Subject: Re: [PATCH] gfs2: Replace deprecated kmap_atomic() by kmap_local_page() Date: Tue, 27 Jun 2023 13:11:46 +0200 Message-ID: <1905283.taCxCBeP46@suse> In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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 On domenica 25 giugno 2023 21:23:21 CEST Deepak R Varma wrote: > kmap_atomic() is deprecated in favor of kmap_local_{folio,page}(). > > Therefore, replace kmap_atomic() with kmap_local_folio() in > gfs2_internal_read() and stuffed_readpage(). > > kmap_atomic() disables page-faults and preemption (the latter only for > !PREEMPT_RT kernels), However, the code within the mapping/un-mapping in > gfs2_internal_read() and 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()). > > Signed-off-by: Deepak R Varma > --- > Note: The Patch is build tested only. I will be happy to run recommended > testing with some guidance if required. > > fs/gfs2/aops.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/fs/gfs2/aops.c b/fs/gfs2/aops.c > index 3b41542d6697..7bd92054d353 100644 > --- a/fs/gfs2/aops.c > +++ b/fs/gfs2/aops.c > @@ -432,10 +432,10 @@ static int stuffed_readpage(struct gfs2_inode *ip, > struct page *page) if (error) > return error; > > - kaddr = kmap_atomic(page); > + kaddr = kmap_local_page(page); > memcpy(kaddr, dibh->b_data + sizeof(struct gfs2_dinode), dsize); > memset(kaddr + dsize, 0, PAGE_SIZE - dsize); > - kunmap_atomic(kaddr); > + kunmap_local(kaddr); > flush_dcache_page(page); > brelse(dibh); > SetPageUptodate(page); > @@ -498,12 +498,12 @@ int gfs2_internal_read(struct gfs2_inode *ip, char *buf, > loff_t *pos, continue; > return PTR_ERR(page); > } > - p = kmap_atomic(page); > + p = kmap_local_page(page); > amt = size - copied; > if (offset + size > PAGE_SIZE) > amt = PAGE_SIZE - offset; > memcpy(buf + copied, p + offset, amt); How about using memcpy_from_page()? Fabio > - kunmap_atomic(p); > + kunmap_local(p); > put_page(page); > copied += amt; > index++; > -- > 2.34.1