ore/exofs: Define new ore_verify_layout
[profile/ivi/kernel-adaptation-intel-automotive.git] / include / scsi / osd_ore.h
index baeef02..716dbea 100644 (file)
@@ -42,6 +42,13 @@ struct ore_layout {
        unsigned group_width;
        u64      group_depth;
        unsigned group_count;
+
+       /* Cached often needed calculations filled in by
+        * ore_verify_layout
+        */
+       unsigned long max_io_length;    /* Max length that should be passed to
+                                        * ore_get_rw_state
+                                        */
 };
 
 struct ore_dev {
@@ -49,6 +56,7 @@ struct ore_dev {
 };
 
 struct ore_components {
+       unsigned        first_dev;              /* First logical device no    */
        unsigned        numdevs;                /* Num of devices in array    */
        /* If @single_comp == EC_SINGLE_COMP, @comps points to a single
         * component. else there are @numdevs components
@@ -70,14 +78,14 @@ struct ore_components {
 static inline struct osd_dev *ore_comp_dev(
        const struct ore_components *oc, unsigned i)
 {
-       BUG_ON(oc->numdevs <= i);
-       return oc->ods[i]->od;
+       BUG_ON((i < oc->first_dev) || (oc->first_dev + oc->numdevs <= i));
+       return oc->ods[i - oc->first_dev]->od;
 }
 
 static inline void ore_comp_set_dev(
        struct ore_components *oc, unsigned i, struct osd_dev *od)
 {
-       oc->ods[i]->od = od;
+       oc->ods[i - oc->first_dev]->od = od;
 }
 
 struct ore_striping_info {
@@ -137,6 +145,7 @@ static inline unsigned ore_io_state_size(unsigned numdevs)
 }
 
 /* ore.c */
+int ore_verify_layout(unsigned total_comps, struct ore_layout *layout);
 int ore_get_rw_state(struct ore_layout *layout, struct ore_components *comps,
                     bool is_reading, u64 offset, u64 length,
                     struct ore_io_state **ios);