Whamcloud - gitweb
LU-14182 lov: cancel layout lock on replay deadlock
[fs/lustre-release.git] / lustre / lov / lov_cl_internal.h
index 083b5ba..c5b3c3e 100644 (file)
@@ -151,7 +151,8 @@ static inline char *llt2str(enum lov_layout_type llt)
 static inline __u32 lov_entry_type(struct lov_stripe_md_entry *lsme)
 {
        if ((lov_pattern(lsme->lsme_pattern) & LOV_PATTERN_RAID0) ||
-           (lov_pattern(lsme->lsme_pattern) == LOV_PATTERN_MDT))
+           (lov_pattern(lsme->lsme_pattern) == LOV_PATTERN_MDT) ||
+           (lov_pattern(lsme->lsme_pattern) == LOV_PATTERN_FOREIGN))
                return lov_pattern(lsme->lsme_pattern &
                                   ~LOV_PATTERN_OVERSTRIPING);
        return 0;
@@ -176,6 +177,11 @@ struct lov_comp_layout_entry_ops {
 struct lov_layout_raid0 {
        unsigned               lo_nr;
        /**
+        * record the stripe no before the truncate size, used for setting OST
+        * object size for truncate. LU-14128.
+        */
+       int                    lo_trunc_stripeno;
+       /**
         * When this is true, lov_object::lo_attr contains
         * valid up to date attributes for a top-level
         * object. This field is reset to 0 when attributes of
@@ -234,13 +240,20 @@ struct lov_mirror_entry {
        unsigned short  lre_mirror_id;
        unsigned short  lre_preferred:1,
                        lre_stale:1,    /* set if any components is stale */
-                       lre_valid:1;    /* set if at least one of components
+                       lre_valid:1,    /* set if at least one of components
                                         * in this mirror is valid */
+                       lre_foreign:1;  /* set if it is a foreign component */
+
        unsigned short  lre_start;      /* index to lo_entries, start index of
                                         * this mirror */
        unsigned short  lre_end;        /* end index of this mirror */
 };
 
+enum lov_object_flags {
+       /* Layout is invalid, set when layout lock is lost */
+       LO_LAYOUT_INVALID       = 0x1,
+};
+
 /**
  * lov-specific file state.
  *
@@ -271,10 +284,9 @@ struct lov_object {
         */
        enum lov_layout_type    lo_type;
        /**
-        * True if layout is invalid. This bit is cleared when layout lock
-        * is lost.
+        * Object flags.
         */
-       bool                    lo_layout_invalid;
+       unsigned long           lo_obj_flags;
        /**
         * How many IOs are on going on this object. Layout can be changed
         * only if there is no active IO.
@@ -596,15 +608,6 @@ extern struct kmem_cache *lov_session_kmem;
 
 extern struct kmem_cache *lovsub_object_kmem;
 
-int   lov_object_init     (const struct lu_env *env, struct lu_object *obj,
-                           const struct lu_object_conf *conf);
-int   lovsub_object_init  (const struct lu_env *env, struct lu_object *obj,
-                           const struct lu_object_conf *conf);
-int   lov_lock_init       (const struct lu_env *env, struct cl_object *obj,
-                           struct cl_lock *lock, const struct cl_io *io);
-int   lov_io_init         (const struct lu_env *env, struct cl_object *obj,
-                           struct cl_io *io);
-
 int   lov_lock_init_composite(const struct lu_env *env, struct cl_object *obj,
                            struct cl_lock *lock, const struct cl_io *io);
 int   lov_lock_init_empty (const struct lu_env *env, struct cl_object *obj,
@@ -619,8 +622,6 @@ int   lov_io_init_released(const struct lu_env *env, struct cl_object *obj,
 struct lov_io_sub *lov_sub_get(const struct lu_env *env, struct lov_io *lio,
                                int stripe);
 
-int   lov_page_init       (const struct lu_env *env, struct cl_object *ob,
-                          struct cl_page *page, pgoff_t index);
 int   lov_page_init_empty (const struct lu_env *env, struct cl_object *obj,
                           struct cl_page *page, pgoff_t index);
 int   lov_page_init_composite(const struct lu_env *env, struct cl_object *obj,
@@ -635,7 +636,6 @@ struct lu_object *lovsub_object_alloc(const struct lu_env *env,
                                       const struct lu_object_header *hdr,
                                       struct lu_device *dev);
 
-struct lov_stripe_md *lov_lsm_addref(struct lov_object *lov);
 int lov_page_stripe(const struct cl_page *page);
 bool lov_page_is_empty(const struct cl_page *page);
 int lov_lsm_entry(const struct lov_stripe_md *lsm, __u64 offset);