diff mbox series

[2/6] qnx6: Convert qnx6_find_entry() to qnx6_find_ino()

Message ID 20240710155946.2257293-3-willy@infradead.org (mailing list archive)
State New
Headers show
Series Convert qnx6 directory handling to folios | expand

Commit Message

Matthew Wilcox (Oracle) July 10, 2024, 3:59 p.m. UTC
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) <willy@infradead.org>
---
 fs/qnx6/dir.c   | 7 ++-----
 fs/qnx6/namei.c | 4 +---
 fs/qnx6/qnx6.h  | 3 +--
 3 files changed, 4 insertions(+), 10 deletions(-)
diff mbox series

Patch

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);