]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
raid5-cache: add another check conditon before replaying one stripe
authorZhengyuan Liu <liuzhengyuan@kylinos.cn>
Sat, 26 Nov 2016 02:57:13 +0000 (10:57 +0800)
committerShaohua Li <shli@fb.com>
Tue, 29 Nov 2016 19:56:20 +0000 (11:56 -0800)
New stripe that was just allocated has no STRIPE_R5C_CACHING state too,
add this check condition could avoid unnecessary replaying for empty stripe.

r5l_recovery_replay_one_stripe would reset stripe for any case, delete it
to make code more clean.

Signed-off-by: Zhengyuan Liu <liuzhengyuan@kylinos.cn>
Signed-off-by: Shaohua Li <shli@fb.com>
drivers/md/raid5-cache.c

index 874749dc7648a7162c48c3cefabf34a5ed4575ce..1ff3859bbcc3c9a76124ed6ff9a6e6cd20ae0838 100644 (file)
@@ -1887,9 +1887,9 @@ r5c_recovery_analyze_meta_block(struct r5l_log *log,
                }
 
                if (payload->header.type == R5LOG_PAYLOAD_DATA) {
-                       if (!test_bit(STRIPE_R5C_CACHING, &sh->state)) {
+                       if (!test_bit(STRIPE_R5C_CACHING, &sh->state) &&
+                           test_bit(R5_Wantwrite, &sh->dev[sh->pd_idx].flags)) {
                                r5l_recovery_replay_one_stripe(conf, sh, ctx);
-                               r5l_recovery_reset_stripe(sh);
                                sh->log_start = ctx->pos;
                                list_move_tail(&sh->lru, cached_stripe_list);
                        }