diff options
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r-- | drivers/md/md.c | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index 9ab768acfb62..61200717687b 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -1817,10 +1817,10 @@ retry: | |||
1817 | memset(bbp, 0xff, PAGE_SIZE); | 1817 | memset(bbp, 0xff, PAGE_SIZE); |
1818 | 1818 | ||
1819 | for (i = 0 ; i < bb->count ; i++) { | 1819 | for (i = 0 ; i < bb->count ; i++) { |
1820 | u64 internal_bb = *p++; | 1820 | u64 internal_bb = p[i]; |
1821 | u64 store_bb = ((BB_OFFSET(internal_bb) << 10) | 1821 | u64 store_bb = ((BB_OFFSET(internal_bb) << 10) |
1822 | | BB_LEN(internal_bb)); | 1822 | | BB_LEN(internal_bb)); |
1823 | *bbp++ = cpu_to_le64(store_bb); | 1823 | bbp[i] = cpu_to_le64(store_bb); |
1824 | } | 1824 | } |
1825 | bb->changed = 0; | 1825 | bb->changed = 0; |
1826 | if (read_seqretry(&bb->lock, seq)) | 1826 | if (read_seqretry(&bb->lock, seq)) |
@@ -5294,7 +5294,7 @@ void md_stop_writes(struct mddev *mddev) | |||
5294 | } | 5294 | } |
5295 | EXPORT_SYMBOL_GPL(md_stop_writes); | 5295 | EXPORT_SYMBOL_GPL(md_stop_writes); |
5296 | 5296 | ||
5297 | void md_stop(struct mddev *mddev) | 5297 | static void __md_stop(struct mddev *mddev) |
5298 | { | 5298 | { |
5299 | mddev->ready = 0; | 5299 | mddev->ready = 0; |
5300 | mddev->pers->stop(mddev); | 5300 | mddev->pers->stop(mddev); |
@@ -5304,6 +5304,18 @@ void md_stop(struct mddev *mddev) | |||
5304 | mddev->pers = NULL; | 5304 | mddev->pers = NULL; |
5305 | clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery); | 5305 | clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery); |
5306 | } | 5306 | } |
5307 | |||
5308 | void md_stop(struct mddev *mddev) | ||
5309 | { | ||
5310 | /* stop the array and free an attached data structures. | ||
5311 | * This is called from dm-raid | ||
5312 | */ | ||
5313 | __md_stop(mddev); | ||
5314 | bitmap_destroy(mddev); | ||
5315 | if (mddev->bio_set) | ||
5316 | bioset_free(mddev->bio_set); | ||
5317 | } | ||
5318 | |||
5307 | EXPORT_SYMBOL_GPL(md_stop); | 5319 | EXPORT_SYMBOL_GPL(md_stop); |
5308 | 5320 | ||
5309 | static int md_set_readonly(struct mddev *mddev, struct block_device *bdev) | 5321 | static int md_set_readonly(struct mddev *mddev, struct block_device *bdev) |
@@ -5364,7 +5376,7 @@ static int do_md_stop(struct mddev * mddev, int mode, | |||
5364 | set_disk_ro(disk, 0); | 5376 | set_disk_ro(disk, 0); |
5365 | 5377 | ||
5366 | __md_stop_writes(mddev); | 5378 | __md_stop_writes(mddev); |
5367 | md_stop(mddev); | 5379 | __md_stop(mddev); |
5368 | mddev->queue->merge_bvec_fn = NULL; | 5380 | mddev->queue->merge_bvec_fn = NULL; |
5369 | mddev->queue->backing_dev_info.congested_fn = NULL; | 5381 | mddev->queue->backing_dev_info.congested_fn = NULL; |
5370 | 5382 | ||
@@ -7936,9 +7948,9 @@ int md_is_badblock(struct badblocks *bb, sector_t s, int sectors, | |||
7936 | sector_t *first_bad, int *bad_sectors) | 7948 | sector_t *first_bad, int *bad_sectors) |
7937 | { | 7949 | { |
7938 | int hi; | 7950 | int hi; |
7939 | int lo = 0; | 7951 | int lo; |
7940 | u64 *p = bb->page; | 7952 | u64 *p = bb->page; |
7941 | int rv = 0; | 7953 | int rv; |
7942 | sector_t target = s + sectors; | 7954 | sector_t target = s + sectors; |
7943 | unsigned seq; | 7955 | unsigned seq; |
7944 | 7956 | ||
@@ -7953,7 +7965,8 @@ int md_is_badblock(struct badblocks *bb, sector_t s, int sectors, | |||
7953 | 7965 | ||
7954 | retry: | 7966 | retry: |
7955 | seq = read_seqbegin(&bb->lock); | 7967 | seq = read_seqbegin(&bb->lock); |
7956 | 7968 | lo = 0; | |
7969 | rv = 0; | ||
7957 | hi = bb->count; | 7970 | hi = bb->count; |
7958 | 7971 | ||
7959 | /* Binary search between lo and hi for 'target' | 7972 | /* Binary search between lo and hi for 'target' |