Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5928353rdb; Thu, 14 Dec 2023 04:00:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IE4qxSOmwBEwhljzrn/WBIVot4Jvf+tnSLFyg+mbFkD0uLKxHMfNT34w5ztzsviKp2bBpQ7 X-Received: by 2002:a05:6a00:4b05:b0:6cd:8a19:c324 with SMTP id kq5-20020a056a004b0500b006cd8a19c324mr10894066pfb.3.1702555212023; Thu, 14 Dec 2023 04:00:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702555211; cv=none; d=google.com; s=arc-20160816; b=Rt4cgKn0TIAlngF9Wtzb2Tb41MNmynxLbQwgXIBbXP//9IBsTcZwysi6O73x4sJ/zQ VXUBcOhyxeGKABbXjHYJ86IJ1j2R/9BQ/bXTinbjNrV84aStYn486S0psqwCGxkW5WwD u8tR9LvJi7Ubs0Wyu9xQvvfQSjdsUwsyWGV3g4+HWyVv8DaUhUZw8b7a5wVLj1/RLzvI aJ9ZNu9GOEm0IPgh6SueeOTg8lSKp0cpBwqlC/KvNtflzo9OW4o0HwYLf0I8pIPtvu8b 7YvnIRGaqVzEHsaWeQ93Bd/rxG4Jct9hAkMDj/x5Dhqmon/eSB+e3d0nMOPoeCvzGvvM rT+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:organization:message-id:date:subject:cc:to :from:dkim-signature; bh=9n4kM+2kOphHMFDNDP5TLYtjnOxPyOkV1S4457ZVhto=; fh=iwE0voEkQAMZ9/PoLrjkOq/H+1Kiqw8iHnUIvakgQPs=; b=SFmTCD+0BJnIQsJmNqLZKGTTz5eIqXGqWY8rGtgtfirMN6ToR6WxZSO1ozkprxdBMh Rf8xlluZjx3T9D+fKoEt6HWW28PJmTxiRgwy6w3WZSn+OIUOnT10X62fADh70c8LveNP IRwf0ndDUDg2br99MPMDMFcPnb5UKajplm8mg12jytzoTyZRZMgENOY5YUOvuW1rvHAs U6EFSl9PS7/wra61mhgnqB0kTuqp/egNObPkIno2LTmLCKpcbqWEGmi5Jsxho+YFXCJA oUVP1oRH2g3gw7sSd8s3EAqFs3oqCYQgfygiLa0PrTCymLUHux1x5QBZWbmMtuc3AlPK Emtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=DvqSNF9Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id x1-20020a056a00188100b006cb63513372si11463996pfh.12.2023.12.14.04.00.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 04:00:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=DvqSNF9Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 64DC180267F9; Thu, 14 Dec 2023 03:58:39 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1572888AbjLNL62 (ORCPT + 99 others); Thu, 14 Dec 2023 06:58:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1444245AbjLNL6X (ORCPT ); Thu, 14 Dec 2023 06:58:23 -0500 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F863126; Thu, 14 Dec 2023 03:58:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1702555109; x=1734091109; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=cV5kj31cFE9+FQFlEfWw+Csb+q1VhY9EQYtyWEoQyM8=; b=DvqSNF9ZV+DA3WB8sFcwY2O2wlZsdMYYnrUrMEMTIxyvZhG59Jgx14y8 kVcdsYdCmOpy3W49qLH9WAJBAhSiS9QyKgM/L8wZQEow3Bhp9DPTGvQcz 6x1V0H6V9nFSiZBORhhmUNERxqNzaNM2AxVlGHyAgAiX/3eTWe5aI2nmc v6abeO0JAIRd6LLVDQnigvrcU/tvOvkhH15/69qbLAOcE6Fq2qqXnRkW7 2QkLmKn5PCkWUxd2YLdyDOW7k1iWAnsfHdz9dpbNdSMadTcmKY5YXsfB3 hf80uFjasUPA6MQS/LDCCoGNAAflOuyUhoNvEDOkWP5lTTf4HPhXYVj6o w==; X-IronPort-AV: E=McAfee;i="6600,9927,10923"; a="461573436" X-IronPort-AV: E=Sophos;i="6.04,275,1695711600"; d="scan'208";a="461573436" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Dec 2023 03:58:28 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.04,275,1695711600"; d="scan'208";a="17715249" Received: from fdefranc-mobl3.ger.corp.intel.com (HELO fdefranc-mobl3.localnet) ([10.213.7.207]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Dec 2023 03:58:27 -0800 From: "Fabio M. De Francesco" To: linux-fsdevel@vger.kernel.org, Al Viro Cc: linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/4] minixfs: change the signature of dir_get_page() Date: Thu, 14 Dec 2023 12:58:24 +0100 Message-ID: <4222956.ElGaqSPkdT@fdefranc-mobl3> Organization: intel In-Reply-To: <20231213000849.2748576-2-viro@zeniv.linux.org.uk> References: <20231213000656.GI1674809@ZenIV> <20231213000849.2748576-1-viro@zeniv.linux.org.uk> <20231213000849.2748576-2-viro@zeniv.linux.org.uk> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 14 Dec 2023 03:58:39 -0800 (PST) On Wednesday, 13 December 2023 01:08:47 CET Al Viro wrote: > Change the signature of dir_get_page() in order to prepare this function > to the conversion to the use of kmap_local_page(). Change also those call > sites which are required to adjust to the new signature. > > Essentially a copy of the corresponding fs/sysv commit by > Fabio M. De Francesco > > Signed-off-by: Al Viro > --- > fs/minix/dir.c | 46 ++++++++++++++++++++-------------------------- > 1 file changed, 20 insertions(+), 26 deletions(-) Reviewed-by: Fabio M. De Francesco > diff --git a/fs/minix/dir.c b/fs/minix/dir.c > index 34a5d17f0796..4e5483adea40 100644 > --- a/fs/minix/dir.c > +++ b/fs/minix/dir.c > @@ -70,13 +70,15 @@ static int minix_handle_dirsync(struct inode *dir) > return err; > } > > -static struct page * dir_get_page(struct inode *dir, unsigned long n) > +static void *dir_get_page(struct inode *dir, unsigned long n, struct page > **p) { > struct address_space *mapping = dir->i_mapping; > struct page *page = read_mapping_page(mapping, n, NULL); > - if (!IS_ERR(page)) > - kmap(page); > - return page; > + if (IS_ERR(page)) > + return ERR_CAST(page); > + kmap(page); > + *p = page; > + return page_address(page); > } > > static inline void *minix_next_entry(void *de, struct minix_sb_info *sbi) > @@ -104,11 +106,11 @@ static int minix_readdir(struct file *file, struct > dir_context *ctx) > > for ( ; n < npages; n++, offset = 0) { > char *p, *kaddr, *limit; > - struct page *page = dir_get_page(inode, n); > + struct page *page; > > - if (IS_ERR(page)) > + kaddr = dir_get_page(inode, n, &page); > + if (IS_ERR(kaddr)) > continue; > - kaddr = (char *)page_address(page); > p = kaddr+offset; > limit = kaddr + minix_last_byte(inode, n) - chunk_size; > for ( ; p <= limit; p = minix_next_entry(p, sbi)) { > @@ -173,11 +175,10 @@ minix_dirent *minix_find_entry(struct dentry *dentry, > struct page **res_page) for (n = 0; n < npages; n++) { > char *kaddr, *limit; > > - page = dir_get_page(dir, n); > - if (IS_ERR(page)) > + kaddr = dir_get_page(dir, n, &page); > + if (IS_ERR(kaddr)) > continue; > > - kaddr = (char*)page_address(page); > limit = kaddr + minix_last_byte(dir, n) - sbi->s_dirsize; > for (p = kaddr; p <= limit; p = minix_next_entry(p, sbi)) { > if (sbi->s_version == MINIX_V3) { > @@ -229,12 +230,10 @@ int minix_add_link(struct dentry *dentry, struct inode > *inode) for (n = 0; n <= npages; n++) { > char *limit, *dir_end; > > - page = dir_get_page(dir, n); > - err = PTR_ERR(page); > - if (IS_ERR(page)) > - goto out; > + kaddr = dir_get_page(dir, n, &page); > + if (IS_ERR(kaddr)) > + return PTR_ERR(kaddr); > lock_page(page); > - kaddr = (char*)page_address(page); > dir_end = kaddr + minix_last_byte(dir, n); > limit = kaddr + PAGE_SIZE - sbi->s_dirsize; > for (p = kaddr; p <= limit; p = minix_next_entry(p, sbi)) { > @@ -286,7 +285,6 @@ int minix_add_link(struct dentry *dentry, struct inode > *inode) err = minix_handle_dirsync(dir); > out_put: > dir_put_page(page); > -out: > return err; > out_unlock: > unlock_page(page); > @@ -375,11 +373,10 @@ int minix_empty_dir(struct inode * inode) > for (i = 0; i < npages; i++) { > char *p, *kaddr, *limit; > > - page = dir_get_page(inode, i); > - if (IS_ERR(page)) > + kaddr = dir_get_page(inode, i, &page); > + if (IS_ERR(kaddr)) > continue; > > - kaddr = (char *)page_address(page); > limit = kaddr + minix_last_byte(inode, i) - sbi->s_dirsize; > for (p = kaddr; p <= limit; p = minix_next_entry(p, sbi)) { > if (sbi->s_version == MINIX_V3) { > @@ -441,15 +438,12 @@ int minix_set_link(struct minix_dir_entry *de, struct > page *page, > > struct minix_dir_entry * minix_dotdot (struct inode *dir, struct page **p) > { > - struct page *page = dir_get_page(dir, 0); > struct minix_sb_info *sbi = minix_sb(dir->i_sb); > - struct minix_dir_entry *de = NULL; > + struct minix_dir_entry *de = dir_get_page(dir, 0, p); > > - if (!IS_ERR(page)) { > - de = minix_next_entry(page_address(page), sbi); > - *p = page; > - } > - return de; > + if (!IS_ERR(de)) > + return minix_next_entry(de, sbi); > + return NULL; > } > > ino_t minix_inode_by_name(struct dentry *dentry)