1

qnx6: Convert qnx6_find_entry() to qnx6_find_ino()

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.

Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
Matthew Wilcox (Oracle) 2024-07-09 23:13:18 -04:00 committed by Christian Brauner
parent b2aa61556f
commit 5563040e85
No known key found for this signature in database
GPG Key ID: 91C61BC06578DCA2
3 changed files with 4 additions and 10 deletions

View File

@ -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, unsigned qnx6_find_ino(int len, struct inode *dir, const char *name)
struct page **res_page)
{ {
struct super_block *s = dir->i_sb; struct super_block *s = dir->i_sb;
struct qnx6_inode_info *ei = QNX6_I(dir); 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_dir_entry *de;
struct qnx6_long_dir_entry *lde; struct qnx6_long_dir_entry *lde;
*res_page = NULL;
if (npages == 0) if (npages == 0)
return 0; return 0;
start = ei->i_dir_start_lookup; start = ei->i_dir_start_lookup;
@ -267,8 +264,8 @@ unsigned qnx6_find_entry(int len, struct inode *dir, const char *name,
return 0; return 0;
found: found:
*res_page = &folio->page;
ei->i_dir_start_lookup = n; ei->i_dir_start_lookup = n;
qnx6_put_page(&folio->page);
return ino; return ino;
} }

View File

@ -17,7 +17,6 @@ struct dentry *qnx6_lookup(struct inode *dir, struct dentry *dentry,
unsigned int flags) unsigned int flags)
{ {
unsigned ino; unsigned ino;
struct page *page;
struct inode *foundinode = NULL; struct inode *foundinode = NULL;
const char *name = dentry->d_name.name; const char *name = dentry->d_name.name;
int len = dentry->d_name.len; 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) if (len > QNX6_LONG_NAME_MAX)
return ERR_PTR(-ENAMETOOLONG); return ERR_PTR(-ENAMETOOLONG);
ino = qnx6_find_entry(len, dir, name, &page); ino = qnx6_find_ino(len, dir, name);
if (ino) { if (ino) {
foundinode = qnx6_iget(dir->i_sb, ino); foundinode = qnx6_iget(dir->i_sb, ino);
qnx6_put_page(page);
if (IS_ERR(foundinode)) if (IS_ERR(foundinode))
pr_debug("lookup->iget -> error %ld\n", pr_debug("lookup->iget -> error %ld\n",
PTR_ERR(foundinode)); PTR_ERR(foundinode));

View File

@ -132,5 +132,4 @@ static inline void qnx6_put_page(struct page *page)
put_page(page); put_page(page);
} }
extern unsigned qnx6_find_entry(int len, struct inode *dir, const char *name, unsigned qnx6_find_ino(int len, struct inode *dir, const char *name);
struct page **res_page);