cur_ext = 0;
/* done all the processing */
- if (entry > end_entry)
+ if (entry > end_entry ||
+ (fs.fs_enough && fs.fs_finish_stripe && entry == end_entry))
fiemap->fm_extents[cur_ext].fe_flags |= FIEMAP_EXTENT_LAST;
/* Indicate that we are returning device offsets unless file just has
touch $DIR/$tdir/d1/tgt" \
"ln $DIR2/$tdir/d1/tgt $DIR2/$tdir/d2/src"
fi
-
+
op_trigger_cos "remote directory create" "$LFS mkdir -i 0 $DIR/$tdir" \
"$LFS mkdir -i 1 $DIR2/$tdir/subdir"
op_trigger_cos "cross-MDT rename" \
}
run_test 71b "check fiemap support for stripecount > 1"
+_check_last_flag_with_filefrag()
+{
+ local file=$1
+ local count=$2
+ local i
+ local offset
+
+ echo "check last flag for file with $count extents"
+ rm -f $file
+ for ((i=0; i<$count; i++)); do
+ offset=$((i * 256))
+ dd if=/dev/zero of=$file bs=4K count=1 seek=$offset 2> /dev/null
+ done
+
+ filefrag -s -v $file | grep "last" ||
+ error "test file with $i extents failed"
+
+ rm -f $file
+}
+
+test_71c() {
+ local file="$DIR1/$tdir/$tfile"
+
+ (( $CLIENT_VERSION >= $(version_code 2.15.57) )) ||
+ skip "Need client version >= 2.15.57"
+ [ $(facet_fstype ost1) = "ldiskfs" ] ||
+ skip "support only ldiskfs ost"
+ filefrag -V | grep wc ||
+ skip "need whamcloud version of e2fsprogs"
+
+ mkdir -p $DIR1/$tdir
+
+ # filefrag uses u64[2028] buffer to fetch fiemap. The number of extents
+ # in the buffer is (8 * 2048 - 32) / 56 = 292. Test file with 291, 292
+ # and 293 extents
+ _check_last_flag_with_filefrag $file 291
+ _check_last_flag_with_filefrag $file 292
+ _check_last_flag_with_filefrag $file 293
+}
+run_test 71c "check FIEMAP_EXTENT_LAST flag with different extents number"
+
test_72() {
local p="$TMP/sanityN-$TESTNAME.parameters"
local tlink1