Whamcloud - gitweb
b=13696
authoryury <yury>
Sun, 7 Oct 2007 10:28:03 +0000 (10:28 +0000)
committeryury <yury>
Sun, 7 Oct 2007 10:28:03 +0000 (10:28 +0000)
r=nathan,adilger
- adds "lruresize" and "nolruresize" mount options;
- adds test 124b to check if "lruresize" performs better than "nolruresize".

lustre/llite/llite_internal.h
lustre/llite/llite_lib.c
lustre/tests/sanity.sh

index 4905090..b4c880d 100644 (file)
@@ -238,6 +238,7 @@ enum stats_track_type {
 #define LL_SBI_MDS_CAPA          0x80 /* support mds capa */
 #define LL_SBI_OSS_CAPA         0x100 /* support oss capa */
 #define LL_SBI_LOCALFLOCK       0x200 /* Local flocks support by kernel */
+#define LL_SBI_LRU_RESIZE       0x400 /* lru resize support */
 
 struct ll_sb_info {
         struct list_head          ll_list;
index 6d37983..1cd8000 100644 (file)
@@ -91,6 +91,10 @@ static struct ll_sb_info *ll_init_sbi(void)
         sbi->ll_flags |= LL_SBI_CHECKSUM;
 #endif
 
+#ifdef HAVE_LRU_RESIZE_SUPPORT
+        sbi->ll_flags |= LL_SBI_LRU_RESIZE;
+#endif
+
 #ifdef HAVE_EXPORT___IGET
         INIT_LIST_HEAD(&sbi->ll_deathrow);
         spin_lock_init(&sbi->ll_deathrow_lock);
@@ -199,7 +203,8 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt,
                                   OBD_CONNECT_MDS_CAPA | OBD_CONNECT_OSS_CAPA |
                                   OBD_CONNECT_CANCELSET;
 #ifdef HAVE_LRU_RESIZE_SUPPORT
-        data->ocd_connect_flags |= OBD_CONNECT_LRU_RESIZE;
+        if (sbi->ll_flags & LL_SBI_LRU_RESIZE)
+                data->ocd_connect_flags |= OBD_CONNECT_LRU_RESIZE;
 #endif
 #ifdef CONFIG_FS_POSIX_ACL
         data->ocd_connect_flags |= OBD_CONNECT_ACL;
@@ -848,6 +853,16 @@ static int ll_options(char *options, int *flags)
                         *flags &= ~tmp;
                         goto next;
                 }
+                tmp = ll_set_opt("lruresize", s1, LL_SBI_LRU_RESIZE);
+                if (tmp) {
+                        *flags |= tmp;
+                        goto next;
+                }
+                tmp = ll_set_opt("nolruresize", s1, LL_SBI_LRU_RESIZE);
+                if (tmp) {
+                        *flags &= ~tmp;
+                        goto next;
+                }
 
                 LCONSOLE_ERROR_MSG(0x152, "Unknown option '%s', won't mount.\n",
                                    s1);
index a2d83a3..8fb12c0 100644 (file)
@@ -4546,7 +4546,7 @@ test_121() { #bug #10589
 }
 run_test 121 "read cancel race ========="
 
-test_124() {
+test_124a() {
        [ -z "`grep lru_resize $LPROC/mdc/*/connect_flags`" ] && \
                skip "no lru resize on server" && return 0
         cancel_lru_locks mdc
@@ -4611,7 +4611,53 @@ test_124() {
         log "unlink $NR files at $DIR/$tdir"
         unlinkmany $DIR/$tdir/f $NR
 }
-run_test 124 "lru resize ======================================="
+run_test 124a "lru resize ======================================="
+
+test_124b() {
+       [ -z "`grep lru_resize $LPROC/mdc/*/connect_flags`" ] && \
+               skip "no lru resize on server" && return 0
+        cleanup -f || error "failed to unmount"
+        MOUNTOPT="$MOUNTOPT,nolruresize"
+        setup
+
+        NR=3000
+        mkdir -p $DIR/$tdir || error "failed to create $DIR/$tdir"
+
+        createmany -o $DIR/$tdir/f $NR
+        log "doing ls -la $DIR/$tdir 3 times (lru resize disabled)"
+        stime=`date +%s`
+        ls -la $DIR/$tdir > /dev/null
+        ls -la $DIR/$tdir > /dev/null
+        ls -la $DIR/$tdir > /dev/null
+        etime=`date +%s`
+        nolruresize_delta=$((etime-stime))
+        log "ls -la time: $nolruresize_delta seconds"
+
+        cleanup -f || error "failed to unmount"
+        MOUNTOPT=`echo $MOUNTOPT | sed "s/nolruresize/lruresize/"`
+        setup
+
+        createmany -o $DIR/$tdir/f $NR
+        log "doing ls -la $DIR/$tdir 3 times (lru resize enabled)"
+        stime=`date +%s`
+        ls -la $DIR/$tdir > /dev/null
+        ls -la $DIR/$tdir > /dev/null
+        ls -la $DIR/$tdir > /dev/null
+        etime=`date +%s`
+        lruresize_delta=$((etime-stime))
+        log "ls -la time: $lruresize_delta seconds"
+
+        if test $lruresize_delta -gt $nolruresize_delta; then
+                log "ls -la is $((lruresize_delta - $nolruresize_delta))s slower with lru resize enabled"
+        elif test $nolruresize_delta -gt $lruresize_delta; then
+                log "ls -la is $((nolruresize_delta - $lruresize_delta))s faster with lru resize enabled"
+        else
+                log "lru resize performs the same with no lru resize"
+        fi
+
+        unlinkmany $DIR/$tdir/f $NR
+}
+run_test 124b "lru resize (performance test) ======================="
 
 test_125() { # 13358
        mkdir -p $DIR/d125 || error "mkdir failed"