Whamcloud - gitweb
LU-5413 mdd: improve error handling around mdd_write_lock()
[fs/lustre-release.git] / lustre / llite / vvp_dev.c
index 8b9e09a..ac004c0 100644 (file)
 
 #define DEBUG_SUBSYSTEM S_LLITE
 
-#ifndef __KERNEL__
-# error This file is kernel only.
-#endif
 
 #include <obd.h>
 #include <lustre_lite.h>
-
+#include "llite_internal.h"
 #include "vvp_internal.h"
 
 /*****************************************************************************
@@ -61,7 +58,7 @@
  * "llite_" (var. "ll_") prefix.
  */
 
-struct kmem_cache *vvp_thread_kmem;
+static struct kmem_cache *vvp_thread_kmem;
 static struct kmem_cache *vvp_session_kmem;
 static struct lu_kmem_descr vvp_caches[] = {
         {
@@ -84,7 +81,7 @@ static void *vvp_key_init(const struct lu_context *ctx,
 {
        struct vvp_thread_info *info;
 
-       OBD_SLAB_ALLOC_PTR_GFP(info, vvp_thread_kmem, __GFP_IO);
+       OBD_SLAB_ALLOC_PTR_GFP(info, vvp_thread_kmem, GFP_NOFS);
        if (info == NULL)
                info = ERR_PTR(-ENOMEM);
        return info;
@@ -102,7 +99,7 @@ static void *vvp_session_key_init(const struct lu_context *ctx,
 {
        struct vvp_session *session;
 
-       OBD_SLAB_ALLOC_PTR_GFP(session, vvp_session_kmem, __GFP_IO);
+       OBD_SLAB_ALLOC_PTR_GFP(session, vvp_session_kmem, GFP_NOFS);
        if (session == NULL)
                session = ERR_PTR(-ENOMEM);
        return session;
@@ -245,13 +242,8 @@ int cl_sb_fini(struct super_block *sb)
                 CERROR("Cannot cleanup cl-stack due to memory shortage.\n");
                 result = PTR_ERR(env);
         }
-        /*
-         * If mount failed (sbi->ll_cl == NULL), and this there are no other
-         * mounts, stop device types manually (this usually happens
-         * automatically when last device is destroyed).
-         */
-        lu_types_stop();
-        RETURN(result);
+
+       RETURN(result);
 }
 
 /****************************************************************************
@@ -303,7 +295,7 @@ static loff_t vvp_pgcache_id_pack(struct vvp_pgcache_id *id)
 }
 
 static int vvp_pgcache_obj_get(cfs_hash_t *hs, cfs_hash_bd_t *bd,
-                               cfs_hlist_node_t *hnode, void *data)
+                              struct hlist_node *hnode, void *data)
 {
         struct vvp_pgcache_id   *id  = data;
         struct lu_object_header *hdr = cfs_hash_object(hs, hnode);
@@ -397,7 +389,7 @@ static loff_t vvp_pgcache_find(const struct lu_env *env,
 } while(0)
 
 static void vvp_pgcache_page_show(const struct lu_env *env,
-                                  struct seq_file *seq, struct cl_page *page)
+                                 struct seq_file *seq, struct cl_page *page)
 {
        struct ccc_page *cpg;
        struct page      *vmpage;
@@ -416,14 +408,14 @@ static void vvp_pgcache_page_show(const struct lu_env *env,
                   PFID(ll_inode2fid(vmpage->mapping->host)),
                   vmpage->mapping->host, vmpage->index,
                   page_count(vmpage));
-        has_flags = 0;
-        seq_page_flag(seq, vmpage, locked, has_flags);
-        seq_page_flag(seq, vmpage, error, has_flags);
-        seq_page_flag(seq, vmpage, referenced, has_flags);
-        seq_page_flag(seq, vmpage, uptodate, has_flags);
-        seq_page_flag(seq, vmpage, dirty, has_flags);
-        seq_page_flag(seq, vmpage, writeback, has_flags);
-        seq_printf(seq, "%s]\n", has_flags ? "" : "-");
+       has_flags = 0;
+       seq_page_flag(seq, vmpage, locked, has_flags);
+       seq_page_flag(seq, vmpage, error, has_flags);
+       seq_page_flag(seq, vmpage, referenced, has_flags);
+       seq_page_flag(seq, vmpage, uptodate, has_flags);
+       seq_page_flag(seq, vmpage, dirty, has_flags);
+       seq_page_flag(seq, vmpage, writeback, has_flags);
+       seq_printf(seq, "%s]\n", has_flags ? "" : "-");
 }
 
 static int vvp_pgcache_show(struct seq_file *f, void *v)
@@ -530,20 +522,19 @@ static struct seq_operations vvp_pgcache_ops = {
 
 static int vvp_dump_pgcache_seq_open(struct inode *inode, struct file *filp)
 {
-        struct proc_dir_entry *dp  = PDE(inode);
-        struct ll_sb_info     *sbi = dp->data;
-        struct seq_file       *seq;
-        int                    result;
-
-        result = seq_open(filp, &vvp_pgcache_ops);
-        if (result == 0) {
-                seq = filp->private_data;
-                seq->private = sbi;
-        }
-        return result;
+       struct ll_sb_info       *sbi = PDE_DATA(inode);
+       struct seq_file         *seq;
+       int                     result;
+
+       result = seq_open(filp, &vvp_pgcache_ops);
+       if (result == 0) {
+               seq = filp->private_data;
+               seq->private = sbi;
+       }
+       return result;
 }
 
-struct file_operations vvp_dump_pgcache_file_ops = {
+const struct file_operations vvp_dump_pgcache_file_ops = {
         .owner   = THIS_MODULE,
         .open    = vvp_dump_pgcache_seq_open,
         .read    = seq_read,