md/raid5: ensure we create a unique name for kmem_cache when mddev has no gendisk
We will shortly allow md devices with no gendisk (they are attached to a dm-target instead). That will cause mdname() to return 'mdX'. There is one place where mdname really needs to be unique: when creating the name for a slab cache. So in that case, if there is no gendisk, you the address of the mddev formatted in HEX to provide a unique name. Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
parent
c41d4ac40d
commit
f4be6b43f1
@ -1337,10 +1337,14 @@ static int grow_stripes(raid5_conf_t *conf, int num)
|
|||||||
struct kmem_cache *sc;
|
struct kmem_cache *sc;
|
||||||
int devs = max(conf->raid_disks, conf->previous_raid_disks);
|
int devs = max(conf->raid_disks, conf->previous_raid_disks);
|
||||||
|
|
||||||
sprintf(conf->cache_name[0],
|
if (conf->mddev->gendisk)
|
||||||
"raid%d-%s", conf->level, mdname(conf->mddev));
|
sprintf(conf->cache_name[0],
|
||||||
sprintf(conf->cache_name[1],
|
"raid%d-%s", conf->level, mdname(conf->mddev));
|
||||||
"raid%d-%s-alt", conf->level, mdname(conf->mddev));
|
else
|
||||||
|
sprintf(conf->cache_name[0],
|
||||||
|
"raid%d-%p", conf->level, conf->mddev);
|
||||||
|
sprintf(conf->cache_name[1], "%s-alt", conf->cache_name[0]);
|
||||||
|
|
||||||
conf->active_name = 0;
|
conf->active_name = 0;
|
||||||
sc = kmem_cache_create(conf->cache_name[conf->active_name],
|
sc = kmem_cache_create(conf->cache_name[conf->active_name],
|
||||||
sizeof(struct stripe_head)+(devs-1)*sizeof(struct r5dev),
|
sizeof(struct stripe_head)+(devs-1)*sizeof(struct r5dev),
|
||||||
|
@ -388,7 +388,7 @@ struct raid5_private_data {
|
|||||||
* two caches.
|
* two caches.
|
||||||
*/
|
*/
|
||||||
int active_name;
|
int active_name;
|
||||||
char cache_name[2][20];
|
char cache_name[2][32];
|
||||||
struct kmem_cache *slab_cache; /* for allocating stripes */
|
struct kmem_cache *slab_cache; /* for allocating stripes */
|
||||||
|
|
||||||
int seq_flush, seq_write;
|
int seq_flush, seq_write;
|
||||||
|
Loading…
Reference in New Issue
Block a user