From 5c2d8aa7daa18b9c709c96a5bec7518a7a849550 Mon Sep 17 00:00:00 2001 From: Patrick Farrell Date: Fri, 3 Nov 2023 12:29:58 -0400 Subject: [PATCH] EX-7601 vvp: remove unaligned write restriction This series will resolve the unaligned write issue for compressed files, so we need to remove the restriction on unaligned writes in order to test it. This does not mean unaligned writes are working yet, but we need to make this change so the subsequent patches can be tested. Signed-off-by: Patrick Farrell Change-Id: I4abcbdcd18b00718099483c8dfdb9a7aa41c3ce7 Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/52981 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Artem Blagodarenko --- lustre/llite/vvp_io.c | 23 ----------------------- lustre/tests/sanity.sh | 12 ++++-------- 2 files changed, 4 insertions(+), 31 deletions(-) diff --git a/lustre/llite/vvp_io.c b/lustre/llite/vvp_io.c index d76e45b..ed543b0 100644 --- a/lustre/llite/vvp_io.c +++ b/lustre/llite/vvp_io.c @@ -1315,13 +1315,6 @@ static int vvp_io_write_start(const struct lu_env *env, size_t nob = io->ci_nob; struct iov_iter iter; size_t written = 0; - int chunk_size; - /* this i_size_read() is potentially racy, but it should be mostly - * reliable and this is just a temporary workaround for the compression - * preview - */ - loff_t inode_size = i_size_read(inode); - bool write_beyond_eof = false; ENTRY; @@ -1349,22 +1342,6 @@ static int vvp_io_write_start(const struct lu_env *env, file_dentry(file)->d_name.name, pos, pos + cnt); - if (pos >= inode_size) - write_beyond_eof = true; - - chunk_size = (1 << (io->ci_max_compr_chunk_bits + 16)); - - /* compressed files require chunk-aligned writes for overwrites - * writes at EOF are OK because they do not update existing data - * EX-7601 - */ - if (io->ci_compressed_file && !write_beyond_eof && - (pos % chunk_size || cnt % chunk_size)) { - CERROR("Compression preview requires writes to be chunk size aligned or at EOF, write pos: %llu, bytes: %lu, chunk_size: %d, inode_size %llu\n", - pos, cnt, chunk_size, inode_size); - RETURN(-EINVAL); - } - /* The maximum Lustre file size is variable, based on the OST maximum * object size and number of stripes. This needs another check in * addition to the VFS checks earlier. */ diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index c25a54d..adb0919 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -28370,12 +28370,8 @@ test_460b() { } run_test 460b "Try to compress with wrong algo" -# This test verifies the write restrictions for the preview version related to -# EX-7601, this test will be removed once EX-7601 is resolved -# Restrictions are as follows: -# Chunk aligned writes are always allowed -# Non-chunk-aligned writes are only allowed if they are extending the file, ie, -# if they are not overwriting existing data +# This test for EX-7601 write restrictions is being retained temporarily so we +# can test overwrites in this way - we'll have better tests later test_460c() { (( MDS1_VERSION >= $(version_code 2.14.0.91) )) || skip "Need MDS version at least 2.14.0.91" @@ -28407,11 +28403,11 @@ test_460c() { error "aligned dd to overwrite $stored failed" # Cannot do non-chunk aligned IO when overwriting - dd if=/dev/zero of=$stored bs=37K count=5 conv=notrunc && + dd if=/dev/zero of=$stored bs=37K count=5 conv=notrunc || error "unsafe dd to $stored succeeded" # Cannot do non-chunk aligned IO when overwriting (test larger size) - dd if=/dev/zero of=$stored bs=1025K count=5 conv=notrunc && + dd if=/dev/zero of=$stored bs=1025K count=5 conv=notrunc || error "unsafe dd to $stored succeeded" # Can do non-chunk aligned IO when extending the file -- 1.8.3.1