Whamcloud - gitweb
EX-7601 vvp: remove unaligned write restriction
authorPatrick Farrell <pfarrell@whamcloud.com>
Fri, 3 Nov 2023 16:29:58 +0000 (12:29 -0400)
committerAndreas Dilger <adilger@whamcloud.com>
Fri, 29 Dec 2023 11:02:54 +0000 (11:02 +0000)
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 <pfarrell@whamcloud.com>
Change-Id: I4abcbdcd18b00718099483c8dfdb9a7aa41c3ce7
Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/52981
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Artem Blagodarenko <ablagodarenko@ddn.com>
lustre/llite/vvp_io.c
lustre/tests/sanity.sh

index d76e45b..ed543b0 100644 (file)
@@ -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. */
index c25a54d..adb0919 100755 (executable)
@@ -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