Whamcloud - gitweb
LU-13799 lov: Cache stripe offset calculation
[fs/lustre-release.git] / lustre / lov / lov_cl_internal.h
index 3a112da..9563315 100644 (file)
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
  *
  * Internal interfaces of LOV layer.
  *
@@ -151,7 +149,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;
@@ -226,6 +225,7 @@ struct lov_layout_dom {
 struct lov_layout_entry {
        __u32                           lle_type;
        unsigned int                    lle_valid:1;
+       unsigned int                    lle_preference;
        struct lu_extent                *lle_extent;
        struct lov_stripe_md_entry      *lle_lsme;
        struct lov_comp_layout_entry_ops *lle_comp_ops;
@@ -237,15 +237,22 @@ struct lov_layout_entry {
 
 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
+       unsigned short  lre_stale:1,    /* set if any components is stale */
+                       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 */
+       int             lre_preference; /* overall preference of this mirror */
+
        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.
  *
@@ -276,10 +283,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.
@@ -444,8 +450,6 @@ struct lov_lock {
 
 struct lov_page {
        struct cl_page_slice    lps_cl;
-       /* the layout gen when this page was created */
-       __u32                   lps_layout_gen;
 };
 
 /*
@@ -515,6 +519,7 @@ struct lov_io_sub {
 /**
  * IO state private for LOV.
  */
+#define LIS_CACHE_ENTRY_NONE   -ENOENT
 struct lov_io {
         /** super-class */
         struct cl_io_slice lis_cl;
@@ -580,7 +585,12 @@ struct lov_io {
         * All sub-io's created in this lov_io.
         */
        struct list_head        lis_subios;
-
+       /* Cached results from stripe & offset calculations for page init */
+       int                     lis_cached_entry;
+       int                     lis_cached_stripe;
+       loff_t                  lis_cached_off;
+       loff_t                  lis_cached_suboff;
+       struct lov_io_sub       *lis_cached_sub;
 };
 
 struct lov_session {