Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4997621rdb; Tue, 12 Dec 2023 16:09:41 -0800 (PST) X-Google-Smtp-Source: AGHT+IEl/Dr6KioTQynUbBIPqzZqMLWPhAdzTQLW4V18ISrHkFJEsU15Q8aNlwqSTbYA4x/G98Fs X-Received: by 2002:a17:90a:c87:b0:28a:d7cd:50e with SMTP id v7-20020a17090a0c8700b0028ad7cd050emr967179pja.36.1702426181137; Tue, 12 Dec 2023 16:09:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702426181; cv=none; d=google.com; s=arc-20160816; b=SGEpqk10K5LbP1TW6tvathm7Jz51U93Ppf24TWbN4YLwXi0x4Vo1zpWGDreqd+GLJo mcBEFU81AZNuk+1YEXjcz2JKt/oJ/txg2Hj/vnAu+HSMmiUjMpH2E8oJcMAOxTWQ0vIH J0T6p3yDeI+0dS4LnoMqmC0a2DLTlsD5gisFBJ/jopqxuRy5YpmSfnx/w3cPvWYt0RV/ YfvkhJUKVg75Qn2qFb1BMI631wbFnvX1RB4mB9Eky2EwiOdD3cSF1FUba4JwKHwersr3 kpv3omrzvYeKuhegwk2SpNjGiwrU5btw2mkruazbvcRpBtmA+7uMjiUjH58vzC4DYpJ3 6IHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=FR4Bu1shg/1OWRZtkrUGIBB3IegyXrsoJGzrPQwNckk=; fh=PB/Cqfd7rEHjS8PKwY8H201+W6h7CwWuELHDErE1bVA=; b=Sm6hL3sg1OOTjeBMWlWUxIRTboKgvLfgUzZ49mxn4EYOlnaJoXubsPVYB80mx//TjY ZCQr5pt6n/Fsw8mKGIOVDxzT9b1qGi8kRUIvdQ/5JIUIoOqLd9AabPkGSC9KL0hhpAvD 3yPfB6RFi2ta1zIbQ79hTT7Y0zLrMRAtVJ5GZu1lbLLve8GdMH1oMYARMBLEBP3hxjI/ 0rUXb13EJNLhY52QcF2iI8gCwSt52GNM38CefBEI2rQqvx43BUiEpx76RPQipRi8S8FJ /7aAUyiNFZgg7DaShPrDVao5zseGyOcw4v9KzEqZUpXRKx0rC6F5Tu4lm1OiO1++3VeZ EWeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=ssFYiY+C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zeniv.linux.org.uk Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id pt3-20020a17090b3d0300b0028656396773si8896827pjb.109.2023.12.12.16.09.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 16:09:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=ssFYiY+C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zeniv.linux.org.uk Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id DC41681DAAD2; Tue, 12 Dec 2023 16:09:38 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377735AbjLMAJM (ORCPT + 99 others); Tue, 12 Dec 2023 19:09:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377932AbjLMAI5 (ORCPT ); Tue, 12 Dec 2023 19:08:57 -0500 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [IPv6:2a03:a000:7:0:5054:ff:fe1c:15ff]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6BB6D69; Tue, 12 Dec 2023 16:08:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=FR4Bu1shg/1OWRZtkrUGIBB3IegyXrsoJGzrPQwNckk=; b=ssFYiY+Cz+KBWgVJ8B4d/3gkXn kdaPXjvqWiMyWeNeW415BxuXaOWZr/rvcir6rjSIoi3+3+lILgmATZ+W4bxcDxpbUJecBraaiNNjy hs6OMshEfgHBMffYJg9yaunRID73USie1VzRAZWF6e58h9C+/gJyZTrKVFAW6ty9obhyjJHYaTTBr 5lx++i3OL+RVyNGUqQRkgB0MXkurp+x0zQ5+apPumm5oVu1FBjZW6eUBbM3V9ODiWQF7pE9pH4R2K yYFjgvhyQJ9puJPYM1270dYvEnmZQoEaYZHvcjmbcjR5lvDvT2xZxSMzV7WaL80TaY/EFwqpfuIUE Ar8BllQw==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1rDCny-00BX1z-04; Wed, 13 Dec 2023 00:08:50 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH 1/4] minixfs: use offset_in_page() Date: Wed, 13 Dec 2023 00:08:46 +0000 Message-Id: <20231213000849.2748576-1-viro@zeniv.linux.org.uk> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231213000656.GI1674809@ZenIV> References: <20231213000656.GI1674809@ZenIV> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: Al Viro X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Tue, 12 Dec 2023 16:09:39 -0800 (PST) It's cheaper and more idiomatic than subtracting page_address() of the corresponding page... Signed-off-by: Al Viro --- fs/minix/dir.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/fs/minix/dir.c b/fs/minix/dir.c index 62c313fc9a49..34a5d17f0796 100644 --- a/fs/minix/dir.c +++ b/fs/minix/dir.c @@ -268,7 +268,7 @@ int minix_add_link(struct dentry *dentry, struct inode *inode) return -EINVAL; got_it: - pos = page_offset(page) + p - (char *)page_address(page); + pos = page_offset(page) + offset_in_page(p); err = minix_prepare_chunk(page, pos, sbi->s_dirsize); if (err) goto out_unlock; @@ -296,8 +296,7 @@ int minix_add_link(struct dentry *dentry, struct inode *inode) int minix_delete_entry(struct minix_dir_entry *de, struct page *page) { struct inode *inode = page->mapping->host; - char *kaddr = page_address(page); - loff_t pos = page_offset(page) + (char*)de - kaddr; + loff_t pos = page_offset(page) + offset_in_page(de); struct minix_sb_info *sbi = minix_sb(inode->i_sb); unsigned len = sbi->s_dirsize; int err; @@ -421,8 +420,7 @@ int minix_set_link(struct minix_dir_entry *de, struct page *page, { struct inode *dir = page->mapping->host; struct minix_sb_info *sbi = minix_sb(dir->i_sb); - loff_t pos = page_offset(page) + - (char *)de-(char*)page_address(page); + loff_t pos = page_offset(page) + offset_in_page(de); int err; lock_page(page); -- 2.39.2