Whamcloud - gitweb
LU-15011 lod: count all spilling events
authorAlex Zhuravlev <bzzz@whamcloud.com>
Tue, 20 Jul 2021 13:30:24 +0000 (16:30 +0300)
committerAndreas Dilger <adilger@whamcloud.com>
Fri, 15 Oct 2021 17:20:08 +0000 (17:20 +0000)
when target pool is used to as the original has no enough space.
lctl lod.*.pool.<poolname>.spill_hit can be used to get the counter.

Lustre-change: https://review.whamcloud.com/44947
Lustre-commit: TBD (from 6348594defc0b1a414b45abe309a8a18b1da303e)

Signed-off-by: Alex Zhuravlev <bzzz@whamcloud.com>
Change-Id: I6d54a2b910705da182b5f4118e535d196cdab004
Reviewed-by: Mike Pershin <mpershin@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/44948
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/lod/lod_internal.h
lustre/lod/lod_pool.c
lustre/lod/lproc_lod.c
lustre/tests/ost-pools.sh

index efa0000..b6c2d4a 100644 (file)
@@ -68,6 +68,7 @@ struct pool_desc {
        struct proc_dir_entry   *pool_spill_proc_entry;
        bool                     pool_spill_is_active;
        unsigned int             pool_spill_threshold_pct;
+       atomic_t                 pool_spill_hit;
        char                     pool_spill_target[LOV_MAXPOOLNAME + 1];
 };
 
index 286232a..700cdbc 100644 (file)
@@ -411,6 +411,7 @@ int lod_pool_new(struct obd_device *obd, char *poolname)
        new_pool->pool_spill_is_active = false;
        new_pool->pool_spill_threshold_pct = 0;
        new_pool->pool_spill_target[0] = '\0';
+       atomic_set(&new_pool->pool_spill_hit, 0);
        new_pool->pool_lobd = obd;
        atomic_set(&new_pool->pool_refcount, 1);
        rc = tgt_pool_init(&new_pool->pool_obds, 0);
@@ -799,6 +800,7 @@ repeat:
                              lod2obd(lod)->obd_name, LOD_SPILL_MAX,
                              *poolname, pool->pool_spill_target);
                lod_set_pool(poolname, pool->pool_spill_target);
+               atomic_inc(&pool->pool_spill_hit);
                lod_pool_putref(pool);
                if (replaced >= LOD_SPILL_MAX)
                        return;
index 47f8084..b9747b6 100644 (file)
@@ -1147,6 +1147,16 @@ static int lod_spill_is_active_seq_show(struct seq_file *m, void *v)
 }
 LPROC_SEQ_FOPS_RO(lod_spill_is_active);
 
+static int lod_spill_hit_seq_show(struct seq_file *m, void *v)
+{
+       struct pool_desc  *pool = m->private;
+
+       LASSERT(pool != NULL);
+       seq_printf(m, "%d\n", atomic_read(&pool->pool_spill_hit));
+       return 0;
+}
+LPROC_SEQ_FOPS_RO(lod_spill_hit);
+
 struct lprocfs_vars lprocfs_lod_spill_vars[] = {
        { .name =       "spill_threshold_pct",
          .fops =       &lod_spill_threshold_pct_fops },
@@ -1154,6 +1164,8 @@ struct lprocfs_vars lprocfs_lod_spill_vars[] = {
          .fops =       &lod_spill_target_fops },
        { .name =       "spill_is_active",
          .fops =       &lod_spill_is_active_fops },
+       { .name =       "spill_hit",
+         .fops =       &lod_spill_hit_fops },
        { NULL }
 };
 
index a76353a..4c7e3d5 100755 (executable)
@@ -1600,17 +1600,18 @@ function fill_ost_pool() {
 test_29() {
        local pool1=${TESTNAME}-1
        local pool2=${TESTNAME}-2
-       local mdts=$(comma_list $(mdts_nodes))
        local threshold=10
-       local prefix="lod.$FSNAME-MDT*.pool.$pool1"
+       local prefix="lod.$FSNAME-MDT0000*.pool.$pool1"
        local cmd="$LCTL get_param -n $prefix"
+       local before
+       local after
 
        [[ $MDS1_VERSION -lt $(version_code 2.14.0.7) ]] &&
                skip "Need MDS version at least 2.14.0.7"
        [ $OSTCOUNT -lt 4 ] && skip "needs >= 4 OSTs"
        check_set_fallocate_or_skip
 
-       mkdir -p $DIR/$tdir
+       mkdir_on_mdt0 $DIR/$tdir
        stack_trap "rm -rf $DIR/$tdir"
 
        pool_add $pool1 || error "Pool creation failed"
@@ -1619,14 +1620,15 @@ test_29() {
        pool_add $pool2 || error "Pool creation failed"
        pool_add_targets $pool2 2 3 || error "pool_add_targets failed"
 
-       do_nodes $mdts $LCTL set_param $prefix.spill_target="$pool2"
-       do_nodes $mdts $LCTL set_param $prefix.spill_threshold_pct="$threshold"
-       stack_trap "do_nodes $mdts $LCTL set_param $prefix.spill_threshold_pct=0"
+       do_facet mds1 $LCTL set_param $prefix.spill_target=$pool2
+       do_facet mds1 $LCTL set_param $prefix.spill_threshold_pct="$threshold"
+       stack_trap "do_facet mds1 $LCTL set_param $prefix.spill_threshold_pct=0"
 
-       [[ $(do_facet mds1 "$cmd.spill_target" | uniq) == "$pool2" ]] ||
+       [[ $(do_facet mds1 "$cmd.spill_target") == "$pool2" ]] ||
                error "spill target wasn't set"
-       [[ $(do_facet mds1 "$cmd.spill_threshold_pct" | uniq) == "$threshold" ]] ||
+       [[ $(do_facet mds1 "$cmd.spill_threshold_pct") == "$threshold" ]] ||
                error "spill threshold wasn't set"
+       before=$(do_facet mds1 "$cmd.spill_hit")
        lfs_df -p $pool1 | grep summary
        fill_ost_pool $pool1 $threshold
        cancel_lru_locks osc
@@ -1642,6 +1644,9 @@ test_29() {
                $LFS getstripe $DIR/$tdir/$tfile-2
                error "old pool on $tfile-2"
        }
+       after=$(do_facet mds1 "$cmd.spill_hit")
+       (( after == before + 1 )) || error "after $after != before $before + 1"
+
        # when striping is specified explicitly
        $LFS setstripe -p $pool1 $DIR/$tdir/$tfile-3 || error "can't setstripe"
        touch $DIR/$tdir/$tfile-3
@@ -1649,9 +1654,11 @@ test_29() {
                $LFS getstripe $DIR/$tdir/$tfile-3
                error "old pool on $tfile-3"
        }
+       after=$(do_facet mds1 "$cmd.spill_hit")
+       (( after == before + 2 )) || error "after $after != before $before + 2"
 
        # spill is revalidated at object creation
-       wait_update_facet mds1 "$cmd.spill_is_active | uniq" "1" ||
+       wait_update_facet mds1 "$cmd.spill_is_active" "1" ||
                error "spilling is still inactive"
 
        rm -f $DIR/$tdir/$tfile* || error "can't rm $DIR/$tfile*"
@@ -1665,18 +1672,17 @@ test_29() {
                error "new pool != $pool1"
        }
        # spill is revaluated at object creation
-       wait_update_facet mds1 "$cmd.spill_is_active | uniq" "0" ||
+       wait_update_facet mds1 "$cmd.spill_is_active" "0" ||
                error "spilling is still active"
 
-       do_nodes $mdts $LCTL set_param $prefix.spill_threshold_pct=0
-       [[ $(do_facet mds1 "$cmd.spill_threshold_pct" | uniq) == "0" ]] ||
+       do_facet mds1 $LCTL set_param $prefix.spill_threshold_pct=0
+       [[ $(do_facet mds1 "$cmd.spill_threshold_pct") == "0" ]] ||
                error "spill threshold wasn't reset"
 }
 run_test 29 "check OST pool spilling"
 
 test_30() {
        local MDT_DEV=$(mdsdevname 1)
-       local mdts=$(comma_list $(mdts_nodes))
        local pool1=${TESTNAME}-1
        local pool2=${TESTNAME}-2
        local threshold=10