Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
[platform/adaptation/renesas_rcar/renesas_kernel.git] / fs / fscache / object-list.c
index f27c89d..e1959ef 100644 (file)
@@ -70,13 +70,10 @@ void fscache_objlist_add(struct fscache_object *obj)
        write_unlock(&fscache_object_list_lock);
 }
 
-/**
- * fscache_object_destroy - Note that a cache object is about to be destroyed
- * @object: The object to be destroyed
- *
- * Note the imminent destruction and deallocation of a cache object record.
+/*
+ * Remove an object from the object list.
  */
-void fscache_object_destroy(struct fscache_object *obj)
+void fscache_objlist_remove(struct fscache_object *obj)
 {
        write_lock(&fscache_object_list_lock);
 
@@ -85,7 +82,6 @@ void fscache_object_destroy(struct fscache_object *obj)
 
        write_unlock(&fscache_object_list_lock);
 }
-EXPORT_SYMBOL(fscache_object_destroy);
 
 /*
  * find the object in the tree on or after the specified index
@@ -166,15 +162,14 @@ static int fscache_objlist_show(struct seq_file *m, void *v)
 {
        struct fscache_objlist_data *data = m->private;
        struct fscache_object *obj = v;
+       struct fscache_cookie *cookie;
        unsigned long config = data->config;
-       uint16_t keylen, auxlen;
        char _type[3], *type;
-       bool no_cookie;
        u8 *buf = data->buf, *p;
 
        if ((unsigned long) v == 1) {
                seq_puts(m, "OBJECT   PARENT   STAT CHLDN OPS OOP IPR EX READS"
-                        " EM EV F S"
+                        " EM EV FL S"
                         " | NETFS_COOKIE_DEF TY FL NETFS_DATA");
                if (config & (FSCACHE_OBJLIST_CONFIG_KEY |
                              FSCACHE_OBJLIST_CONFIG_AUX))
@@ -193,7 +188,7 @@ static int fscache_objlist_show(struct seq_file *m, void *v)
 
        if ((unsigned long) v == 2) {
                seq_puts(m, "======== ======== ==== ===== === === === == ====="
-                        " == == = ="
+                        " == == == ="
                         " | ================ == == ================");
                if (config & (FSCACHE_OBJLIST_CONFIG_KEY |
                              FSCACHE_OBJLIST_CONFIG_AUX))
@@ -216,10 +211,11 @@ static int fscache_objlist_show(struct seq_file *m, void *v)
                }                                                       \
        } while(0)
 
+       cookie = obj->cookie;
        if (~config) {
-               FILTER(obj->cookie,
+               FILTER(cookie->def,
                       COOKIE, NOCOOKIE);
-               FILTER(obj->state != FSCACHE_OBJECT_ACTIVE ||
+               FILTER(fscache_object_is_active(obj) ||
                       obj->n_ops != 0 ||
                       obj->n_obj_ops != 0 ||
                       obj->flags ||
@@ -235,10 +231,10 @@ static int fscache_objlist_show(struct seq_file *m, void *v)
        }
 
        seq_printf(m,
-                  "%8x %8x %s %5u %3u %3u %3u %2u %5u %2lx %2lx %1lx %1x | ",
+                  "%8x %8x %s %5u %3u %3u %3u %2u %5u %2lx %2lx %2lx %1x | ",
                   obj->debug_id,
                   obj->parent ? obj->parent->debug_id : -1,
-                  fscache_object_states_short[obj->state],
+                  obj->state->short_name,
                   obj->n_children,
                   obj->n_ops,
                   obj->n_obj_ops,
@@ -250,48 +246,40 @@ static int fscache_objlist_show(struct seq_file *m, void *v)
                   obj->flags,
                   work_busy(&obj->work));
 
-       no_cookie = true;
-       keylen = auxlen = 0;
-       if (obj->cookie) {
-               spin_lock(&obj->lock);
-               if (obj->cookie) {
-                       switch (obj->cookie->def->type) {
-                       case 0:
-                               type = "IX";
-                               break;
-                       case 1:
-                               type = "DT";
-                               break;
-                       default:
-                               sprintf(_type, "%02u",
-                                       obj->cookie->def->type);
-                               type = _type;
-                               break;
-                       }
+       if (fscache_use_cookie(obj)) {
+               uint16_t keylen = 0, auxlen = 0;
 
-                       seq_printf(m, "%-16s %s %2lx %16p",
-                                  obj->cookie->def->name,
-                                  type,
-                                  obj->cookie->flags,
-                                  obj->cookie->netfs_data);
-
-                       if (obj->cookie->def->get_key &&
-                           config & FSCACHE_OBJLIST_CONFIG_KEY)
-                               keylen = obj->cookie->def->get_key(
-                                       obj->cookie->netfs_data,
-                                       buf, 400);
-
-                       if (obj->cookie->def->get_aux &&
-                           config & FSCACHE_OBJLIST_CONFIG_AUX)
-                               auxlen = obj->cookie->def->get_aux(
-                                       obj->cookie->netfs_data,
-                                       buf + keylen, 512 - keylen);
-
-                       no_cookie = false;
+               switch (cookie->def->type) {
+               case 0:
+                       type = "IX";
+                       break;
+               case 1:
+                       type = "DT";
+                       break;
+               default:
+                       sprintf(_type, "%02u", cookie->def->type);
+                       type = _type;
+                       break;
                }
-               spin_unlock(&obj->lock);
 
-               if (!no_cookie && (keylen > 0 || auxlen > 0)) {
+               seq_printf(m, "%-16s %s %2lx %16p",
+                          cookie->def->name,
+                          type,
+                          cookie->flags,
+                          cookie->netfs_data);
+
+               if (cookie->def->get_key &&
+                   config & FSCACHE_OBJLIST_CONFIG_KEY)
+                       keylen = cookie->def->get_key(cookie->netfs_data,
+                                                     buf, 400);
+
+               if (cookie->def->get_aux &&
+                   config & FSCACHE_OBJLIST_CONFIG_AUX)
+                       auxlen = cookie->def->get_aux(cookie->netfs_data,
+                                                     buf + keylen, 512 - keylen);
+               fscache_unuse_cookie(obj);
+
+               if (keylen > 0 || auxlen > 0) {
                        seq_printf(m, " ");
                        for (p = buf; keylen > 0; keylen--)
                                seq_printf(m, "%02x", *p++);
@@ -302,12 +290,11 @@ static int fscache_objlist_show(struct seq_file *m, void *v)
                                        seq_printf(m, "%02x", *p++);
                        }
                }
-       }
 
-       if (no_cookie)
-               seq_printf(m, "<no_cookie>\n");
-       else
                seq_printf(m, "\n");
+       } else {
+               seq_printf(m, "<no_netfs>\n");
+       }
        return 0;
 }