Whamcloud - gitweb
LU-1876 hsm: account for active IOs correctly
[fs/lustre-release.git] / lustre / lov / lov_cl_internal.h
index 6d4360c..d0bb9ae 100644 (file)
@@ -40,6 +40,7 @@
  * Internal interfaces of LOV layer.
  *
  *   Author: Nikita Danilov <nikita.danilov@sun.com>
+ *   Author: Jinshan Xiong <jinshan.xiong@intel.com>
  */
 
 #ifndef LOV_CL_INTERNAL_H
@@ -197,23 +198,28 @@ struct lov_object {
          * \see lov_object::lo_type
          */
        struct rw_semaphore     lo_type_guard;
-        /**
-         * Type of an object. Protected by lov_object::lo_type_guard.
-         */
-        enum lov_layout_type   lo_type;
        /**
-        * True if layout is valid. This bit is cleared when layout lock
+        * Type of an object. Protected by lov_object::lo_type_guard.
+        */
+       enum lov_layout_type    lo_type;
+       /**
+        * True if layout is invalid. This bit is cleared when layout lock
         * is lost.
         */
-       unsigned               lo_lsm_invalid:1;
+       bool                    lo_layout_invalid;
        /**
-        * Layout metadata.
+        * How many IOs are on going on this object. Layout can be changed
+        * only if there is no active IO.
         */
-       struct lov_stripe_md  *lo_lsm;
+       cfs_atomic_t           lo_active_ios;
        /**
         * Waitq - wait for no one else is using lo_lsm
         */
        cfs_waitq_t            lo_waitq;
+       /**
+        * Layout metadata. NULL if empty layout.
+        */
+       struct lov_stripe_md  *lo_lsm;
 
         union lov_layout_state {
                 struct lov_layout_raid0 {
@@ -482,11 +488,6 @@ struct lov_io {
          * lov_io::lis_cl::cis_object.
          */
         struct lov_object *lis_object;
-       /**
-        * Lov stripe - this determines how this io fans out.
-        * Hold a refcount to the lsm so it can't go away during IO.
-        */
-       struct lov_stripe_md *lis_lsm;
         /**
          * Original end-of-io position for this IO, set by the upper layer as
          * cl_io::u::ci_rw::pos + cl_io::u::ci_rw::count. lov remembers this,