]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
qnx6: Convert qnx6_find_entry() to qnx6_find_ino()
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Wed, 10 Jul 2024 03:13:18 +0000 (23:13 -0400)
committerChristian Brauner <brauner@kernel.org>
Wed, 7 Aug 2024 09:31:55 +0000 (11:31 +0200)
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>
fs/qnx6/dir.c
fs/qnx6/namei.c
fs/qnx6/qnx6.h

index bc7f20dda579caf4f63fc3639b673c9df2aeed0d..daf9a335ba224367af254dfd00d0ae9cd3a71da0 100644 (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,
-                        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;
 }
 
index e2e98e653b8d9dc2f3011dbcc501e2950e5c6fdd..0f0755a9ecb5312601ce6d8c65d607a2ae132bca 100644 (file)
@@ -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));
index 34a6b126a3a98338e1504b1b1ce2b6969294b0b7..43da5f91c3ff6f21bed711c4868ef6a7d144f16e 100644 (file)
@@ -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);