Whamcloud - gitweb
LU-12367 llite: Fix page count for unaligned reads 15/35015/7
authorPatrick Farrell <pfarrell@whamcloud.com>
Fri, 31 May 2019 23:52:31 +0000 (19:52 -0400)
committerOleg Drokin <green@whamcloud.com>
Sat, 7 Sep 2019 01:51:38 +0000 (01:51 +0000)
When a read is unaligned on both the first and last page,
the calculation used to determine count of pages for
readahead misses that we access both of those pages.

Increase the calculated count by 1 in this case.

This case is covered by the generic readahead tests added
in LU-12645.

Signed-off-by: Patrick Farrell <pfarrell@whamcloud.com>
Change-Id: Idb28d300a232026a9d916d010ee8ebf209283242
Reviewed-on: https://review.whamcloud.com/35015
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Wang Shilong <wshilong@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/llite/vvp_io.c
lustre/tests/sanity.sh

index 2c0157f..ead8099 100644 (file)
@@ -817,6 +817,13 @@ static int vvp_io_read_start(const struct lu_env *env,
                vio->vui_ra_valid = true;
                vio->vui_ra_start = cl_index(obj, pos);
                vio->vui_ra_count = cl_index(obj, tot + PAGE_SIZE - 1);
+               /* If both start and end are unaligned, we read one more page
+                * than the index math suggests. */
+               if (pos % PAGE_SIZE != 0 && (pos + tot) % PAGE_SIZE != 0)
+                       vio->vui_ra_count++;
+
+               CDEBUG(D_READA, "tot %ld, ra_start %lu, ra_count %lu\n", tot,
+                      vio->vui_ra_start, vio->vui_ra_count);
        }
 
        /* BUG: 5972 */
index dffdca6..3924119 100644 (file)
@@ -8465,12 +8465,14 @@ test_101c() {
        cancel_lru_locks osc
        $LCTL set_param osc.*.rpc_stats 0
        $READS -f $DIR/$tfile -s$FILE_LENGTH -b$rsize -n$nreads -t 180
+       $LCTL get_param osc.*.rpc_stats
        for osc_rpc_stats in $($LCTL get_param -N osc.*.rpc_stats); do
                local stats=$($LCTL get_param -n $osc_rpc_stats)
                local lines=$(echo "$stats" | awk 'END {print NR;}')
                local size
 
                if [ $lines -le 20 ]; then
+                       echo "continue debug"
                        continue
                fi
                for size in 1 2 4 8; do