Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp8678793rwl; Sat, 31 Dec 2022 09:47:25 -0800 (PST) X-Google-Smtp-Source: AMrXdXt6En208Px5Zc5CuLJw4ixdGPc3ZSyKqzYrCsgyp0q53ABOf4HvIi4grw7PB59XgB63oBw9 X-Received: by 2002:a17:907:d48a:b0:7c0:971e:f6c5 with SMTP id vj10-20020a170907d48a00b007c0971ef6c5mr33398289ejc.14.1672508844975; Sat, 31 Dec 2022 09:47:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672508844; cv=none; d=google.com; s=arc-20160816; b=yp0c4rL5ml4m67Em0A1whNLI5KOOPkvHhwfBUcBbht51byCn68skPRKUb+fz7z7gy8 36jFPfFrK1V/pYuQZKGztXaa3U+uvmDA1nOcj4bpuuynxSMpB8wEG6xCFb2vinpSLtlx OYvQ+hzSsFinXPRdgUh03OfFIslp++zR5/ms+90G4MaEWQN0SEq/7qi5s+r0hK/hTLn8 KDaGMXghKdeuzUd5IcgWSEr/mKJEBm0Gz0wKVw1E3mUTQOBuuj3E958TBWDjeRO4ThwV 6aBnMOpptuMeEyhssnuJRv9xMl+UZ7VNw4jpwHUlRShmwcL/UqXcZ/U9tf6DriElCmYg NsFw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=VDxzoBipuwgJ9nXmM8IIPQyqkbvF/xMtt7DwxtCT5D8=; b=GjCh5KJDAFit87/+pJlit2pVs0l5atIm02w4CZ4vsAO5/LsS0ws7uXwsuK3BPe8bt6 78SK0PVgyqRkI67WDlm/j6TGvVCpUSV6eWq+NJGIEYrYVFeVEVi+dLUA4mRllDXche1n d6lT+o5SmQ8XfD/o+GdhSeQzxRtYhI2AtZ+eLla/qVyaaoUOdqZGc6SJenBM+mT7eHdt Jn2Nl9eENQUox2TR1amXttuDP3KdRY8B/Zr/kH+jIr+NMUxNrLgU0WSRrQxLpaCmxKen VYdMneNMAhWVjsbwmCi/HH8TBJmQgSCEqeaJ9vqSEpwDKKslkRsGQz2wPKTeWpsXF8iY 9/PQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=pBKkIKny; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-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 ne35-20020a1709077ba300b0077d854aa10dsi21202216ejc.57.2022.12.31.09.46.52; Sat, 31 Dec 2022 09:47:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4-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=20210112 header.b=pBKkIKny; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-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 S229560AbiLaRmO (ORCPT + 99 others); Sat, 31 Dec 2022 12:42:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229450AbiLaRmN (ORCPT ); Sat, 31 Dec 2022 12:42:13 -0500 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0851CF52; Sat, 31 Dec 2022 09:42:12 -0800 (PST) Received: by mail-wm1-x333.google.com with SMTP id c65-20020a1c3544000000b003cfffd00fc0so20976439wma.1; Sat, 31 Dec 2022 09:42:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=VDxzoBipuwgJ9nXmM8IIPQyqkbvF/xMtt7DwxtCT5D8=; b=pBKkIKnyLK8+/jEPZDupGUVaRyZrdOvlC2089EskdKymkUwbjENKm+zuo8Pldcfb53 zm2DVZjMwulgcyUrlgkoIfVSVnolqaWfE1We1P8mk7guvoWifd+1otzRUXghhWu6eQkq O6VFCIwEwe9FS0fwxmAg2F73QY7mMgxTiD9zqItf1ellgexmGsKeXAqxEyx1jZ0yHOwG Z4w+i663b/hCn2reqN3dWZCXO6khUNEdsO0qnOlWAGRUZH6j1pyRFbtulgMByMdfHQoM PHVU8Rlzhj6d5D2gXdArBnS/7aAZBWi/KM6FkuAPutCxVW4tqbLVM6BVw1fg4H8D4YO3 q90A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=VDxzoBipuwgJ9nXmM8IIPQyqkbvF/xMtt7DwxtCT5D8=; b=5iKaP4Z7bfI20ia5UpbGHVq6wu1qVk9FshKtRNBqxsQzqf/vN37xnu2a2mtubCAfmE /ifuv6u4V8gJ4SiII6ZCC35AuQeSES180EDZpJMElY/xklH/K8RqxQOvaUFb3kBK7yI3 adkMtGOz5U4XxH6s4R0h8SlWfU55RKk14nFug+frZ1uWpdAdAlNh9OB22yyaRfn+ILSk 2EuWJCSXmP6G86wAVOBNWGUhbdWo2uJElRuszqLQEF57NSDa9OqJlWP/2IpgZnKhDn+y TMhec1m+JyPRsKGNN5VbtbXuSlTDyzY0QNeeDKPj3asd0NO3aGMUMH0N8u+7tC7+yfnO rQ9Q== X-Gm-Message-State: AFqh2kpwrzAs7kJCKDXIPtuNCRUVCwbKCqfqoKuvsn4D1QwEw3Bm3vx1 YUpMN5VIZpOzy7lJGLksgMM= X-Received: by 2002:a05:600c:1c90:b0:3cf:75a8:ecf4 with SMTP id k16-20020a05600c1c9000b003cf75a8ecf4mr25553418wms.24.1672508530472; Sat, 31 Dec 2022 09:42:10 -0800 (PST) Received: from localhost.localdomain (host-79-56-217-20.retail.telecomitalia.it. [79.56.217.20]) by smtp.gmail.com with ESMTPSA id bi14-20020a05600c3d8e00b003d9ad6783b1sm2032817wmb.6.2022.12.31.09.42.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 31 Dec 2022 09:42:09 -0800 (PST) From: "Fabio M. De Francesco" To: Jan Kara , linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: "Fabio M. De Francesco" , Ira Weiny Subject: [PATCH] fs/ext2: Replace kmap_atomic() with kmap_local_page() Date: Sat, 31 Dec 2022 18:42:05 +0100 Message-Id: <20221231174205.8492-1-fmdefrancesco@gmail.com> X-Mailer: git-send-email 2.39.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 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-ext4@vger.kernel.org kmap_atomic() is deprecated in favor of kmap_local_page(). Therefore, replace kmap_atomic() with kmap_local_page(). kmap_atomic() is implemented like a kmap_local_page() which also disables page-faults and preemption (the latter only for !PREEMPT_RT kernels). However, the code within the mapping and un-mapping in ext2_make_empty() does not depend on the above-mentioned side effects. Therefore, a mere replacement of the old API with the new one is all it is required (i.e., there is no need to explicitly add any calls to pagefault_disable() and/or preempt_disable()). Suggested-by: Ira Weiny Signed-off-by: Fabio M. De Francesco --- I tried my best to understand the code within mapping and un-mapping. However, I'm not an expert. Therefore, although I'm pretty confident, I cannot be 100% sure that the code between the mapping and the un-mapping does not depend on pagefault_disable() and/or preempt_disable(). Unfortunately, I cannot currently test this changes to check the above-mentioned assumptions. However, if I'm required to do the tests with (x)fstests, I have no problems with doing them in the next days. If so, I'll test in a QEMU/KVM x86_32 VM, 6GB RAM, booting a kernel with HIGHMEM64GB enabled. I'd like to hear whether or not the maintainers require these tests and/or other tests. fs/ext2/dir.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/ext2/dir.c b/fs/ext2/dir.c index e5cbc27ba459..0f144c5c7861 100644 --- a/fs/ext2/dir.c +++ b/fs/ext2/dir.c @@ -646,7 +646,7 @@ int ext2_make_empty(struct inode *inode, struct inode *parent) unlock_page(page); goto fail; } - kaddr = kmap_atomic(page); + kaddr = kmap_local_page(page); memset(kaddr, 0, chunk_size); de = (struct ext2_dir_entry_2 *)kaddr; de->name_len = 1; @@ -661,7 +661,7 @@ int ext2_make_empty(struct inode *inode, struct inode *parent) de->inode = cpu_to_le32(parent->i_ino); memcpy (de->name, "..\0", 4); ext2_set_de_type (de, inode); - kunmap_atomic(kaddr); + kunmap_local(kaddr); ext2_commit_chunk(page, 0, chunk_size); err = ext2_handle_dirsync(inode); fail: -- 2.39.0