Whamcloud - gitweb
LU-6025 utils: reset optind before calls to getopt_long()
[fs/lustre-release.git] / lustre / lov / lov_dev.c
index 031253a..17372b1 100644 (file)
@@ -27,7 +27,7 @@
  * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2012, 2013, Intel Corporation.
+ * Copyright (c) 2012, 2014, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
 
 #include "lov_cl_internal.h"
 
-cfs_mem_cache_t *lov_lock_kmem;
-cfs_mem_cache_t *lov_object_kmem;
-cfs_mem_cache_t *lov_thread_kmem;
-cfs_mem_cache_t *lov_session_kmem;
-cfs_mem_cache_t *lov_req_kmem;
+struct kmem_cache *lov_lock_kmem;
+struct kmem_cache *lov_object_kmem;
+struct kmem_cache *lov_thread_kmem;
+struct kmem_cache *lov_session_kmem;
+struct kmem_cache *lov_req_kmem;
 
-cfs_mem_cache_t *lovsub_lock_kmem;
-cfs_mem_cache_t *lovsub_object_kmem;
-cfs_mem_cache_t *lovsub_req_kmem;
+struct kmem_cache *lovsub_lock_kmem;
+struct kmem_cache *lovsub_object_kmem;
+struct kmem_cache *lovsub_req_kmem;
 
-cfs_mem_cache_t *lov_lock_link_kmem;
+struct kmem_cache *lov_lock_link_kmem;
 
 /** Lock class of lov_device::ld_mutex. */
-struct lock_class_key cl_lov_device_mutex_class;
+static struct lock_class_key cl_lov_device_mutex_class;
 
 struct lu_kmem_descr lov_caches[] = {
         {
@@ -139,24 +139,21 @@ static const struct cl_req_operations lov_req_ops = {
  */
 
 static void *lov_key_init(const struct lu_context *ctx,
-                          struct lu_context_key *key)
+                         struct lu_context_key *key)
 {
-        struct lov_thread_info *info;
+       struct lov_thread_info *info;
 
-        OBD_SLAB_ALLOC_PTR_GFP(info, lov_thread_kmem, CFS_ALLOC_IO);
-        if (info != NULL)
-                CFS_INIT_LIST_HEAD(&info->lti_closure.clc_list);
-        else
-                info = ERR_PTR(-ENOMEM);
-        return info;
+       OBD_SLAB_ALLOC_PTR_GFP(info, lov_thread_kmem, GFP_NOFS);
+       if (info == NULL)
+               info = ERR_PTR(-ENOMEM);
+       return info;
 }
 
 static void lov_key_fini(const struct lu_context *ctx,
-                         struct lu_context_key *key, void *data)
+                        struct lu_context_key *key, void *data)
 {
-        struct lov_thread_info *info = data;
-        LINVRNT(cfs_list_empty(&info->lti_closure.clc_list));
-        OBD_SLAB_FREE_PTR(info, lov_thread_kmem);
+       struct lov_thread_info *info = data;
+       OBD_SLAB_FREE_PTR(info, lov_thread_kmem);
 }
 
 struct lu_context_key lov_key = {
@@ -166,14 +163,14 @@ struct lu_context_key lov_key = {
 };
 
 static void *lov_session_key_init(const struct lu_context *ctx,
-                                  struct lu_context_key *key)
+                                 struct lu_context_key *key)
 {
-        struct lov_session *info;
+       struct lov_session *info;
 
-        OBD_SLAB_ALLOC_PTR_GFP(info, lov_session_kmem, CFS_ALLOC_IO);
-        if (info == NULL)
-                info = ERR_PTR(-ENOMEM);
-        return info;
+       OBD_SLAB_ALLOC_PTR_GFP(info, lov_session_kmem, GFP_NOFS);
+       if (info == NULL)
+               info = ERR_PTR(-ENOMEM);
+       return info;
 }
 
 static void lov_session_key_fini(const struct lu_context *ctx,
@@ -255,19 +252,19 @@ static int lov_device_init(const struct lu_env *env, struct lu_device *d,
 }
 
 static int lov_req_init(const struct lu_env *env, struct cl_device *dev,
-                        struct cl_req *req)
+                       struct cl_req *req)
 {
-        struct lov_req *lr;
-        int result;
-
-        ENTRY;
-        OBD_SLAB_ALLOC_PTR_GFP(lr, lov_req_kmem, CFS_ALLOC_IO);
-        if (lr != NULL) {
-                cl_req_slice_add(req, &lr->lr_cl, dev, &lov_req_ops);
-                result = 0;
-        } else
-                result = -ENOMEM;
-        RETURN(result);
+       struct lov_req *lr;
+       int result;
+
+       ENTRY;
+       OBD_SLAB_ALLOC_PTR_GFP(lr, lov_req_kmem, GFP_NOFS);
+       if (lr != NULL) {
+               cl_req_slice_add(req, &lr->lr_cl, dev, &lov_req_ops);
+               result = 0;
+       } else
+               result = -ENOMEM;
+       RETURN(result);
 }
 
 static const struct cl_device_operations lov_cl_ops = {