Merge tag 'for-5.15/io_uring-2021-09-04' of git://git.kernel.dk/linux-block
[platform/kernel/linux-starfive.git] / fs / cachefiles / namei.c
index 7bf0732..a9aca5a 100644 (file)
@@ -39,18 +39,18 @@ void __cachefiles_printk_object(struct cachefiles_object *object,
        pr_err("%sops=%u inp=%u exc=%u\n",
               prefix, object->fscache.n_ops, object->fscache.n_in_progress,
               object->fscache.n_exclusive);
-       pr_err("%sparent=%p\n",
-              prefix, object->fscache.parent);
+       pr_err("%sparent=%x\n",
+              prefix, object->fscache.parent ? object->fscache.parent->debug_id : 0);
 
        spin_lock(&object->fscache.lock);
        cookie = object->fscache.cookie;
        if (cookie) {
-               pr_err("%scookie=%p [pr=%p nd=%p fl=%lx]\n",
+               pr_err("%scookie=%x [pr=%x nd=%p fl=%lx]\n",
                       prefix,
-                      object->fscache.cookie,
-                      object->fscache.cookie->parent,
-                      object->fscache.cookie->netfs_data,
-                      object->fscache.cookie->flags);
+                      cookie->debug_id,
+                      cookie->parent ? cookie->parent->debug_id : 0,
+                      cookie->netfs_data,
+                      cookie->flags);
                pr_err("%skey=[%u] '", prefix, cookie->key_len);
                k = (cookie->key_len <= sizeof(cookie->inline_key)) ?
                        cookie->inline_key : cookie->key;
@@ -110,7 +110,7 @@ static void cachefiles_mark_object_buried(struct cachefiles_cache *cache,
 
        /* found the dentry for  */
 found_dentry:
-       kdebug("preemptive burial: OBJ%x [%s] %p",
+       kdebug("preemptive burial: OBJ%x [%s] %pd",
               object->fscache.debug_id,
               object->fscache.state->name,
               dentry);
@@ -140,7 +140,7 @@ static int cachefiles_mark_object_active(struct cachefiles_cache *cache,
        struct rb_node **_p, *_parent = NULL;
        struct dentry *dentry;
 
-       _enter(",%p", object);
+       _enter(",%x", object->fscache.debug_id);
 
 try_again:
        write_lock(&cache->active_lock);
@@ -298,8 +298,6 @@ static int cachefiles_bury_object(struct cachefiles_cache *cache,
 
        _enter(",'%pd','%pd'", dir, rep);
 
-       _debug("remove %p from %p", rep, dir);
-
        /* non-directories can just be unlinked */
        if (!d_is_dir(rep)) {
                _debug("unlink stale object");
@@ -446,7 +444,7 @@ int cachefiles_delete_object(struct cachefiles_cache *cache,
        struct dentry *dir;
        int ret;
 
-       _enter(",OBJ%x{%p}", object->fscache.debug_id, object->dentry);
+       _enter(",OBJ%x{%pd}", object->fscache.debug_id, object->dentry);
 
        ASSERT(object->dentry);
        ASSERT(d_backing_inode(object->dentry));
@@ -496,11 +494,10 @@ int cachefiles_walk_to_object(struct cachefiles_object *parent,
        struct dentry *dir, *next = NULL;
        struct inode *inode;
        struct path path;
-       unsigned long start;
        const char *name;
        int ret, nlen;
 
-       _enter("OBJ%x{%p},OBJ%x,%s,",
+       _enter("OBJ%x{%pd},OBJ%x,%s,",
               parent->fscache.debug_id, parent->dentry,
               object->fscache.debug_id, key);
 
@@ -535,9 +532,7 @@ lookup_again:
 
        inode_lock_nested(d_inode(dir), I_MUTEX_PARENT);
 
-       start = jiffies;
        next = lookup_one_len(name, dir, nlen);
-       cachefiles_hist(cachefiles_lookup_histogram, start);
        if (IS_ERR(next)) {
                trace_cachefiles_lookup(object, next, NULL);
                goto lookup_error;
@@ -545,7 +540,7 @@ lookup_again:
 
        inode = d_backing_inode(next);
        trace_cachefiles_lookup(object, next, inode);
-       _debug("next -> %p %s", next, inode ? "positive" : "negative");
+       _debug("next -> %pd %s", next, inode ? "positive" : "negative");
 
        if (!key)
                object->new = !inode;
@@ -568,9 +563,7 @@ lookup_again:
                        ret = security_path_mkdir(&path, next, 0);
                        if (ret < 0)
                                goto create_error;
-                       start = jiffies;
                        ret = vfs_mkdir(&init_user_ns, d_inode(dir), next, 0);
-                       cachefiles_hist(cachefiles_mkdir_histogram, start);
                        if (!key)
                                trace_cachefiles_mkdir(object, next, ret);
                        if (ret < 0)
@@ -583,8 +576,8 @@ lookup_again:
                        }
                        ASSERT(d_backing_inode(next));
 
-                       _debug("mkdir -> %p{%p{ino=%lu}}",
-                              next, d_backing_inode(next), d_backing_inode(next)->i_ino);
+                       _debug("mkdir -> %pd{ino=%lu}",
+                              next, d_backing_inode(next)->i_ino);
 
                } else if (!d_can_lookup(next)) {
                        pr_err("inode %lu is not a directory\n",
@@ -604,18 +597,16 @@ lookup_again:
                        ret = security_path_mknod(&path, next, S_IFREG, 0);
                        if (ret < 0)
                                goto create_error;
-                       start = jiffies;
                        ret = vfs_create(&init_user_ns, d_inode(dir), next,
                                         S_IFREG, true);
-                       cachefiles_hist(cachefiles_create_histogram, start);
                        trace_cachefiles_create(object, next, ret);
                        if (ret < 0)
                                goto create_error;
 
                        ASSERT(d_backing_inode(next));
 
-                       _debug("create -> %p{%p{ino=%lu}}",
-                              next, d_backing_inode(next), d_backing_inode(next)->i_ino);
+                       _debug("create -> %pd{ino=%lu}",
+                              next, d_backing_inode(next)->i_ino);
 
                } else if (!d_can_lookup(next) &&
                           !d_is_reg(next)
@@ -765,7 +756,6 @@ struct dentry *cachefiles_get_directory(struct cachefiles_cache *cache,
                                        const char *dirname)
 {
        struct dentry *subdir;
-       unsigned long start;
        struct path path;
        int ret;
 
@@ -775,16 +765,14 @@ struct dentry *cachefiles_get_directory(struct cachefiles_cache *cache,
        inode_lock(d_inode(dir));
 
 retry:
-       start = jiffies;
        subdir = lookup_one_len(dirname, dir, strlen(dirname));
-       cachefiles_hist(cachefiles_lookup_histogram, start);
        if (IS_ERR(subdir)) {
                if (PTR_ERR(subdir) == -ENOMEM)
                        goto nomem_d_alloc;
                goto lookup_error;
        }
 
-       _debug("subdir -> %p %s",
+       _debug("subdir -> %pd %s",
               subdir, d_backing_inode(subdir) ? "positive" : "negative");
 
        /* we need to create the subdir if it doesn't exist yet */
@@ -810,10 +798,8 @@ retry:
                }
                ASSERT(d_backing_inode(subdir));
 
-               _debug("mkdir -> %p{%p{ino=%lu}}",
-                      subdir,
-                      d_backing_inode(subdir),
-                      d_backing_inode(subdir)->i_ino);
+               _debug("mkdir -> %pd{ino=%lu}",
+                      subdir, d_backing_inode(subdir)->i_ino);
        }
 
        inode_unlock(d_inode(dir));
@@ -876,7 +862,6 @@ static struct dentry *cachefiles_check_active(struct cachefiles_cache *cache,
        struct cachefiles_object *object;
        struct rb_node *_n;
        struct dentry *victim;
-       unsigned long start;
        int ret;
 
        //_enter(",%pd/,%s",
@@ -885,13 +870,11 @@ static struct dentry *cachefiles_check_active(struct cachefiles_cache *cache,
        /* look up the victim */
        inode_lock_nested(d_inode(dir), I_MUTEX_PARENT);
 
-       start = jiffies;
        victim = lookup_one_len(filename, dir, strlen(filename));
-       cachefiles_hist(cachefiles_lookup_histogram, start);
        if (IS_ERR(victim))
                goto lookup_error;
 
-       //_debug("victim -> %p %s",
+       //_debug("victim -> %pd %s",
        //       victim, d_backing_inode(victim) ? "positive" : "negative");
 
        /* if the object is no longer there then we probably retired the object
@@ -922,7 +905,7 @@ static struct dentry *cachefiles_check_active(struct cachefiles_cache *cache,
 
        read_unlock(&cache->active_lock);
 
-       //_leave(" = %p", victim);
+       //_leave(" = %pd", victim);
        return victim;
 
 object_in_use:
@@ -968,7 +951,7 @@ int cachefiles_cull(struct cachefiles_cache *cache, struct dentry *dir,
        if (IS_ERR(victim))
                return PTR_ERR(victim);
 
-       _debug("victim -> %p %s",
+       _debug("victim -> %pd %s",
               victim, d_backing_inode(victim) ? "positive" : "negative");
 
        /* okay... the victim is not being used so we can cull it