block: cleanup how md_autodetect_dev is called
Add a new include/linux/raid/detect.h header to declare the md_autodetect_dev prototype which can be shared between md and the partition code. Then use IS_BUILTIN to call it instead of the ifdef magic. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
Родитель
1a9fba3a77
Коммит
74cc979c3c
|
@ -18,14 +18,11 @@
|
||||||
#include <linux/ctype.h>
|
#include <linux/ctype.h>
|
||||||
#include <linux/genhd.h>
|
#include <linux/genhd.h>
|
||||||
#include <linux/blktrace_api.h>
|
#include <linux/blktrace_api.h>
|
||||||
|
#include <linux/raid/detect.h>
|
||||||
#include "blk.h"
|
#include "blk.h"
|
||||||
|
|
||||||
#include "partitions/check.h"
|
#include "partitions/check.h"
|
||||||
|
|
||||||
#ifdef CONFIG_BLK_DEV_MD
|
|
||||||
extern void md_autodetect_dev(dev_t dev);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static ssize_t part_partition_show(struct device *dev,
|
static ssize_t part_partition_show(struct device *dev,
|
||||||
struct device_attribute *attr, char *buf)
|
struct device_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
|
@ -407,10 +404,10 @@ static bool blk_add_partition(struct gendisk *disk, struct block_device *bdev,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_BLK_DEV_MD
|
if (IS_BUILTIN(CONFIG_BLK_DEV_MD) &&
|
||||||
if (state->parts[p].flags & ADDPART_FLAG_RAID)
|
(state->parts[p].flags & ADDPART_FLAG_RAID))
|
||||||
md_autodetect_dev(part_to_dev(part)->devt);
|
md_autodetect_dev(part_to_dev(part)->devt);
|
||||||
#endif
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,6 +58,7 @@
|
||||||
#include <linux/delay.h>
|
#include <linux/delay.h>
|
||||||
#include <linux/raid/md_p.h>
|
#include <linux/raid/md_p.h>
|
||||||
#include <linux/raid/md_u.h>
|
#include <linux/raid/md_u.h>
|
||||||
|
#include <linux/raid/detect.h>
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
#include <linux/percpu-refcount.h>
|
#include <linux/percpu-refcount.h>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
/* SPDX-License-Identifier: GPL-2.0 */
|
||||||
|
|
||||||
|
void md_autodetect_dev(dev_t dev);
|
Загрузка…
Ссылка в новой задаче