aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/md/raid5.c13
-rw-r--r--drivers/md/raid5.h9
2 files changed, 14 insertions, 8 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 78ac7dc853c7..b7cd32e7f29e 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -672,20 +672,23 @@ get_active_stripe(struct r5conf *conf, sector_t sector,
672 *(conf->hash_locks + hash)); 672 *(conf->hash_locks + hash));
673 sh = __find_stripe(conf, sector, conf->generation - previous); 673 sh = __find_stripe(conf, sector, conf->generation - previous);
674 if (!sh) { 674 if (!sh) {
675 if (!conf->inactive_blocked) 675 if (!test_bit(R5_INACTIVE_BLOCKED, &conf->cache_state))
676 sh = get_free_stripe(conf, hash); 676 sh = get_free_stripe(conf, hash);
677 if (noblock && sh == NULL) 677 if (noblock && sh == NULL)
678 break; 678 break;
679 if (!sh) { 679 if (!sh) {
680 conf->inactive_blocked = 1; 680 set_bit(R5_INACTIVE_BLOCKED,
681 &conf->cache_state);
681 wait_event_lock_irq( 682 wait_event_lock_irq(
682 conf->wait_for_stripe, 683 conf->wait_for_stripe,
683 !list_empty(conf->inactive_list + hash) && 684 !list_empty(conf->inactive_list + hash) &&
684 (atomic_read(&conf->active_stripes) 685 (atomic_read(&conf->active_stripes)
685 < (conf->max_nr_stripes * 3 / 4) 686 < (conf->max_nr_stripes * 3 / 4)
686 || !conf->inactive_blocked), 687 || !test_bit(R5_INACTIVE_BLOCKED,
688 &conf->cache_state)),
687 *(conf->hash_locks + hash)); 689 *(conf->hash_locks + hash));
688 conf->inactive_blocked = 0; 690 clear_bit(R5_INACTIVE_BLOCKED,
691 &conf->cache_state);
689 } else { 692 } else {
690 init_stripe(sh, sector, previous); 693 init_stripe(sh, sector, previous);
691 atomic_inc(&sh->count); 694 atomic_inc(&sh->count);
@@ -4602,7 +4605,7 @@ static int raid5_congested(struct mddev *mddev, int bits)
4602 * how busy the stripe_cache is 4605 * how busy the stripe_cache is
4603 */ 4606 */
4604 4607
4605 if (conf->inactive_blocked) 4608 if (test_bit(R5_INACTIVE_BLOCKED, &conf->cache_state))
4606 return 1; 4609 return 1;
4607 if (conf->quiesce) 4610 if (conf->quiesce)
4608 return 1; 4611 return 1;
diff --git a/drivers/md/raid5.h b/drivers/md/raid5.h
index 6614ac5ffc0e..ebe4e24bc14d 100644
--- a/drivers/md/raid5.h
+++ b/drivers/md/raid5.h
@@ -509,9 +509,11 @@ struct r5conf {
509 struct llist_head released_stripes; 509 struct llist_head released_stripes;
510 wait_queue_head_t wait_for_stripe; 510 wait_queue_head_t wait_for_stripe;
511 wait_queue_head_t wait_for_overlap; 511 wait_queue_head_t wait_for_overlap;
512 int inactive_blocked; /* release of inactive stripes blocked, 512 unsigned long cache_state;
513 * waiting for 25% to be free 513#define R5_INACTIVE_BLOCKED 1 /* release of inactive stripes blocked,
514 */ 514 * waiting for 25% to be free
515 */
516
515 int pool_size; /* number of disks in stripeheads in pool */ 517 int pool_size; /* number of disks in stripeheads in pool */
516 spinlock_t device_lock; 518 spinlock_t device_lock;
517 struct disk_info *disks; 519 struct disk_info *disks;
@@ -526,6 +528,7 @@ struct r5conf {
526 int worker_cnt_per_group; 528 int worker_cnt_per_group;
527}; 529};
528 530
531
529/* 532/*
530 * Our supported algorithms 533 * Our supported algorithms
531 */ 534 */