lov_stripe_intersects() will return a closed interval
[@obd_start, @obd_end], so to calcuate length of interval we need
@obd_end - @obd_start + 1
rather than
@obd_end - @obd_start
Wrong extent length will make us return wrong fiemap information.
Change-Id: I30deb17cf5fa80a6d3046098fbac0d3faa01ad1c
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Reviewed-on: https://review.whamcloud.com/34998
Tested-by: Jenkins
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Gu Zheng <gzheng@ddn.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
if (lun_start == lun_end)
return 0;
if (lun_start == lun_end)
return 0;
- req_fm_len = obd_object_end - lun_start;
+ req_fm_len = obd_object_end - lun_start + 1;
fs->fs_fm->fm_length = 0;
len_mapped_single_call = 0;
fs->fs_fm->fm_length = 0;
len_mapped_single_call = 0;
fs->fs_fm->fm_mapped_extents = 1;
fm_ext[0].fe_logical = lun_start;
fs->fs_fm->fm_mapped_extents = 1;
fm_ext[0].fe_logical = lun_start;
- fm_ext[0].fe_length = obd_object_end - lun_start;
+ fm_ext[0].fe_length = obd_object_end - lun_start + 1;
fm_ext[0].fe_flags |= FIEMAP_EXTENT_UNKNOWN;
goto inactive_tgt;
fm_ext[0].fe_flags |= FIEMAP_EXTENT_UNKNOWN;
goto inactive_tgt;
* given an extent in an lov and a stripe, calculate the extent of the stripe
* that is contained within the lov extent. this returns true if the given
* stripe does intersect with the lov extent.
* given an extent in an lov and a stripe, calculate the extent of the stripe
* 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.
*/
int lov_stripe_intersects(struct lov_stripe_md *lsm, int index, int stripeno,
struct lu_extent *ext, u64 *obd_start, u64 *obd_end)
*/
int lov_stripe_intersects(struct lov_stripe_md *lsm, int index, int stripeno,
struct lu_extent *ext, u64 *obd_start, u64 *obd_end)
}
run_test 813 "File heat verfication"
}
run_test 813 "File heat verfication"
+test_814()
+{
+ dd of=$DIR/$tfile seek=128 bs=1k < /dev/null
+ echo -n y >> $DIR/$tfile
+ cp --sparse=always $DIR/$tfile $DIR/${tfile}.cp || error "copy failed"
+ diff $DIR/$tfile $DIR/${tfile}.cp || error "files should be same"
+}
+run_test 814 "sparse cp works as expected (LU-12361)"
+
#
# tests that do cleanup/setup should be run at the end
#
#
# tests that do cleanup/setup should be run at the end
#