Whamcloud - gitweb
LU-744 clio: save memory allocations for cl_page
[fs/lustre-release.git] / lustre / osc / osc_cl_internal.h
index 54ded82..de2b2df 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, Whamcloud, Inc.
+ * Copyright (c) 2012, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -56,6 +56,7 @@
 /* osc_build_res_name() */
 #include <obd_ost.h>
 #include <cl_object.h>
+#include <lclient.h>
 #include "osc_internal.h"
 
 /** \defgroup osc osc
@@ -82,8 +83,9 @@ struct osc_io {
        struct obd_info    oi_info;
        struct obdo        oi_oa;
        struct osc_async_cbargs {
+               bool              opc_rpc_sent;
                int               opc_rc;
-               cfs_completion_t  opc_sync;
+               struct completion       opc_sync;
        } oi_cbarg;
 };
 
@@ -101,6 +103,7 @@ struct osc_session {
         struct osc_io       os_io;
 };
 
+#define OTI_PVEC_SIZE 64
 struct osc_thread_info {
         struct ldlm_res_id      oti_resname;
         ldlm_policy_data_t      oti_policy;
@@ -108,7 +111,8 @@ struct osc_thread_info {
         struct cl_attr          oti_attr;
         struct lustre_handle    oti_handle;
         struct cl_page_list     oti_plist;
-       struct cl_io        oti_io;
+       struct cl_io            oti_io;
+       struct cl_page         *oti_pvec[OTI_PVEC_SIZE];
 };
 
 struct osc_object {
@@ -125,7 +129,7 @@ struct osc_object {
          */
         struct cl_io       oo_debug_io;
         /** Serialization object for osc_object::oo_debug_io. */
-        cfs_mutex_t        oo_debug_mutex;
+       struct mutex       oo_debug_mutex;
 #endif
         /**
          * List of pages in transfer.
@@ -135,7 +139,7 @@ struct osc_object {
          * Lock, protecting ccc_object::cob_inflight, because a seat-belt is
          * locked during take-off and landing.
          */
-        cfs_spinlock_t     oo_seatbelt;
+       spinlock_t         oo_seatbelt;
 
        /**
         * used by the osc to keep track of what objects to build into rpcs.
@@ -164,27 +168,27 @@ struct osc_object {
 
        /** Protect extent tree. Will be used to protect
         * oo_{read|write}_pages soon. */
-       cfs_spinlock_t       oo_lock;
+       spinlock_t          oo_lock;
 };
 
 static inline void osc_object_lock(struct osc_object *obj)
 {
-       cfs_spin_lock(&obj->oo_lock);
+       spin_lock(&obj->oo_lock);
 }
 
 static inline int osc_object_trylock(struct osc_object *obj)
 {
-       return cfs_spin_trylock(&obj->oo_lock);
+       return spin_trylock(&obj->oo_lock);
 }
 
 static inline void osc_object_unlock(struct osc_object *obj)
 {
-       cfs_spin_unlock(&obj->oo_lock);
+       spin_unlock(&obj->oo_lock);
 }
 
 static inline int osc_object_is_locked(struct osc_object *obj)
 {
-       return cfs_spin_is_locked(&obj->oo_lock);
+       return spin_is_locked(&obj->oo_lock);
 }
 
 /*
@@ -251,7 +255,7 @@ struct osc_lock {
         /** lock value block */
         struct ost_lvb           ols_lvb;
         /** DLM flags with which osc_lock::ols_lock was enqueued */
-        int                      ols_flags;
+       __u64                    ols_flags;
         /** osc_lock::ols_lock handle */
         struct lustre_handle     ols_handle;
         struct ldlm_enqueue_info ols_einfo;
@@ -360,14 +364,25 @@ struct osc_page {
          */
                               ops_temp:1,
         /**
+        * in LRU?
+        */
+                             ops_in_lru:1,
+       /**
          * Set if the page must be transferred with OBD_BRW_SRVLOCK.
          */
                               ops_srvlock:1;
-        /**
-         * Linkage into a per-osc_object list of pages in flight. For
-         * debugging.
-         */
-        cfs_list_t            ops_inflight;
+       union {
+               /**
+                * lru page list. ops_inflight and ops_lru are exclusive so
+                * that they can share the same data.
+                */
+               cfs_list_t            ops_lru;
+               /**
+                * Linkage into a per-osc_object list of pages in flight. For
+                * debugging.
+                */
+               cfs_list_t            ops_inflight;
+       };
         /**
          * Thread that submitted this page for transfer. For debugging.
          */
@@ -388,7 +403,6 @@ struct osc_page {
         struct cl_lock       *ops_lock;
 };
 
-extern cfs_mem_cache_t *osc_page_kmem;
 extern cfs_mem_cache_t *osc_lock_kmem;
 extern cfs_mem_cache_t *osc_object_kmem;
 extern cfs_mem_cache_t *osc_thread_kmem;
@@ -412,9 +426,8 @@ int osc_req_init (const struct lu_env *env, struct cl_device *dev,
 struct lu_object *osc_object_alloc(const struct lu_env *env,
                                    const struct lu_object_header *hdr,
                                    struct lu_device *dev);
-struct cl_page   *osc_page_init   (const struct lu_env *env,
-                                   struct cl_object *obj,
-                                   struct cl_page *page, cfs_page_t *vmpage);
+int osc_page_init(const struct lu_env *env, struct cl_object *obj,
+                 struct cl_page *page, cfs_page_t *vmpage);
 
 void osc_lock_build_res(const struct lu_env *env, const struct osc_object *obj,
                         struct ldlm_res_id *resname);