Whamcloud - gitweb
LU-16335 test: add fail_abort_cleanup()
[fs/lustre-release.git] / lustre / lov / lov_offset.c
index 0c9d668..86d4ae9 100644 (file)
@@ -27,7 +27,6 @@
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
  */
 
 #define DEBUG_SUBSYSTEM S_LOV
@@ -38,7 +37,7 @@
 
 #include "lov_internal.h"
 
-static loff_t stripe_width(struct lov_stripe_md *lsm, unsigned int index)
+loff_t stripe_width(struct lov_stripe_md *lsm, unsigned int index)
 {
        struct lov_stripe_md_entry *entry = lsm->lsm_entries[index];
 
@@ -238,7 +237,7 @@ loff_t lov_size_to_stripe(struct lov_stripe_md *lsm, int index, u64 file_size,
  * that is contained within the lov extent.  this returns true if the given
  * stripe does intersect with the lov extent.
  *
- * Closed interval [@obd_start, @obd_end] will be returned.
+ * Closed interval [@obd_start, @obd_end] will be returned if caller needs them.
  */
 int lov_stripe_intersects(struct lov_stripe_md *lsm, int index, int stripeno,
                          struct lu_extent *ext, u64 *obd_start, u64 *obd_end)
@@ -246,10 +245,16 @@ int lov_stripe_intersects(struct lov_stripe_md *lsm, int index, int stripeno,
        struct lov_stripe_md_entry *entry = lsm->lsm_entries[index];
        u64 start, end;
        int start_side, end_side;
+       u64 loc_start, loc_end;
 
        if (!lu_extent_is_overlapped(ext, &entry->lsme_extent))
                        return 0;
 
+       if (!obd_start)
+               obd_start = &loc_start;
+       if (!obd_end)
+               obd_end = &loc_end;
+
        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)