Whamcloud - gitweb
LU-2622 obdclass: Remove the global cl_env list
[fs/lustre-release.git] / lustre / liblustre / llite_cl.c
index 0aaa7bf..337a5ce 100644 (file)
@@ -1,6 +1,4 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
+/*
  *   Copyright (c) 2007 Cluster File Systems, Inc.
  *   Author: Nikita Danilov <nikita@clusterfs.com>
  *
@@ -18,6 +16,8 @@
  *   You should have received a copy of the GNU General Public License
  *   along with Lustre; if not, write to the Free Software
  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ *   Copyright (c) 2011, 2012, Intel Corporation.
  */
 
 #define DEBUG_SUBSYSTEM S_LLITE
 # include <sys/statfs.h>
 #endif
 
-#include <sysio.h>
-#ifdef HAVE_XTIO_H
-#include <xtio.h>
-#endif
-#include <fs.h>
-#include <mount.h>
-#include <inode.h>
-#ifdef HAVE_FILE_H
-#include <file.h>
-#endif
 #include <liblustre.h>
 
 #include <obd.h>
@@ -67,9 +57,8 @@
 static int   slp_type_init     (struct lu_device_type *t);
 static void  slp_type_fini     (struct lu_device_type *t);
 
-static struct cl_page * slp_page_init(const struct lu_env *env,
-                                     struct cl_object *obj,
-                                     struct cl_page *page, cfs_page_t *vmpage);
+static int slp_page_init(const struct lu_env *env, struct cl_object *obj,
+                        struct cl_page *page, cfs_page_t *vmpage);
 static int   slp_attr_get     (const struct lu_env *env, struct cl_object *obj,
                                struct cl_attr *attr);
 
@@ -234,32 +223,26 @@ void slp_global_fini(void)
  *
  */
 
-static struct cl_page *slp_page_init(const struct lu_env *env,
-                                     struct cl_object *obj,
-                                     struct cl_page *page, cfs_page_t *vmpage)
+static int slp_page_init(const struct lu_env *env, struct cl_object *obj,
+                       struct cl_page *page, cfs_page_t *vmpage)
 {
-        struct ccc_page *cpg;
-        int result;
+        struct ccc_page *cpg = cl_object_page_slice(obj, page);
 
         CLOBINVRNT(env, obj, ccc_object_invariant(obj));
 
-        OBD_ALLOC_PTR(cpg);
-        if (cpg != NULL) {
-                cpg->cpg_page = vmpage;
+       cpg->cpg_page = vmpage;
 
-                if (page->cp_type == CPT_CACHEABLE) {
-                        LBUG();
-                } else {
-                        struct ccc_object *clobj = cl2ccc(obj);
+       if (page->cp_type == CPT_CACHEABLE) {
+               LBUG();
+       } else {
+               struct ccc_object *clobj = cl2ccc(obj);
 
-                        cl_page_slice_add(page, &cpg->cpg_cl, obj,
-                                          &slp_transient_page_ops);
-                        clobj->cob_transient_pages++;
-                }
-                result = 0;
-        } else
-                result = -ENOMEM;
-        return ERR_PTR(result);
+               cl_page_slice_add(page, &cpg->cpg_cl, obj,
+                               &slp_transient_page_ops);
+               clobj->cob_transient_pages++;
+       }
+
+        return 0;
 }
 
 static int slp_io_init(const struct lu_env *env, struct cl_object *obj,
@@ -498,7 +481,6 @@ static int llu_queue_pio(const struct lu_env *env, struct cl_io *io,
         struct obd_export *exp = llu_i2obdexp(inode);
         struct page *page;
         int  rc = 0, ret_bytes = 0;
-        int local_lock;
         struct cl_page *clp;
         struct cl_2queue *queue;
         ENTRY;
@@ -506,8 +488,6 @@ static int llu_queue_pio(const struct lu_env *env, struct cl_io *io,
         if (!exp)
                 RETURN(-EINVAL);
 
-        local_lock = group->lig_params->lrp_lock_mode != LCK_NL;
-
         queue = &io->ci_queue;
         cl_2queue_init(queue);
 
@@ -573,7 +553,7 @@ static int llu_queue_pio(const struct lu_env *env, struct cl_io *io,
         if (rc == 0) {
                 enum cl_req_type iot;
                 iot = io->ci_type == CIT_READ ? CRT_READ : CRT_WRITE;
-                rc = cl_io_submit_sync(env, io, iot, queue, CRP_NORMAL, 0);
+               rc = cl_io_submit_sync(env, io, iot, queue, 0);
         }
 
         group->lig_rc = rc;
@@ -656,7 +636,7 @@ static int slp_io_start(const struct lu_env *env, const struct cl_io_slice *ios)
         if (IS_ERR(iogroup))
                 RETURN(PTR_ERR(iogroup));
 
-        err = ccc_prep_size(env, obj, io, pos, cnt, 0, &exceed);
+        err = ccc_prep_size(env, obj, io, pos, cnt, &exceed);
         if (err != 0 || (write == 0 && exceed != 0))
                 GOTO(out, err);
 
@@ -811,6 +791,5 @@ int cl_sb_fini(struct llu_sb_info *sbi)
          * automatically when last device is destroyed).
          */
         lu_types_stop();
-        cl_env_cache_purge(~0);
         RETURN(0);
 }