From 2d3d4525b1ac6697b5df207400801c4399d20378 Mon Sep 17 00:00:00 2001 From: Fan Yong Date: Sun, 28 Sep 2014 20:34:42 +0800 Subject: [PATCH] LU-1453 scrub: rename confused name full_scrub_speed Such name means if the rate of auto detected inconsistent OI mappings exceeds the specified threshold, then trigger OI scrub to scan the whole device. To avoid confusion, rename it as full_scrub_threshold_rate. Signed-off-by: Fan Yong Change-Id: I331fcd60c01828f5b689f4d1dc4601f38c3e9cf4 Reviewed-on: http://review.whamcloud.com/12958 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Lai Siyao Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin --- lustre/osd-ldiskfs/osd_handler.c | 2 +- lustre/osd-ldiskfs/osd_internal.h | 8 ++++---- lustre/osd-ldiskfs/osd_lproc.c | 18 ++++++++++-------- lustre/osd-ldiskfs/osd_scrub.c | 3 ++- lustre/tests/sanity-scrub.sh | 33 +++++++++++++-------------------- 5 files changed, 30 insertions(+), 34 deletions(-) diff --git a/lustre/osd-ldiskfs/osd_handler.c b/lustre/osd-ldiskfs/osd_handler.c index 46affb5..0d27665 100644 --- a/lustre/osd-ldiskfs/osd_handler.c +++ b/lustre/osd-ldiskfs/osd_handler.c @@ -6064,7 +6064,7 @@ static int osd_device_init0(const struct lu_env *env, o->od_is_ost = 1; o->od_full_scrub_ratio = OFSR_DEFAULT; - o->od_full_scrub_speed = FULL_SCRUB_SPEED_DEFULT; + o->od_full_scrub_threshold_rate = FULL_SCRUB_THRESHOLD_RATE_DEFAULT; rc = osd_mount(env, o, cfg); if (rc != 0) GOTO(out_capa, rc); diff --git a/lustre/osd-ldiskfs/osd_internal.h b/lustre/osd-ldiskfs/osd_internal.h index f229d58..f4b03f8 100644 --- a/lustre/osd-ldiskfs/osd_internal.h +++ b/lustre/osd-ldiskfs/osd_internal.h @@ -284,9 +284,9 @@ struct osd_device { * OI scrub to scan the whole the device. */ __u64 od_full_scrub_ratio; /* If the speed of found bad OI mappings (per minute) - * exceeds the osd_device::od_full_scrub_speed, then - * trigger OI scrub to scan the whole the device. */ - __u64 od_full_scrub_speed; + * exceeds the osd_device::od_full_scrub_threshold_rate, + * then trigger OI scrub to scan the whole device. */ + __u64 od_full_scrub_threshold_rate; }; enum osd_full_scrub_ratio { @@ -301,7 +301,7 @@ enum osd_full_scrub_ratio { OFSR_DEFAULT = 10000, }; -#define FULL_SCRUB_SPEED_DEFULT 60 +#define FULL_SCRUB_THRESHOLD_RATE_DEFAULT 60 /* There are at most 10 uid/gids are affected in a transaction, and * that's rename case: diff --git a/lustre/osd-ldiskfs/osd_lproc.c b/lustre/osd-ldiskfs/osd_lproc.c index 32ef15f..c02af7a 100644 --- a/lustre/osd-ldiskfs/osd_lproc.c +++ b/lustre/osd-ldiskfs/osd_lproc.c @@ -439,7 +439,8 @@ ldiskfs_osd_full_scrub_ratio_seq_write(struct file *file, const char *buffer, } LPROC_SEQ_FOPS(ldiskfs_osd_full_scrub_ratio); -static int ldiskfs_osd_full_scrub_speed_seq_show(struct seq_file *m, void *data) +static int ldiskfs_osd_full_scrub_threshold_rate_seq_show(struct seq_file *m, + void *data) { struct osd_device *dev = osd_dt_dev((struct dt_device *)m->private); @@ -448,12 +449,13 @@ static int ldiskfs_osd_full_scrub_speed_seq_show(struct seq_file *m, void *data) return -EINPROGRESS; return seq_printf(m, LPU64" (bad OI mappings/minute)\n", - dev->od_full_scrub_speed); + dev->od_full_scrub_threshold_rate); } static ssize_t -ldiskfs_osd_full_scrub_speed_seq_write(struct file *file, const char *buffer, - size_t count, loff_t *off) +ldiskfs_osd_full_scrub_threshold_rate_seq_write(struct file *file, + const char *buffer, + size_t count, loff_t *off) { struct seq_file *m = file->private_data; struct dt_device *dt = m->private; @@ -471,10 +473,10 @@ ldiskfs_osd_full_scrub_speed_seq_write(struct file *file, const char *buffer, if (val < 0) return -EINVAL; - dev->od_full_scrub_speed = val; + dev->od_full_scrub_threshold_rate = val; return count; } -LPROC_SEQ_FOPS(ldiskfs_osd_full_scrub_speed); +LPROC_SEQ_FOPS(ldiskfs_osd_full_scrub_threshold_rate); static int ldiskfs_osd_track_declares_assert_seq_show(struct seq_file *m, void *data) @@ -613,8 +615,8 @@ struct lprocfs_seq_vars lprocfs_osd_obd_vars[] = { .fops = &ldiskfs_osd_auto_scrub_fops }, { .name = "full_scrub_ratio", .fops = &ldiskfs_osd_full_scrub_ratio_fops }, - { .name = "full_scrub_speed", - .fops = &ldiskfs_osd_full_scrub_speed_fops }, + { .name = "full_scrub_threshold_rate", + .fops = &ldiskfs_osd_full_scrub_threshold_rate_fops }, { .name = "oi_scrub", .fops = &ldiskfs_osd_oi_scrub_fops }, { .name = "read_cache_enable", diff --git a/lustre/osd-ldiskfs/osd_scrub.c b/lustre/osd-ldiskfs/osd_scrub.c index c95046d..fdfab11 100644 --- a/lustre/osd-ldiskfs/osd_scrub.c +++ b/lustre/osd-ldiskfs/osd_scrub.c @@ -2772,7 +2772,8 @@ int osd_oii_insert(struct osd_device *dev, struct osd_idmap_cache *oic, } scrub->os_bad_oimap_time = now; - if (++scrub->os_bad_oimap_count > dev->od_full_scrub_speed) + if (++scrub->os_bad_oimap_count > + dev->od_full_scrub_threshold_rate) scrub->os_full_scrub = 1; } diff --git a/lustre/tests/sanity-scrub.sh b/lustre/tests/sanity-scrub.sh index 79e1437..bc9266a 100644 --- a/lustre/tests/sanity-scrub.sh +++ b/lustre/tests/sanity-scrub.sh @@ -284,12 +284,8 @@ scrub_backup_restore() { } scrub_enable_auto() { - local n - - for n in $(seq $MDSCOUNT); do - do_facet mds$n $LCTL set_param -n \ - osd-ldiskfs.$(facet_svc mds$n).auto_scrub 1 - done + do_nodes $(comma_list $(mdts_nodes)) $LCTL set_param -n \ + osd-ldiskfs.*.auto_scrub=1 } full_scrub_ratio() { @@ -297,22 +293,19 @@ full_scrub_ratio() { return local ratio=$1 - local n - for n in $(seq $MDSCOUNT); do - do_facet mds$n $LCTL set_param -n \ - osd-ldiskfs.$(facet_svc mds$n).full_scrub_ratio $ratio - done + do_nodes $(comma_list $(mdts_nodes)) $LCTL set_param -n \ + osd-ldiskfs.*.full_scrub_ratio=$ratio } -full_scrub_speed() { - local speed=$1 - local n +full_scrub_threshold_rate() { + [[ $(lustre_version_code $SINGLEMDS) -le $(version_code 2.6.50) ]] && + return - for n in $(seq $MDSCOUNT); do - do_facet mds$n $LCTL set_param -n \ - osd-ldiskfs.$(facet_svc mds$n).full_scrub_speed $speed - done + local rate=$1 + + do_nodes $(comma_list $(mdts_nodes)) $LCTL set_param -n \ + osd-ldiskfs.*.full_scrub_threshold_rate=$rate } test_0() { @@ -455,7 +448,7 @@ test_4b() { mount_client $MOUNT || error "(5) Fail to start client!" scrub_enable_auto full_scrub_ratio 10 - full_scrub_speed 10000 + full_scrub_threshold_rate 10000 scrub_check_data 6 sleep 3 @@ -521,7 +514,7 @@ test_4c() { mount_client $MOUNT || error "(5) Fail to start client!" scrub_enable_auto full_scrub_ratio 2 - full_scrub_speed 20 + full_scrub_threshold_rate 20 scrub_check_data 6 sleep 3 -- 1.8.3.1