Whamcloud - gitweb
EX-7601 llite: restrict readahead to eof
authorPatrick Farrell <pfarrell@whamcloud.com>
Tue, 14 Nov 2023 22:58:16 +0000 (17:58 -0500)
committerAndreas Dilger <adilger@whamcloud.com>
Fri, 24 Nov 2023 09:26:19 +0000 (09:26 +0000)
Compressed file readahead rounding needs to come before
readahead is limited to EOF.

Signed-off-by: Patrick Farrell <pfarrell@whamcloud.com>
Change-Id: I4e9e7fe63301c08efcb05f170726735593a9431d
Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/53137
Reviewed-by: Artem Blagodarenko <ablagodarenko@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lustre/llite/rw.c

index 837c9c5..103c100 100644 (file)
@@ -798,6 +798,15 @@ static int ll_readahead(const struct lu_env *env, struct cl_io *io,
            end_idx < vio->vui_ra_start_idx + vio->vui_ra_pages - 1)
                end_idx = vio->vui_ra_start_idx + vio->vui_ra_pages - 1;
 
+       if (io->ci_compressed_file) {
+               pgoff_t old_end_idx = end_idx;
+
+               CDEBUG(D_SEC, "end_idx %lu\n", end_idx);
+               end_idx |= chunk_pages_mask;
+               vio->vui_ra_pages += end_idx - old_end_idx;
+               CDEBUG(D_SEC, "end_idx %lu\n", end_idx);
+       }
+
        if (end_idx != 0) {
                pgoff_t eof_index;
 
@@ -809,15 +818,6 @@ static int ll_readahead(const struct lu_env *env, struct cl_io *io,
                }
        }
 
-       if (io->ci_compressed_file) {
-               pgoff_t old_end_idx = end_idx;
-
-               CDEBUG(D_SEC, "end_idx %lu\n", end_idx);
-               end_idx |= chunk_pages_mask;
-               vio->vui_ra_pages += end_idx - old_end_idx;
-               CDEBUG(D_SEC, "end_idx %lu\n", end_idx);
-       }
-
        ria->ria_start_idx = *start_idx;
        ria->ria_end_idx = end_idx;
        /* If stride I/O mode is detected, get stride window*/