aboutsummaryrefslogtreecommitdiff
path: root/utils/btrfs-progs/files
diff options
context:
space:
mode:
authorKarel Kočí <karel.koci@nic.cz>2019-08-05 13:47:17 +0200
committerJosef Schlehofer <pepe.schlehofer@gmail.com>2019-08-06 09:56:59 +0200
commitae48f3f9e90ccae04a4b9e1946594cf62f217f4a (patch)
tree106148dd9e481b6772dfe611ec9250d3ce82b3bf /utils/btrfs-progs/files
parentd9020050b3a93517b8a4a10b5c51d64b9547f90e (diff)
btrfs-progs: scan devices in preinit instead of init script
There is no gain to do device scan in init. Commonly we want to always scan BTRFS devices to ensure that after boot raids are correctly linked. It should be done before any init script tries to mount any raid FS. Comparing init scripts and preinit scripts there are I think two primary considerations. First is if user is expected to restart/reload/stop given service on will. I think that there is no such reason for this as user can easily enough just call btrfs utility it self. Second consideration is if it makes sense to have it optional. This means if we want to have ability to enable and disable given service. I think that there is no such need in this case. It is pretty much doing nothing if you don't have BTRFS FS connected and when you have you probably want to scan it. Signed-off-by: Karel Kočí <karel.koci@nic.cz>
Diffstat (limited to 'utils/btrfs-progs/files')
-rw-r--r--utils/btrfs-progs/files/btrfs-scan.init10
1 files changed, 4 insertions, 6 deletions
diff --git a/utils/btrfs-progs/files/btrfs-scan.init b/utils/btrfs-progs/files/btrfs-scan.init
index 762e0b840..608d3d6c5 100644
--- a/utils/btrfs-progs/files/btrfs-scan.init
+++ b/utils/btrfs-progs/files/btrfs-scan.init
@@ -1,9 +1,7 @@
-#!/bin/sh /etc/rc.common
-# Copyright (C) 2014 OpenWrt.org
+#!/bin/sh
-START=19
-
-start() {
- grep -q btrfs /proc/filesystems && /usr/bin/btrfs device scan
+preinit_btrfs_scan() {
+ grep -vq btrfs /proc/filesystems || btrfs device scan
}
+boot_hook_add preinit_main preinit_btrfs_scan