- int start_side, end_side;
-
- start_side = lov_stripe_offset(lsm, start, stripeno, obd_start);
- end_side = lov_stripe_offset(lsm, end, stripeno, obd_end);
-
- CDEBUG(D_INODE, "["LPU64"->"LPU64"] -> [(%d) "LPU64"->"LPU64" (%d)]\n",
- start, end, start_side, *obd_start, *obd_end, end_side);
-
- /* this stripe doesn't intersect the file extent when neither
- * start or the end intersected the stripe and obd_start and
- * obd_end got rounded up to the save value. */
- if (start_side != 0 && end_side != 0 && *obd_start == *obd_end)
- return 0;
-
- /* as mentioned in the lov_stripe_offset commentary, end
- * might have been shifted in the wrong direction. This
- * happens when an end offset is before the stripe when viewed
- * through the "mod stripe size" math. we detect it being shifted
- * in the wrong direction and touch it up.
- * interestingly, this can't underflow since end must be > start
- * if we passed through the previous check.
- * (should we assert for that somewhere?) */
- if (end_side != 0)
- (*obd_end)--;
-
- return 1;
+ struct lov_stripe_md_entry *entry = lsm->lsm_entries[index];
+ u64 start, end;
+ int start_side, end_side;
+
+ if (!lu_extent_is_overlapped(ext, &entry->lsme_extent))
+ return 0;
+
+ start = max_t(__u64, ext->e_start, entry->lsme_extent.e_start);
+ end = min_t(__u64, ext->e_end, entry->lsme_extent.e_end);
+ if (end != OBD_OBJECT_EOF)
+ end--;
+
+ start_side = lov_stripe_offset(lsm, index, start, stripeno, obd_start);
+ end_side = lov_stripe_offset(lsm, index, end, stripeno, obd_end);
+
+ CDEBUG(D_INODE, "[%lld->%lld] -> [(%d) %lld->%lld (%d)]\n",
+ start, end, start_side, *obd_start, *obd_end, end_side);
+
+ /*
+ * this stripe doesn't intersect the file extent when neither
+ * start or the end intersected the stripe and obd_start and
+ * obd_end got rounded up to the save value.
+ */
+ if (start_side != 0 && end_side != 0 && *obd_start == *obd_end)
+ return 0;
+
+ /*
+ * as mentioned in the lov_stripe_offset commentary, end
+ * might have been shifted in the wrong direction. This
+ * happens when an end offset is before the stripe when viewed
+ * through the "mod stripe size" math. we detect it being shifted
+ * in the wrong direction and touch it up.
+ * interestingly, this can't underflow since end must be > start
+ * if we passed through the previous check.
+ * (should we assert for that somewhere?)
+ */
+ if (end_side != 0)
+ (*obd_end)--;
+
+ return 1;