Skip to content

Commit d82fa81

Browse files
author
Christoph Hellwig
committed
md: replace the RAID_AUTORUN ioctl with a direct function call
Instead of using a spcial RAID_AUTORUN ioctl that only exists for non-modular builds and is only called from the early init code, just call the actual function directly. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: NeilBrown <[email protected]> Acked-by: Song Liu <[email protected]> Acked-by: Linus Torvalds <[email protected]>
1 parent 4f5b246 commit d82fa81

File tree

3 files changed

+6
-21
lines changed

3 files changed

+6
-21
lines changed

drivers/md/md-autodetect.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <linux/raid/detect.h>
1010
#include <linux/raid/md_u.h>
1111
#include <linux/raid/md_p.h>
12+
#include "md.h"
1213

1314
/*
1415
* When md (and any require personalities) are compiled into the kernel
@@ -285,8 +286,6 @@ __setup("md=", md_setup);
285286

286287
static void __init autodetect_raid(void)
287288
{
288-
int fd;
289-
290289
/*
291290
* Since we don't want to detect and use half a raid array, we need to
292291
* wait for the known devices to complete their probing
@@ -295,12 +294,7 @@ static void __init autodetect_raid(void)
295294
printk(KERN_INFO "md: If you don't use raid, use raid=noautodetect\n");
296295

297296
wait_for_device_probe();
298-
299-
fd = ksys_open("/dev/md0", 0, 0);
300-
if (fd >= 0) {
301-
ksys_ioctl(fd, RAID_AUTORUN, raid_autopart);
302-
ksys_close(fd);
303-
}
297+
md_autostart_arrays(raid_autopart);
304298
}
305299

306300
void __init md_run_setup(void)

drivers/md/md.c

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,6 @@
6868
#include "md-bitmap.h"
6969
#include "md-cluster.h"
7070

71-
#ifndef MODULE
72-
static void autostart_arrays(int part);
73-
#endif
74-
7571
/* pers_list is a list of registered personalities protected
7672
* by pers_lock.
7773
* pers_lock does extra service to protect accesses to
@@ -7421,7 +7417,6 @@ static inline bool md_ioctl_valid(unsigned int cmd)
74217417
case GET_DISK_INFO:
74227418
case HOT_ADD_DISK:
74237419
case HOT_REMOVE_DISK:
7424-
case RAID_AUTORUN:
74257420
case RAID_VERSION:
74267421
case RESTART_ARRAY_RW:
74277422
case RUN_ARRAY:
@@ -7467,13 +7462,6 @@ static int md_ioctl(struct block_device *bdev, fmode_t mode,
74677462
case RAID_VERSION:
74687463
err = get_version(argp);
74697464
goto out;
7470-
7471-
#ifndef MODULE
7472-
case RAID_AUTORUN:
7473-
err = 0;
7474-
autostart_arrays(arg);
7475-
goto out;
7476-
#endif
74777465
default:;
74787466
}
74797467

@@ -9721,7 +9709,7 @@ void md_autodetect_dev(dev_t dev)
97219709
}
97229710
}
97239711

9724-
static void autostart_arrays(int part)
9712+
void md_autostart_arrays(int part)
97259713
{
97269714
struct md_rdev *rdev;
97279715
struct detected_devices_node *node_detected_dev;

drivers/md/md.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -800,4 +800,7 @@ static inline void mddev_check_write_zeroes(struct mddev *mddev, struct bio *bio
800800
!bio->bi_disk->queue->limits.max_write_zeroes_sectors)
801801
mddev->queue->limits.max_write_zeroes_sectors = 0;
802802
}
803+
804+
void md_autostart_arrays(int part);
805+
803806
#endif /* _MD_MD_H */

0 commit comments

Comments
 (0)