From patchwork Wed Jul 10 15:59:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13729456 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C48B7194A75 for ; Wed, 10 Jul 2024 15:59:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720627195; cv=none; b=cGEWjoOqLd87kUSn5n3wG/gaeeXIs0yh1NHya3MRuCzvjSq6+eb4gKInhu6B2rn+wnaeQufLjZgji8ZWo0eWL2ngC07R9A0nwoctZOrjDY7hyW0ulTApLItTB2/31AVrqOGnyGe0ZTH1mirqwMhrhPStNEXuhI9DbpXuekkqKkQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720627195; c=relaxed/simple; bh=NwSQICa1R9gQErI5BlhFLBPL74tfPi3q2ENWUkW+DfU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=irR4hI5n5IQssk1VfDWrncDYvH1SNYUsQkLyU5L9GSWmNEwMlbjFFnI5hliVslmJqoLp5gDb4lz8pYdg6fhv8uqwccfoq6IYtZ2pKKRGS6vPOU0tgpeY6++p7qexIxAbyYLZGpUDuUVTK0GkMFpNunzHfXVmiSAX9a69+jYsarY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=qqZayFtK; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="qqZayFtK" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=XPQxuGOLvFCS3aW88WOTa6/iWEt7uMVm/luhDslViZs=; b=qqZayFtKbVYeq+MJ0pZNs2FVin MaioPvrPIkORP0KZCNdVzfj6rg+8o4psS8LxA/95rxeniA+NZqc8vrLkYB2C4DvmL6ylNe+sdTQpJ sTSTJLJrKVYUsmQsqHrfCwY6c5KwDIFShfM4AnpQh4SGgrlC0VJfsrvC+bPbKvRIN2LsuZrCUAIZg Ye0SGQ/JJO5tA1v0y3gb6HouOAUo4qpbVPBkEJZdV4XqsMBy69e05ps200348s8eLr2R9OA+JxyWu FUTqu3mNYEs0JPDiJMFFA0/w09GL6HOLUTXmRs13pbf9RgQaEfoH4fvl3PRjHBXkTBJcD0XB2JLc4 SkGAFumA==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRZjQ-00000009TEG-3wke; Wed, 10 Jul 2024 15:59:48 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , Al Viro Subject: [PATCH 1/6] qnx6: Convert qnx6_get_page() to qnx6_get_folio() Date: Wed, 10 Jul 2024 16:59:39 +0100 Message-ID: <20240710155946.2257293-2-willy@infradead.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240710155946.2257293-1-willy@infradead.org> References: <20240710155946.2257293-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Match the ext2 calling convention by returning the address and setting the folio return pointer. Signed-off-by: Matthew Wilcox (Oracle) --- fs/qnx6/dir.c | 46 ++++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/fs/qnx6/dir.c b/fs/qnx6/dir.c index c1cfb8a19e9d..bc7f20dda579 100644 --- a/fs/qnx6/dir.c +++ b/fs/qnx6/dir.c @@ -24,13 +24,15 @@ static unsigned qnx6_lfile_checksum(char *name, unsigned size) return crc; } -static struct page *qnx6_get_page(struct inode *dir, unsigned long n) +static void *qnx6_get_folio(struct inode *dir, unsigned long n, + struct folio **foliop) { - struct address_space *mapping = dir->i_mapping; - struct page *page = read_mapping_page(mapping, n, NULL); - if (!IS_ERR(page)) - kmap(page); - return page; + struct folio *folio = read_mapping_folio(dir->i_mapping, n, NULL); + + if (IS_ERR(folio)) + return folio; + *foliop = folio; + return kmap(&folio->page); } static unsigned last_entry(struct inode *inode, unsigned long page_nr) @@ -117,26 +119,27 @@ static int qnx6_readdir(struct file *file, struct dir_context *ctx) loff_t pos = ctx->pos & ~(QNX6_DIR_ENTRY_SIZE - 1); unsigned long npages = dir_pages(inode); unsigned long n = pos >> PAGE_SHIFT; - unsigned start = (pos & ~PAGE_MASK) / QNX6_DIR_ENTRY_SIZE; + unsigned offset = (pos & ~PAGE_MASK) / QNX6_DIR_ENTRY_SIZE; bool done = false; ctx->pos = pos; if (ctx->pos >= inode->i_size) return 0; - for ( ; !done && n < npages; n++, start = 0) { - struct page *page = qnx6_get_page(inode, n); - int limit = last_entry(inode, n); + for ( ; !done && n < npages; n++, offset = 0) { struct qnx6_dir_entry *de; - int i = start; + struct folio *folio; + char *kaddr = qnx6_get_folio(inode, n, &folio); + char *limit; - if (IS_ERR(page)) { + if (IS_ERR(kaddr)) { pr_err("%s(): read failed\n", __func__); ctx->pos = (n + 1) << PAGE_SHIFT; - return PTR_ERR(page); + return PTR_ERR(kaddr); } - de = ((struct qnx6_dir_entry *)page_address(page)) + start; - for (; i < limit; i++, de++, ctx->pos += QNX6_DIR_ENTRY_SIZE) { + de = (struct qnx6_dir_entry *)(kaddr + offset); + limit = kaddr + last_entry(inode, n); + for (; (char *)de < limit; de++, ctx->pos += QNX6_DIR_ENTRY_SIZE) { int size = de->de_size; u32 no_inode = fs32_to_cpu(sbi, de->de_inode); @@ -164,7 +167,7 @@ static int qnx6_readdir(struct file *file, struct dir_context *ctx) } } } - qnx6_put_page(page); + qnx6_put_page(&folio->page); } return 0; } @@ -215,7 +218,7 @@ unsigned qnx6_find_entry(int len, struct inode *dir, const char *name, { struct super_block *s = dir->i_sb; struct qnx6_inode_info *ei = QNX6_I(dir); - struct page *page = NULL; + struct folio *folio; unsigned long start, n; unsigned long npages = dir_pages(dir); unsigned ino; @@ -232,12 +235,11 @@ unsigned qnx6_find_entry(int len, struct inode *dir, const char *name, n = start; do { - page = qnx6_get_page(dir, n); - if (!IS_ERR(page)) { + de = qnx6_get_folio(dir, n, &folio); + if (!IS_ERR(de)) { int limit = last_entry(dir, n); int i; - de = (struct qnx6_dir_entry *)page_address(page); for (i = 0; i < limit; i++, de++) { if (len <= QNX6_SHORT_NAME_MAX) { /* short filename */ @@ -256,7 +258,7 @@ unsigned qnx6_find_entry(int len, struct inode *dir, const char *name, } else pr_err("undefined filename size in inode.\n"); } - qnx6_put_page(page); + qnx6_put_page(&folio->page); } if (++n >= npages) @@ -265,7 +267,7 @@ unsigned qnx6_find_entry(int len, struct inode *dir, const char *name, return 0; found: - *res_page = page; + *res_page = &folio->page; ei->i_dir_start_lookup = n; return ino; } From patchwork Wed Jul 10 15:59:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13729455 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BFF3E194A66 for ; Wed, 10 Jul 2024 15:59:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720627193; cv=none; b=BirY//anw+k5q9qq0EIKZKE0akqtrRfjJOaxzy3Kqfl6RGlCraOfo7Os7G0XluUXlWZ1f/E18sdMlt71prE0CYJuV7SUHRtGTAfxAKHYQIDRMZZ8mq6GBgy9X0BcsQihuAbpFGprhbxiWMSeZjPljrgEKK3clzUwumJdYrrRACs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720627193; c=relaxed/simple; bh=bIJ59Q4C+RZ4+f+Ky1h8dFOf5LIJv1oyoHIs6aHvns4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=aNfAzrxlt179FXZBfpaWtvVIBMfaSnbJC7Zsgq85WqQaE9QjrD4i2Jou03VZNG7DPQ6Lpjh7Tmg+eem8XphL/vl8TfnBXRmyWW0tlOtbEm/FUqz80vtljhA4zom7fF3okuyLbaGlxYdEJgsiMa1VCCfOQ3bhs7er/PCvAaSXt9U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=eQkzNVQi; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="eQkzNVQi" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=BvhFm88QHu07JEI7BlrmNTQ9jUnrWSMTnHSYhmtwjQ8=; b=eQkzNVQioOBPOvZZqRQ3f478fd 2ZvHTiYCcQDyPF/Y5Yuis0Z3BhuQkgYIfPbhv9UKpYb2mwaDt9fZNBMU3rKSW2DydRHoj3uZKcn8c EtpFwHOBdvhtH1t7i1qWvZh7jBfI6HhFtAewv50+Bx7WDbKlSnbtXiqT6g7lnMyygMQj0WTD01E+Z 4gIFc9VC2iHwt19yi44HyU1lVGKdWeGvbM9ZZ4DdE4GyhnoRzpuZQ/SSGbuBgrVMz37XFRbQx/Qcx iJoKHa2Kcx3ukT4hzfZv6onzpmwaA+NyHRx9cY2j0GyFk35eRo6rgMA3ouSV20gyHMWLbGDLenqVx SVPl7q/g==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRZjR-00000009TEJ-083f; Wed, 10 Jul 2024 15:59:49 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , Al Viro Subject: [PATCH 2/6] qnx6: Convert qnx6_find_entry() to qnx6_find_ino() Date: Wed, 10 Jul 2024 16:59:40 +0100 Message-ID: <20240710155946.2257293-3-willy@infradead.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240710155946.2257293-1-willy@infradead.org> References: <20240710155946.2257293-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 It's hard to return a directory entry from qnx6_find_entry() because it might be a long dir_entry with a different format. So stick with the convention of returning an inode number, but rename it to qnx6_find_ino() to reflect what it actually does, and move the call to qnx6_put_page() inside the function which lets us get rid of the res_page parameter. Signed-off-by: Matthew Wilcox (Oracle) --- fs/qnx6/dir.c | 7 ++----- fs/qnx6/namei.c | 4 +--- fs/qnx6/qnx6.h | 3 +-- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/fs/qnx6/dir.c b/fs/qnx6/dir.c index bc7f20dda579..daf9a335ba22 100644 --- a/fs/qnx6/dir.c +++ b/fs/qnx6/dir.c @@ -213,8 +213,7 @@ static unsigned qnx6_match(struct super_block *s, int len, const char *name, } -unsigned qnx6_find_entry(int len, struct inode *dir, const char *name, - struct page **res_page) +unsigned qnx6_find_ino(int len, struct inode *dir, const char *name) { struct super_block *s = dir->i_sb; struct qnx6_inode_info *ei = QNX6_I(dir); @@ -225,8 +224,6 @@ unsigned qnx6_find_entry(int len, struct inode *dir, const char *name, struct qnx6_dir_entry *de; struct qnx6_long_dir_entry *lde; - *res_page = NULL; - if (npages == 0) return 0; start = ei->i_dir_start_lookup; @@ -267,8 +264,8 @@ unsigned qnx6_find_entry(int len, struct inode *dir, const char *name, return 0; found: - *res_page = &folio->page; ei->i_dir_start_lookup = n; + qnx6_put_page(&folio->page); return ino; } diff --git a/fs/qnx6/namei.c b/fs/qnx6/namei.c index e2e98e653b8d..0f0755a9ecb5 100644 --- a/fs/qnx6/namei.c +++ b/fs/qnx6/namei.c @@ -17,7 +17,6 @@ struct dentry *qnx6_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags) { unsigned ino; - struct page *page; struct inode *foundinode = NULL; const char *name = dentry->d_name.name; int len = dentry->d_name.len; @@ -25,10 +24,9 @@ struct dentry *qnx6_lookup(struct inode *dir, struct dentry *dentry, if (len > QNX6_LONG_NAME_MAX) return ERR_PTR(-ENAMETOOLONG); - ino = qnx6_find_entry(len, dir, name, &page); + ino = qnx6_find_ino(len, dir, name); if (ino) { foundinode = qnx6_iget(dir->i_sb, ino); - qnx6_put_page(page); if (IS_ERR(foundinode)) pr_debug("lookup->iget -> error %ld\n", PTR_ERR(foundinode)); diff --git a/fs/qnx6/qnx6.h b/fs/qnx6/qnx6.h index 34a6b126a3a9..43da5f91c3ff 100644 --- a/fs/qnx6/qnx6.h +++ b/fs/qnx6/qnx6.h @@ -132,5 +132,4 @@ static inline void qnx6_put_page(struct page *page) put_page(page); } -extern unsigned qnx6_find_entry(int len, struct inode *dir, const char *name, - struct page **res_page); +unsigned qnx6_find_ino(int len, struct inode *dir, const char *name); From patchwork Wed Jul 10 15:59:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13729454 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BFF99194A68 for ; Wed, 10 Jul 2024 15:59:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720627193; cv=none; b=Lhz8nXeiOqQAJ5POdfjGFB4HvICvpBSANwsuAWp3fZ3KQKaAtSdgy7V2Pl4595BBjizDzskEDQWumQ5IcjBBrVMKM+5qLcH2wOfnJRESOldGopzL8TsodAX/6v3ngKUyRXUjOfr/4xGwcEQyXLKAUgeTxm9T50XYepmpWA9ooyg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720627193; c=relaxed/simple; bh=oaJnMNnOr6wsn9R96CPUpJZpneobj8WjtenNHWqobgE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ALLc2s9OT9B8zOxw0NCxWYUWYeN2yv1Ed3Ab1ihSMNY4b/in4ZvR88PuUWkQTA4+P/ADSMUg2hCTdXdJz8GbywNCDRfz8peqxNmEEjzk7F3H5A882sc9NzSFiXQNvkANjDSkkF3Nl3OYxdwtle8FmZiE/3gTONJxhz1wk85OZbs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=gmzMK5JO; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="gmzMK5JO" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=gbFge8k7xQLezmU1IbmhkccbHir+6ZsrSbpp01H5LV8=; b=gmzMK5JOUgPV3Kg2OqOhE75u99 FrYfX1MsIj0f+uTKBWHATzlngoCAcpp4KoI0ymBfrmNWwriUOxyKkNXFZC32THtUdve1mIZToojuT 5uuGscv+UhWQhiMVFkKHMBc812v1poqMnBjw570j5yhdUBX00QXuOEe0Ycl8cU+zjqpv6itUE+m2I EdZEHCKVO9gA4RO+47/W1ivHZHsXdEzEAuvAxU4HjD5Z2fYn5MWUxxxNEllYUcHfKsjACHvBSDrzh xGXmocONLfPxBD5i6gNGnpl5LqfM3BsgCWSa/cGkiJbqsMiK2G7irUYrNIa5I+yOTemjLRxXlBJGl OFI5j8ng==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRZjR-00000009TEP-0Ysb; Wed, 10 Jul 2024 15:59:49 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , Al Viro Subject: [PATCH 3/6] qnx6: Convert qnx6_longname() to take a folio Date: Wed, 10 Jul 2024 16:59:41 +0100 Message-ID: <20240710155946.2257293-4-willy@infradead.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240710155946.2257293-1-willy@infradead.org> References: <20240710155946.2257293-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Removes a conversion from folio to page. Signed-off-by: Matthew Wilcox (Oracle) --- fs/qnx6/dir.c | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/fs/qnx6/dir.c b/fs/qnx6/dir.c index daf9a335ba22..0de2a047a174 100644 --- a/fs/qnx6/dir.c +++ b/fs/qnx6/dir.c @@ -46,19 +46,20 @@ static unsigned last_entry(struct inode *inode, unsigned long page_nr) static struct qnx6_long_filename *qnx6_longname(struct super_block *sb, struct qnx6_long_dir_entry *de, - struct page **p) + struct folio **foliop) { struct qnx6_sb_info *sbi = QNX6_SB(sb); u32 s = fs32_to_cpu(sbi, de->de_long_inode); /* in block units */ u32 n = s >> (PAGE_SHIFT - sb->s_blocksize_bits); /* in pages */ - /* within page */ - u32 offs = (s << sb->s_blocksize_bits) & ~PAGE_MASK; + u32 offs; struct address_space *mapping = sbi->longfile->i_mapping; - struct page *page = read_mapping_page(mapping, n, NULL); - if (IS_ERR(page)) - return ERR_CAST(page); - kmap(*p = page); - return (struct qnx6_long_filename *)(page_address(page) + offs); + struct folio *folio = read_mapping_folio(mapping, n, NULL); + + if (IS_ERR(folio)) + return ERR_CAST(folio); + offs = offset_in_folio(folio, s << sb->s_blocksize_bits); + *foliop = folio; + return kmap(&folio->page) + offs; } static int qnx6_dir_longfilename(struct inode *inode, @@ -69,7 +70,7 @@ static int qnx6_dir_longfilename(struct inode *inode, struct qnx6_long_filename *lf; struct super_block *s = inode->i_sb; struct qnx6_sb_info *sbi = QNX6_SB(s); - struct page *page; + struct folio *folio; int lf_size; if (de->de_size != 0xff) { @@ -78,7 +79,7 @@ static int qnx6_dir_longfilename(struct inode *inode, pr_err("invalid direntry size (%i).\n", de->de_size); return 0; } - lf = qnx6_longname(s, de, &page); + lf = qnx6_longname(s, de, &folio); if (IS_ERR(lf)) { pr_err("Error reading longname\n"); return 0; @@ -89,7 +90,7 @@ static int qnx6_dir_longfilename(struct inode *inode, if (lf_size > QNX6_LONG_NAME_MAX) { pr_debug("file %s\n", lf->lf_fname); pr_err("Filename too long (%i)\n", lf_size); - qnx6_put_page(page); + qnx6_put_page(&folio->page); return 0; } @@ -102,11 +103,11 @@ static int qnx6_dir_longfilename(struct inode *inode, pr_debug("qnx6_readdir:%.*s inode:%u\n", lf_size, lf->lf_fname, de_inode); if (!dir_emit(ctx, lf->lf_fname, lf_size, de_inode, DT_UNKNOWN)) { - qnx6_put_page(page); + qnx6_put_page(&folio->page); return 0; } - qnx6_put_page(page); + qnx6_put_page(&folio->page); /* success */ return 1; } @@ -180,23 +181,23 @@ static unsigned qnx6_long_match(int len, const char *name, { struct super_block *s = dir->i_sb; struct qnx6_sb_info *sbi = QNX6_SB(s); - struct page *page; + struct folio *folio; int thislen; - struct qnx6_long_filename *lf = qnx6_longname(s, de, &page); + struct qnx6_long_filename *lf = qnx6_longname(s, de, &folio); if (IS_ERR(lf)) return 0; thislen = fs16_to_cpu(sbi, lf->lf_size); if (len != thislen) { - qnx6_put_page(page); + qnx6_put_page(&folio->page); return 0; } if (memcmp(name, lf->lf_fname, len) == 0) { - qnx6_put_page(page); + qnx6_put_page(&folio->page); return fs32_to_cpu(sbi, de->de_inode); } - qnx6_put_page(page); + qnx6_put_page(&folio->page); return 0; } From patchwork Wed Jul 10 15:59:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13729451 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BFEF6194A65 for ; Wed, 10 Jul 2024 15:59:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720627192; cv=none; b=F+90jCGrIE5+vGASY7+Azp2oT1R4/MLSQZuVO5awXtin5KrRjL3QwruArC1qiKt4BTDXDoVoFwauv2F8oubIsWrZsYMIR/JXAp+77ZeimMzqB3xeOufeos38ubmVbcfwvZbjWQCdMDM32hL4iK3YCv9exUPQHSxWAIOX/UYrBsU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720627192; c=relaxed/simple; bh=yLKSiht6JtNy7AHKZksYh/3kFxspZHhdNnHY6wgTXis=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QtSCZujkmxHnokVz6WLITqkHoNkJWPLfEj5diqQZGS0gy+yzs21nggmV+RakP4M8pPKkx1HXprglD/EDDCpTmhGtEYYvMmy/q2bpZizw1X7f3ss9U6cr0Z+6BB422+nE3Zq2nTmL/VyIw0YVIc849f2qOqQvO+aHk3c4+y7iOIg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=HN2BCEMt; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="HN2BCEMt" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=k6RnHamUZ6b+LcV0tbmEv9uSxqKfCSEP0g9O0xkGKFI=; b=HN2BCEMt3eUSuUwCy+Z+FvfV+o qZR3nwHo4EKHDERnmNad77If8MkRqEnprx60woll7Y/2zBgB8GIEAWIPr5bYGOkTJY431W5NLtvUr BqGCKeGqjXNwp7YJjjDvSsTnfgeoB4RutQG0zxdY4IrzD+3VoqqznBppruZDCFb8WMCgKivL2chOo 9pJXq1wxLwcJ9IeAiV7kHH40fUA8InkBm47qZ1OIzGkQYKnjbQCa2rg9A8VNbT2TDdibvQSokGGIy 0FIcFR5SsqUTw2eG/GnsKiX4m1z8+qtnGQrVwlP7KbmjoFRY6+9yRlOm5YMNUja2JaOV6q9fltcKt nAZ4k+0Q==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRZjR-00000009TEV-13g9; Wed, 10 Jul 2024 15:59:49 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , Al Viro Subject: [PATCH 4/6] qnx6: Convert qnx6_checkroot() to use a folio Date: Wed, 10 Jul 2024 16:59:42 +0100 Message-ID: <20240710155946.2257293-5-willy@infradead.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240710155946.2257293-1-willy@infradead.org> References: <20240710155946.2257293-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Removes a use of kmap and removes a conversion from folio to page. Signed-off-by: Matthew Wilcox (Oracle) --- fs/qnx6/inode.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fs/qnx6/inode.c b/fs/qnx6/inode.c index 4f1735b882b1..6adee850278e 100644 --- a/fs/qnx6/inode.c +++ b/fs/qnx6/inode.c @@ -184,17 +184,17 @@ static const char *qnx6_checkroot(struct super_block *s) struct qnx6_dir_entry *dir_entry; struct inode *root = d_inode(s->s_root); struct address_space *mapping = root->i_mapping; - struct page *page = read_mapping_page(mapping, 0, NULL); - if (IS_ERR(page)) + struct folio *folio = read_mapping_folio(mapping, 0, NULL); + + if (IS_ERR(folio)) return "error reading root directory"; - kmap(page); - dir_entry = page_address(page); + dir_entry = kmap_local_folio(folio, 0); for (i = 0; i < 2; i++) { /* maximum 3 bytes - due to match_root limitation */ if (strncmp(dir_entry[i].de_fname, match_root[i], 3)) error = 1; } - qnx6_put_page(page); + folio_release_kmap(folio, dir_entry); if (error) return "error reading root directory."; return NULL; From patchwork Wed Jul 10 15:59:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13729452 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 30BA0194A74 for ; Wed, 10 Jul 2024 15:59:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720627192; cv=none; b=ZZs2SfZtlzUunWIbJnOJ8XnpzGfmXGU0gAQ/M6nl5wfB1HpOfnB35fn9MCLgVjfewlfl6pioAn+sU1iMAHvXMfDdnS06tGJWanPLn7jtLBAgsYaUTybmHsAAmmBRM5CD5SmsfVDcy6FHZOB52xH5sBPkTFAqwEUzQTUq3k+vH+Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720627192; c=relaxed/simple; bh=ZNebr72dGtfqAT2j6SI0Wj0vmnAdOESWNt/ppyp9hyo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oHKAgakG2dmaWYlEAYbuqVvQREu0+YlaNhgJLlYoIjZT90Ok9XrcPJMtf230E5ZwcH49lB6lbX4DpWfBEHOWP8gDgqfHY0u+Ho/JBlTHOS3UaejCI9uHVkDxwAspSU7nFqOrcqQQaDeRXcfL0PgTv9gJHHKcd8Dk5taEXwiPHNc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=f46o4KzH; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="f46o4KzH" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=geNJDYizzVe7uczLBIwosTrAFDv3LpwFIoF3VABHvds=; b=f46o4KzH+f/wtZbqsRf3gNDCiT ioDPhDdRN9t9c7dqk6NFH0KZbOTGj8jiWo/Z6BK1MyuAAuOyWQDgQ/pJNMmmgKvKiIATbaMbE45E8 eZsfTwFrMTUybmrKcJuS//ock+NTMwJcDNY5a8Dx0oC5q1glgKQntFKFtHBmYy7Lqm79NFNxFx2R2 riftOtjZissY+D6QYw7Prufs9E/LV6NWVL0oGRt8qcxfIN0fnT0iuU5578Gd4mAleThXMO3ibrtLl +eIX1aOX/V4cUUS9YFb9Nk/xy10OmWqr4Ls3bfkCCB4cKDZrLO9dfl7N6HkrwJCMHRYwDdOy4iqAm zqSe3F3w==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRZjR-00000009TEb-1fBc; Wed, 10 Jul 2024 15:59:49 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , Al Viro Subject: [PATCH 5/6] qnx6: Convert qnx6_iget() to use a folio Date: Wed, 10 Jul 2024 16:59:43 +0100 Message-ID: <20240710155946.2257293-6-willy@infradead.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240710155946.2257293-1-willy@infradead.org> References: <20240710155946.2257293-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Removes a use of kmap() and a couple of conversions between folios and pages. Signed-off-by: Matthew Wilcox (Oracle) --- fs/qnx6/inode.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/fs/qnx6/inode.c b/fs/qnx6/inode.c index 6adee850278e..85925ec0051a 100644 --- a/fs/qnx6/inode.c +++ b/fs/qnx6/inode.c @@ -518,7 +518,7 @@ struct inode *qnx6_iget(struct super_block *sb, unsigned ino) struct inode *inode; struct qnx6_inode_info *ei; struct address_space *mapping; - struct page *page; + struct folio *folio; u32 n, offs; inode = iget_locked(sb, ino); @@ -538,17 +538,16 @@ struct inode *qnx6_iget(struct super_block *sb, unsigned ino) return ERR_PTR(-EIO); } n = (ino - 1) >> (PAGE_SHIFT - QNX6_INODE_SIZE_BITS); - offs = (ino - 1) & (~PAGE_MASK >> QNX6_INODE_SIZE_BITS); mapping = sbi->inodes->i_mapping; - page = read_mapping_page(mapping, n, NULL); - if (IS_ERR(page)) { + folio = read_mapping_folio(mapping, n, NULL); + if (IS_ERR(folio)) { pr_err("major problem: unable to read inode from dev %s\n", sb->s_id); iget_failed(inode); - return ERR_CAST(page); + return ERR_CAST(folio); } - kmap(page); - raw_inode = ((struct qnx6_inode_entry *)page_address(page)) + offs; + offs = offset_in_folio(folio, (ino - 1) << QNX6_INODE_SIZE_BITS); + raw_inode = kmap_local_folio(folio, offs); inode->i_mode = fs16_to_cpu(sbi, raw_inode->di_mode); i_uid_write(inode, (uid_t)fs32_to_cpu(sbi, raw_inode->di_uid)); @@ -578,7 +577,7 @@ struct inode *qnx6_iget(struct super_block *sb, unsigned ino) inode->i_mapping->a_ops = &qnx6_aops; } else init_special_inode(inode, inode->i_mode, 0); - qnx6_put_page(page); + folio_release_kmap(folio, raw_inode); unlock_new_inode(inode); return inode; } From patchwork Wed Jul 10 15:59:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13729453 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 30BF5194A75 for ; Wed, 10 Jul 2024 15:59:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720627192; cv=none; b=aQh9AM6Ly5xb7dmFtp+lgPQ2n0xGazd2fv9YcU8Qt8J0C/FC2AWxfU2yiwAbwt7BZgTX9GD9IV3dtvMAAOkD1T4qlVSPv5P45IUf3NMngypWB7r7dhV7ml2sZ0FgDjwtvxG9g/rGbqh0K9KXKM3Wdjg2dmzFj1yQL2VIuerF6Dk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720627192; c=relaxed/simple; bh=yqHUA7x1s5s3NCkgK/Q3LA12WJVRfQ2M8gjJKI7jnOg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Y5mZs6r6a8aUhgFh29Ma6erS0Qd2CmT/z0ScDee8UounePcvTEMT/jrOrm+7yc9qIvnI6v5w7BS14mczoxivBBxaBVKsOwUe5Wsiz00PgFsMuo+KRzd+yZjCh+zQ9NhEQiIOuCYP6QW5Ae97OOERwIvOPS4GYAxv8ULMMkJIIn8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=NSDrukkx; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="NSDrukkx" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=hvtquNoO+hu0AK2h/7B1xiPH1/JJ0I6seWn5T073mDY=; b=NSDrukkxYdDUgwOrQ8dr4EbULj VOron2Qkm3EnYJLj4qUZHTfdnOXkNMtoj/MfDOtILEFfnFCSOg+RlRPeprcPxo9copjDDskjXAUMx 8FljgPpNKq+dAwhp+x2Il+YIlyXo/nrqlHJ8ZQfedBwUvidQugtFYb7ZTo3vKcEHnDfUtKjYSkND+ CYE9aXvt4f2FEazW1LII9c1i1WQhV0QsZy7dbGgfNneJXGzbKl1mhyAzjZWx2edbD79b+fAcdoHsW TgoXzTX12UBCujTo4U9nkcwcLF7oSKYZYpAue228hGHj/Vq75XXF4BNS90rqBsoN87//zxESQhdiM TUVlLkyw==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRZjR-00000009TEh-2Fz9; Wed, 10 Jul 2024 15:59:49 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , Al Viro Subject: [PATCH 6/6] qnx6: Convert directory handling to use kmap_local Date: Wed, 10 Jul 2024 16:59:44 +0100 Message-ID: <20240710155946.2257293-7-willy@infradead.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240710155946.2257293-1-willy@infradead.org> References: <20240710155946.2257293-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Eliminates qnx6_put_page() and a few hidden calls to compound_head(). --- fs/qnx6/dir.c | 22 +++++++++++----------- fs/qnx6/qnx6.h | 6 ------ 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/fs/qnx6/dir.c b/fs/qnx6/dir.c index 0de2a047a174..b4d10e45f2e4 100644 --- a/fs/qnx6/dir.c +++ b/fs/qnx6/dir.c @@ -32,7 +32,7 @@ static void *qnx6_get_folio(struct inode *dir, unsigned long n, if (IS_ERR(folio)) return folio; *foliop = folio; - return kmap(&folio->page); + return kmap_local_folio(folio, 0); } static unsigned last_entry(struct inode *inode, unsigned long page_nr) @@ -59,7 +59,7 @@ static struct qnx6_long_filename *qnx6_longname(struct super_block *sb, return ERR_CAST(folio); offs = offset_in_folio(folio, s << sb->s_blocksize_bits); *foliop = folio; - return kmap(&folio->page) + offs; + return kmap_local_folio(folio, offs); } static int qnx6_dir_longfilename(struct inode *inode, @@ -90,7 +90,7 @@ static int qnx6_dir_longfilename(struct inode *inode, if (lf_size > QNX6_LONG_NAME_MAX) { pr_debug("file %s\n", lf->lf_fname); pr_err("Filename too long (%i)\n", lf_size); - qnx6_put_page(&folio->page); + folio_release_kmap(folio, lf); return 0; } @@ -103,11 +103,11 @@ static int qnx6_dir_longfilename(struct inode *inode, pr_debug("qnx6_readdir:%.*s inode:%u\n", lf_size, lf->lf_fname, de_inode); if (!dir_emit(ctx, lf->lf_fname, lf_size, de_inode, DT_UNKNOWN)) { - qnx6_put_page(&folio->page); + folio_release_kmap(folio, lf); return 0; } - qnx6_put_page(&folio->page); + folio_release_kmap(folio, lf); /* success */ return 1; } @@ -168,7 +168,7 @@ static int qnx6_readdir(struct file *file, struct dir_context *ctx) } } } - qnx6_put_page(&folio->page); + folio_release_kmap(folio, kaddr); } return 0; } @@ -190,14 +190,14 @@ static unsigned qnx6_long_match(int len, const char *name, thislen = fs16_to_cpu(sbi, lf->lf_size); if (len != thislen) { - qnx6_put_page(&folio->page); + folio_release_kmap(folio, lf); return 0; } if (memcmp(name, lf->lf_fname, len) == 0) { - qnx6_put_page(&folio->page); + folio_release_kmap(folio, lf); return fs32_to_cpu(sbi, de->de_inode); } - qnx6_put_page(&folio->page); + folio_release_kmap(folio, lf); return 0; } @@ -256,7 +256,7 @@ unsigned qnx6_find_ino(int len, struct inode *dir, const char *name) } else pr_err("undefined filename size in inode.\n"); } - qnx6_put_page(&folio->page); + folio_release_kmap(folio, de - i); } if (++n >= npages) @@ -266,7 +266,7 @@ unsigned qnx6_find_ino(int len, struct inode *dir, const char *name) found: ei->i_dir_start_lookup = n; - qnx6_put_page(&folio->page); + folio_release_kmap(folio, de); return ino; } diff --git a/fs/qnx6/qnx6.h b/fs/qnx6/qnx6.h index 43da5f91c3ff..56ed1367499e 100644 --- a/fs/qnx6/qnx6.h +++ b/fs/qnx6/qnx6.h @@ -126,10 +126,4 @@ static inline __fs16 cpu_to_fs16(struct qnx6_sb_info *sbi, __u16 n) extern struct qnx6_super_block *qnx6_mmi_fill_super(struct super_block *s, int silent); -static inline void qnx6_put_page(struct page *page) -{ - kunmap(page); - put_page(page); -} - unsigned qnx6_find_ino(int len, struct inode *dir, const char *name);