From 2a52d25028a8c11c478f47d5249034d63f8a1ee7 Mon Sep 17 00:00:00 2001 From: Artem Blagodarenko Date: Fri, 19 May 2023 10:27:36 +0100 Subject: [PATCH] EX-7528 lov: fallocate is not allowed for compressed files Client Side Data Compression allocates blocks after a compression. It is impossible to preallocate blocks for the whole file, so fallocate should be disabled in case of compression. Signed-off-by: Artem Blagodarenko Change-Id: Ie834ace183fdcec0d7d6f747237e0964c3c4120b Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/51059 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Sebastien Buisson Reviewed-by: Vitaliy Kuznetsov --- lustre/lov/lov_io.c | 13 +++++++++++++ lustre/tests/sanity.sh | 13 +++++++++++++ 2 files changed, 26 insertions(+) diff --git a/lustre/lov/lov_io.c b/lustre/lov/lov_io.c index 0137581..0a2bed7 100644 --- a/lustre/lov/lov_io.c +++ b/lustre/lov/lov_io.c @@ -835,6 +835,8 @@ static int lov_io_iter_init(const struct lu_env *env, struct lov_io *lio = cl2lov_io(env, ios); struct lov_stripe_md *lsm = lio->lis_object->lo_lsm; bool is_trunc = cl_io_is_trunc(ios->cis_io); + struct cl_io *parent = ios->cis_io; + struct lov_stripe_md_entry *lsme; struct lov_io_sub *sub; struct lu_extent ext; int index; @@ -842,6 +844,17 @@ static int lov_io_iter_init(const struct lu_env *env, ENTRY; + lsme = lsm->lsm_entries[0]; + /* No support for compressed yet. */ + if (cl_io_is_fallocate(parent) && lsme->lsme_compr_type) { + struct lov_io *lio = cl2lov_io(env, ios); + struct lov_object *loo = lio->lis_object; + + CWARN(DFID " compressed(%i), fallocate is not supported\n", + PFID(lu_object_fid(lov2lu(loo))), lsme->lsme_compr_type); + RETURN(-EOPNOTSUPP); + } + ext.e_start = lio->lis_pos; ext.e_end = lio->lis_endpos; diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index c92e370..65a576c 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -27521,6 +27521,7 @@ compress_type() { local stored=$stored_dir/$orig_short.$t1$l1$c1 local stored2=$TMP/$tdir/$tfile.dec_$orig_short.$t1$l1$c1cpy local decomp1=$TMP/$tdir/$tfile.dec_$orig_short.$t1$l1$c1 + local decomp2=$TMP/$tdir/$tfile.dec_$orig_short.$t1$l1$c1.cp local decomp3=$TMP/$tdir/$tfile.dec_$orig_short.$t1$l1$c1.32.1.5 local decomp4=$TMP/$tdir/$tfile.dec_$orig_short.$t1$l1$c1.32.1.5.orig @@ -27538,12 +27539,21 @@ compress_type() { dd if=$stored of=$decomp1 bs=65536 &>/dev/null || error "dd to $decomp1 failed" + # fiomap case + cp $stored $decomp2 || + error "dd to $decomp2 failed" + size1=$(stat -c %s $orig) size2=$(stat -c %s $decomp1) echo size1: $size1 echo size2: $size2 [ $size1 -eq $size2 ] || error "sizes differ" + size2=$(stat -c %s $decomp2) + echo size2: $size2 + [ $size1 -eq $size2 ] || error "sizes differ" + + blocks1=$(stat -c %b $orig) blocks2=$(stat -c %b $stored) echo blocks1: $blocks1 @@ -27554,6 +27564,9 @@ compress_type() { cmp --verbose $orig $decomp1 || error "decompression failed" + diff $orig $decomp2 || + error "decompression failed" + # Reading starting the 480K offset # on compressed/plain data board dd if=$stored of=$decomp3 \ -- 1.8.3.1