Whamcloud - gitweb
LU-5 readdir read multiple pages per rpc
[fs/lustre-release.git] / lustre / tests / sanity.sh
index 9d7e7b6..a46297c 100644 (file)
@@ -784,6 +784,10 @@ test_24u() { # bug12192
 }
 run_test 24u "create stripe file"
 
+page_size() {
+       getconf PAGE_SIZE
+}
+
 test_24v() {
        local NRFILES=100000
        local FREE_INODES=`lfs df -i|grep "filesystem summary" | awk '{print $5}'`
@@ -793,8 +797,26 @@ test_24v() {
 
        mkdir -p $DIR/d24v
        createmany -m $DIR/d24v/$tfile $NRFILES
+
+       cancel_lru_locks mdc
+       lctl set_param mdc.*.stats clear
+
        ls $DIR/d24v >/dev/null || error "error in listing large dir"
 
+       # LU-5 large readdir
+       # DIRENT_SIZE = 32 bytes for sizeof(struct lu_dirent) +
+       #               8 bytes for name(filename is mostly 5 in this test) +
+       #               8 bytes for luda_type
+       # take into account of overhead in lu_dirpage header and end mark in
+       # each page, plus one in RPC_NUM calculation.
+       DIRENT_SIZE=48
+       RPC_SIZE=$(($(lctl get_param -n mdc.*.max_pages_per_rpc)*$(page_size)))
+       RPC_NUM=$(((NRFILES * DIRENT_SIZE + RPC_SIZE - 1) / RPC_SIZE + 1))
+       mds_readpage=`lctl get_param mdc.*.stats | \
+                               awk '/^mds_readpage/ {print $2}'`
+       [ $mds_readpage -gt $RPC_NUM ] && \
+               error "large readdir doesn't take effect"
+
        rm $DIR/d24v -rf
 }
 run_test 24v "list directory with large files (handle hash collision, bug: 17560)"
@@ -2614,10 +2636,6 @@ test_42d() {
 }
 run_test 42d "test complete truncate of file with cached dirty data"
 
-page_size() {
-       getconf PAGE_SIZE
-}
-
 test_42e() { # bug22074
        local TDIR=$DIR/${tdir}e
        local pagesz=$(page_size)