diff options
-rw-r--r-- | drivers/md/raid6main.c | 29 |
1 files changed, 10 insertions, 19 deletions
diff --git a/drivers/md/raid6main.c b/drivers/md/raid6main.c index ab64b37e4996..bc69355e0100 100644 --- a/drivers/md/raid6main.c +++ b/drivers/md/raid6main.c | |||
@@ -91,10 +91,8 @@ static void print_raid6_conf (raid6_conf_t *conf); | |||
91 | static void __release_stripe(raid6_conf_t *conf, struct stripe_head *sh) | 91 | static void __release_stripe(raid6_conf_t *conf, struct stripe_head *sh) |
92 | { | 92 | { |
93 | if (atomic_dec_and_test(&sh->count)) { | 93 | if (atomic_dec_and_test(&sh->count)) { |
94 | if (!list_empty(&sh->lru)) | 94 | BUG_ON(!list_empty(&sh->lru)); |
95 | BUG(); | 95 | BUG_ON(atomic_read(&conf->active_stripes)==0); |
96 | if (atomic_read(&conf->active_stripes)==0) | ||
97 | BUG(); | ||
98 | if (test_bit(STRIPE_HANDLE, &sh->state)) { | 96 | if (test_bit(STRIPE_HANDLE, &sh->state)) { |
99 | if (test_bit(STRIPE_DELAYED, &sh->state)) | 97 | if (test_bit(STRIPE_DELAYED, &sh->state)) |
100 | list_add_tail(&sh->lru, &conf->delayed_list); | 98 | list_add_tail(&sh->lru, &conf->delayed_list); |
@@ -202,10 +200,8 @@ static void init_stripe(struct stripe_head *sh, sector_t sector, int pd_idx) | |||
202 | raid6_conf_t *conf = sh->raid_conf; | 200 | raid6_conf_t *conf = sh->raid_conf; |
203 | int disks = conf->raid_disks, i; | 201 | int disks = conf->raid_disks, i; |
204 | 202 | ||
205 | if (atomic_read(&sh->count) != 0) | 203 | BUG_ON(atomic_read(&sh->count) != 0); |
206 | BUG(); | 204 | BUG_ON(test_bit(STRIPE_HANDLE, &sh->state)); |
207 | if (test_bit(STRIPE_HANDLE, &sh->state)) | ||
208 | BUG(); | ||
209 | 205 | ||
210 | CHECK_DEVLOCK(); | 206 | CHECK_DEVLOCK(); |
211 | PRINTK("init_stripe called, stripe %llu\n", | 207 | PRINTK("init_stripe called, stripe %llu\n", |
@@ -284,13 +280,11 @@ static struct stripe_head *get_active_stripe(raid6_conf_t *conf, sector_t sector | |||
284 | init_stripe(sh, sector, pd_idx); | 280 | init_stripe(sh, sector, pd_idx); |
285 | } else { | 281 | } else { |
286 | if (atomic_read(&sh->count)) { | 282 | if (atomic_read(&sh->count)) { |
287 | if (!list_empty(&sh->lru)) | 283 | BUG_ON(!list_empty(&sh->lru)); |
288 | BUG(); | ||
289 | } else { | 284 | } else { |
290 | if (!test_bit(STRIPE_HANDLE, &sh->state)) | 285 | if (!test_bit(STRIPE_HANDLE, &sh->state)) |
291 | atomic_inc(&conf->active_stripes); | 286 | atomic_inc(&conf->active_stripes); |
292 | if (list_empty(&sh->lru)) | 287 | BUG_ON(list_empty(&sh->lru)); |
293 | BUG(); | ||
294 | list_del_init(&sh->lru); | 288 | list_del_init(&sh->lru); |
295 | } | 289 | } |
296 | } | 290 | } |
@@ -353,8 +347,7 @@ static int drop_one_stripe(raid6_conf_t *conf) | |||
353 | spin_unlock_irq(&conf->device_lock); | 347 | spin_unlock_irq(&conf->device_lock); |
354 | if (!sh) | 348 | if (!sh) |
355 | return 0; | 349 | return 0; |
356 | if (atomic_read(&sh->count)) | 350 | BUG_ON(atomic_read(&sh->count)); |
357 | BUG(); | ||
358 | shrink_buffers(sh, conf->raid_disks); | 351 | shrink_buffers(sh, conf->raid_disks); |
359 | kmem_cache_free(conf->slab_cache, sh); | 352 | kmem_cache_free(conf->slab_cache, sh); |
360 | atomic_dec(&conf->active_stripes); | 353 | atomic_dec(&conf->active_stripes); |
@@ -780,7 +773,7 @@ static void compute_parity(struct stripe_head *sh, int method) | |||
780 | if (test_and_clear_bit(R5_Overlap, &sh->dev[i].flags)) | 773 | if (test_and_clear_bit(R5_Overlap, &sh->dev[i].flags)) |
781 | wake_up(&conf->wait_for_overlap); | 774 | wake_up(&conf->wait_for_overlap); |
782 | 775 | ||
783 | if (sh->dev[i].written) BUG(); | 776 | BUG_ON(sh->dev[i].written); |
784 | sh->dev[i].written = chosen; | 777 | sh->dev[i].written = chosen; |
785 | } | 778 | } |
786 | break; | 779 | break; |
@@ -970,8 +963,7 @@ static int add_stripe_bio(struct stripe_head *sh, struct bio *bi, int dd_idx, in | |||
970 | if (*bip && (*bip)->bi_sector < bi->bi_sector + ((bi->bi_size)>>9)) | 963 | if (*bip && (*bip)->bi_sector < bi->bi_sector + ((bi->bi_size)>>9)) |
971 | goto overlap; | 964 | goto overlap; |
972 | 965 | ||
973 | if (*bip && bi->bi_next && (*bip) != bi->bi_next) | 966 | BUG_ON(*bip && bi->bi_next && (*bip) != bi->bi_next); |
974 | BUG(); | ||
975 | if (*bip) | 967 | if (*bip) |
976 | bi->bi_next = *bip; | 968 | bi->bi_next = *bip; |
977 | *bip = bi; | 969 | *bip = bi; |
@@ -1906,8 +1898,7 @@ static void raid6d (mddev_t *mddev) | |||
1906 | 1898 | ||
1907 | list_del_init(first); | 1899 | list_del_init(first); |
1908 | atomic_inc(&sh->count); | 1900 | atomic_inc(&sh->count); |
1909 | if (atomic_read(&sh->count)!= 1) | 1901 | BUG_ON(atomic_read(&sh->count)!= 1); |
1910 | BUG(); | ||
1911 | spin_unlock_irq(&conf->device_lock); | 1902 | spin_unlock_irq(&conf->device_lock); |
1912 | 1903 | ||
1913 | handled++; | 1904 | handled++; |