Whamcloud - gitweb
LU-14186 lov: instantiate components layout for fallocate 85/40885/3
authorWang Shilong <wshilong@ddn.com>
Mon, 7 Dec 2020 03:06:08 +0000 (11:06 +0800)
committerOleg Drokin <green@whamcloud.com>
Sun, 13 Dec 2020 08:23:55 +0000 (08:23 +0000)
fallocate() need send intent lock to MDS to instantiate layout
like PFL.

Signed-off-by: Wang Shilong <wshilong@ddn.com>
Change-Id: Ie14574ca0981ea00aa1867489d2a40b75eb511cc
Reviewed-on: https://review.whamcloud.com/40885
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Yingjin Qian <qian@ddn.com>
Reviewed-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Tested-by: Maloo <maloo@whamcloud.com>
lustre/llite/vvp_io.c
lustre/lov/lov_io.c
lustre/tests/sanity.sh

index 7099633..fc7872e 100644 (file)
@@ -367,7 +367,7 @@ static void vvp_io_fini(const struct lu_env *env, const struct cl_io_slice *ios)
 
                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",
index 0724043..f20c8f4 100644 (file)
@@ -578,6 +578,7 @@ static int lov_io_slice_init(struct lov_io *lio,
 
        /* 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);
 
index 66c2903..a590831 100755 (executable)
@@ -13433,17 +13433,33 @@ test_150c() {
        [ $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"