io->ci_need_write_intent = 0;
- LASSERT(io->ci_type == CIT_WRITE ||
+ LASSERT(io->ci_type == CIT_WRITE || cl_io_is_fallocate(io) ||
cl_io_is_trunc(io) || cl_io_is_mkwrite(io));
CDEBUG(D_VFSTRACE, DFID" write layout, type %u "DEXT"\n",
/* check if it needs to instantiate layout */
if (!(io->ci_type == CIT_WRITE || cl_io_is_mkwrite(io) ||
+ cl_io_is_fallocate(io) ||
(cl_io_is_trunc(io) && io->u.ci_setattr.sa_attr.lvb_size > 0)))
GOTO(out, result = 0);
[ $OST1_VERSION -lt $(version_code 2.13.50) ] &&
skip "Need OST version at least 2.13.53"
- $LFS setstripe -c $OSTCOUNT -S1M $DIR/$tdir || error "setstripe failed"
- fallocate -l ${OSTCOUNT}m $DIR/$tdir || error "fallocate failed"
+ $LFS setstripe -c $OSTCOUNT -S1M $DIR/$tfile || error "setstripe failed"
+ fallocate -l ${OSTCOUNT}m $DIR/$tfile || error "fallocate failed"
sync; sync_all_data
cancel_lru_locks $OSC
sleep 5
- bytes=$(($(stat -c '%b * %B' $DIR/$tdir)))
+ bytes=$(($(stat -c '%b * %B' $DIR/$tfile)))
want=$((OSTCOUNT * 1048576))
# Must allocate all requested space, not more than 5% extra
(( $bytes >= $want && $bytes < $want * 105 / 100 )) ||
error "bytes $bytes is not $want"
+
+ rm -f $DIR/$tfile
+ # verify fallocate on PFL file
+ $LFS setstripe -E1M -c1 -E16M -c3 -Eeof -c 4 $DIR/$tfile ||
+ error "Create $DIR/$tfile failed"
+ fallocate -l $((1048576 * 1024)) $DIR/$tfile ||
+ error "fallocate failed"
+ sync; sync_all_data
+ cancel_lru_locks $OSC
+ sleep 5
+ bytes=$(($(stat -c '%b * %B' $DIR/$tfile)))
+ want=$((1024 * 1048576))
+
+ # Must allocate all requested space, not more than 5% extra
+ (( $bytes >= $want && $bytes < $want * 105 / 100 )) ||
+ error "bytes $bytes is not $want"
}
run_test 150c "Verify fallocate Size and Blocks"