diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/md/md-bitmap.c | 9 | ||||
-rw-r--r-- | drivers/md/md-cluster.c | 1 | ||||
-rw-r--r-- | drivers/md/md.c | 2 | ||||
-rw-r--r-- | drivers/md/raid0.c | 17 | ||||
-rw-r--r-- | drivers/md/raid5.c | 4 |
5 files changed, 9 insertions, 24 deletions
diff --git a/drivers/md/md-bitmap.c b/drivers/md/md-bitmap.c index 55b757a223a4..200c5d0f08bf 100644 --- a/drivers/md/md-bitmap.c +++ b/drivers/md/md-bitmap.c @@ -606,8 +606,8 @@ re_read: if (bitmap->cluster_slot >= 0) { sector_t bm_blocks = bitmap->mddev->resync_max_sectors; - sector_div(bm_blocks, - bitmap->mddev->bitmap_info.chunksize >> 9); + bm_blocks = DIV_ROUND_UP_SECTOR_T(bm_blocks, + (bitmap->mddev->bitmap_info.chunksize >> 9)); /* bits to bytes */ bm_blocks = ((bm_blocks+7) >> 3) + sizeof(bitmap_super_t); /* to 4k blocks */ @@ -1368,7 +1368,7 @@ __acquires(bitmap->lock) if (bitmap->bp[page].hijacked || bitmap->bp[page].map == NULL) csize = ((sector_t)1) << (bitmap->chunkshift + - PAGE_COUNTER_SHIFT - 1); + PAGE_COUNTER_SHIFT); else csize = ((sector_t)1) << bitmap->chunkshift; *blocks = csize - (offset & (csize - 1)); @@ -1950,6 +1950,7 @@ out: } EXPORT_SYMBOL_GPL(md_bitmap_load); +/* caller need to free returned bitmap with md_bitmap_free() */ struct bitmap *get_bitmap_from_slot(struct mddev *mddev, int slot) { int rv = 0; @@ -2013,6 +2014,7 @@ int md_bitmap_copy_from_slot(struct mddev *mddev, int slot, md_bitmap_unplug(mddev->bitmap); *low = lo; *high = hi; + md_bitmap_free(bitmap); return rv; } @@ -2616,4 +2618,3 @@ struct attribute_group md_bitmap_group = { .name = "bitmap", .attrs = md_bitmap_attrs, }; - diff --git a/drivers/md/md-cluster.c b/drivers/md/md-cluster.c index 0580b51a156a..4aaf4820b6f6 100644 --- a/drivers/md/md-cluster.c +++ b/drivers/md/md-cluster.c @@ -1166,6 +1166,7 @@ static int resize_bitmaps(struct mddev *mddev, sector_t newsize, sector_t oldsiz * can't resize bitmap */ goto out; + md_bitmap_free(bitmap); } return 0; diff --git a/drivers/md/md.c b/drivers/md/md.c index dfff4bb2bb20..f1c6304c79f4 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -9565,7 +9565,7 @@ static int __init md_init(void) goto err_misc_wq; md_rdev_misc_wq = alloc_workqueue("md_rdev_misc", 0, 0); - if (!md_misc_wq) + if (!md_rdev_misc_wq) goto err_rdev_misc_wq; if ((ret = register_blkdev(MD_MAJOR, "md")) < 0) diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c index e2de0cced707..6f44177593a5 100644 --- a/drivers/md/raid0.c +++ b/drivers/md/raid0.c @@ -426,23 +426,6 @@ static void raid0_free(struct mddev *mddev, void *priv) kfree(conf); } -/* - * Is io distribute over 1 or more chunks ? -*/ -static inline int is_io_in_chunk_boundary(struct mddev *mddev, - unsigned int chunk_sects, struct bio *bio) -{ - if (likely(is_power_of_2(chunk_sects))) { - return chunk_sects >= - ((bio->bi_iter.bi_sector & (chunk_sects-1)) - + bio_sectors(bio)); - } else{ - sector_t sector = bio->bi_iter.bi_sector; - return chunk_sects >= (sector_div(sector, chunk_sects) - + bio_sectors(bio)); - } -} - static void raid0_handle_discard(struct mddev *mddev, struct bio *bio) { struct r0conf *conf = mddev->private; diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 66690b40818e..39343479ac2a 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -2585,8 +2585,6 @@ static int resize_stripes(struct r5conf *conf, int newsize) } else err = -ENOMEM; - mutex_unlock(&conf->cache_size_mutex); - conf->slab_cache = sc; conf->active_name = 1-conf->active_name; @@ -2628,6 +2626,8 @@ static int resize_stripes(struct r5conf *conf, int newsize) if (!err) conf->pool_size = newsize; + mutex_unlock(&conf->cache_size_mutex); + return err; } |