Commit 79cd1668 authored by Jens Axboe's avatar Jens Axboe

Merge branch 'md-next' of...

Merge branch 'md-next' of https://git.kernel.org/pub/scm/linux/kernel/git/song/md into for-5.10/drivers

Pull MD updates from Song:

"The main changes are:
 - Bug fixes in bitmap code, from Zhao Heming.
 - Fix a work queue check, from Guoqing Jiang.
 - Fix raid5 oops with reshape, from Song Liu.
 - Clean up unused code, from Jason Yan."

* 'md-next' of https://git.kernel.org/pub/scm/linux/kernel/git/song/md:
  md/raid5: fix oops during stripe resizing
  md/bitmap: fix memory leak of temporary bitmap
  md: fix the checking of wrong work queue
  md/bitmap: md_bitmap_get_counter returns wrong blocks
  md/bitmap: md_bitmap_read_sb uses wrong bitmap blocks
  md/raid0: remove unused function is_io_in_chunk_boundary()
parents b6bf0830 b44c018c
...@@ -606,8 +606,8 @@ static int md_bitmap_read_sb(struct bitmap *bitmap) ...@@ -606,8 +606,8 @@ static int md_bitmap_read_sb(struct bitmap *bitmap)
if (bitmap->cluster_slot >= 0) { if (bitmap->cluster_slot >= 0) {
sector_t bm_blocks = bitmap->mddev->resync_max_sectors; sector_t bm_blocks = bitmap->mddev->resync_max_sectors;
sector_div(bm_blocks, bm_blocks = DIV_ROUND_UP_SECTOR_T(bm_blocks,
bitmap->mddev->bitmap_info.chunksize >> 9); (bitmap->mddev->bitmap_info.chunksize >> 9));
/* bits to bytes */ /* bits to bytes */
bm_blocks = ((bm_blocks+7) >> 3) + sizeof(bitmap_super_t); bm_blocks = ((bm_blocks+7) >> 3) + sizeof(bitmap_super_t);
/* to 4k blocks */ /* to 4k blocks */
...@@ -1368,7 +1368,7 @@ __acquires(bitmap->lock) ...@@ -1368,7 +1368,7 @@ __acquires(bitmap->lock)
if (bitmap->bp[page].hijacked || if (bitmap->bp[page].hijacked ||
bitmap->bp[page].map == NULL) bitmap->bp[page].map == NULL)
csize = ((sector_t)1) << (bitmap->chunkshift + csize = ((sector_t)1) << (bitmap->chunkshift +
PAGE_COUNTER_SHIFT - 1); PAGE_COUNTER_SHIFT);
else else
csize = ((sector_t)1) << bitmap->chunkshift; csize = ((sector_t)1) << bitmap->chunkshift;
*blocks = csize - (offset & (csize - 1)); *blocks = csize - (offset & (csize - 1));
...@@ -1950,6 +1950,7 @@ int md_bitmap_load(struct mddev *mddev) ...@@ -1950,6 +1950,7 @@ int md_bitmap_load(struct mddev *mddev)
} }
EXPORT_SYMBOL_GPL(md_bitmap_load); 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) struct bitmap *get_bitmap_from_slot(struct mddev *mddev, int slot)
{ {
int rv = 0; int rv = 0;
...@@ -2013,6 +2014,7 @@ int md_bitmap_copy_from_slot(struct mddev *mddev, int slot, ...@@ -2013,6 +2014,7 @@ int md_bitmap_copy_from_slot(struct mddev *mddev, int slot,
md_bitmap_unplug(mddev->bitmap); md_bitmap_unplug(mddev->bitmap);
*low = lo; *low = lo;
*high = hi; *high = hi;
md_bitmap_free(bitmap);
return rv; return rv;
} }
...@@ -2616,4 +2618,3 @@ struct attribute_group md_bitmap_group = { ...@@ -2616,4 +2618,3 @@ struct attribute_group md_bitmap_group = {
.name = "bitmap", .name = "bitmap",
.attrs = md_bitmap_attrs, .attrs = md_bitmap_attrs,
}; };
...@@ -1166,6 +1166,7 @@ static int resize_bitmaps(struct mddev *mddev, sector_t newsize, sector_t oldsiz ...@@ -1166,6 +1166,7 @@ static int resize_bitmaps(struct mddev *mddev, sector_t newsize, sector_t oldsiz
* can't resize bitmap * can't resize bitmap
*/ */
goto out; goto out;
md_bitmap_free(bitmap);
} }
return 0; return 0;
......
...@@ -9565,7 +9565,7 @@ static int __init md_init(void) ...@@ -9565,7 +9565,7 @@ static int __init md_init(void)
goto err_misc_wq; goto err_misc_wq;
md_rdev_misc_wq = alloc_workqueue("md_rdev_misc", 0, 0); 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; goto err_rdev_misc_wq;
if ((ret = register_blkdev(MD_MAJOR, "md")) < 0) if ((ret = register_blkdev(MD_MAJOR, "md")) < 0)
......
...@@ -426,23 +426,6 @@ static void raid0_free(struct mddev *mddev, void *priv) ...@@ -426,23 +426,6 @@ static void raid0_free(struct mddev *mddev, void *priv)
kfree(conf); 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) static void raid0_handle_discard(struct mddev *mddev, struct bio *bio)
{ {
struct r0conf *conf = mddev->private; struct r0conf *conf = mddev->private;
......
...@@ -2585,8 +2585,6 @@ static int resize_stripes(struct r5conf *conf, int newsize) ...@@ -2585,8 +2585,6 @@ static int resize_stripes(struct r5conf *conf, int newsize)
} else } else
err = -ENOMEM; err = -ENOMEM;
mutex_unlock(&conf->cache_size_mutex);
conf->slab_cache = sc; conf->slab_cache = sc;
conf->active_name = 1-conf->active_name; conf->active_name = 1-conf->active_name;
...@@ -2628,6 +2626,8 @@ static int resize_stripes(struct r5conf *conf, int newsize) ...@@ -2628,6 +2626,8 @@ static int resize_stripes(struct r5conf *conf, int newsize)
if (!err) if (!err)
conf->pool_size = newsize; conf->pool_size = newsize;
mutex_unlock(&conf->cache_size_mutex);
return err; return err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment