diff options
-rw-r--r-- | sys-fs/mdadm/Manifest | 2 | ||||
-rw-r--r-- | sys-fs/mdadm/files/mdraid.rc | 57 |
2 files changed, 47 insertions, 12 deletions
diff --git a/sys-fs/mdadm/Manifest b/sys-fs/mdadm/Manifest index db782ac5..b60c25f5 100644 --- a/sys-fs/mdadm/Manifest +++ b/sys-fs/mdadm/Manifest @@ -22,7 +22,7 @@ AUX mdadm.service 307 SHA256 fdb0c813eb72c85445269eab1182cd68c8d1ca0abfefb2ac966 AUX mdadm.tmpfiles.conf 30 SHA256 6382e48282297663adbe1b1db55c1554d27badd8ab0ee5a4d2e1bbf880f62af3 SHA512 65bf1a8ce3520f74e5ca2e8167b8da5cb3c9db2135385d3a76b0fc137af6f2fa4f9237effdd3d58f6e002cf016b38b364f780911c7abcb103127627c8de9409e WHIRLPOOL be5b287655d6587dc3088118e277950e4530e2df0ea1336924ea832ba1612773ff3f0bda60f9d5de1aee567e3e220d7a20fa5ca922efdfac6b9739ed345ad56e AUX mdadm.weekly 187 SHA256 1234feb39795ebd03c53ca6f2d6496cf69c658890278d803ea40c86b841f898e SHA512 3bc7bf8c9593f06e42ae657e2bce416758090d1f999a447986df17b97e1494b261f02155b83932295f2f3bbab7d8933cf647c834bfb1d7def879cbedfaa6d7c2 WHIRLPOOL ff1b95deee1ee422f05aa438b498708bdb65754cd1158f371d1657f864ea0a52c62e5c93cbb4bfe98cedea23670a3a8b3fa4a04818975d80cf577d12318df7c7 AUX mdraid.confd 504 SHA256 45935632254fca9695e1da978279a26f075f8ab888cf7992b1c64a2a6f052b4a SHA512 8500bbc0ee0ee2d960f10c1ffa46791d23671181a358de7d0263d312111bf7049ec820036e20d038313e0af825db335f8a6762ae052f5fbb3b24c65a880526d7 WHIRLPOOL 6d91a932251f60c2beb1baffa083138e4452afa8570d915b193537b265db049ded5deae828f136ca57808595d62babe095fae43b1ec496f1b1907de2cee5cf12 -AUX mdraid.rc 4223 SHA256 15883fe9af79ca4d8210a0f8d4fc0a2501a693e2ab19c00498b48d5e69c61502 SHA512 4cbc88f45243d64fe6042693e359653f374387545226ff6ef28783eca30d7984540eb7d71032a19ae6e181039e863da8b189472804c6d5e0abf99aa53d1726c3 WHIRLPOOL a49702b5b36552e24e83b1450568476c73182a906b87d1d7e4944766ce2faaeedc897391b7773b2bdf7221c8bed65132a7828319fb19ec75765e31158911f545 +AUX mdraid.rc 5455 SHA256 75da5b91f145f39d15b10524c262c08855443b586f80553da3dbe292c8062540 SHA512 65c7af7463b79c055438cf0c90d046f56b8e0975bae9a358bf08a8c57bc6b5e030c0ad2942b84578337695c78461ebcb0c48f8fccbac814b3b6cec22ec9d1501 WHIRLPOOL c84584a1c5b7c1441e7a4abb19a7747f66e9e609e959410c20b92d1b492aa511188c918d892e58aa93d47decf352ea0c22cbbcb88d373d2f5cfb2d9b5a6c6c71 AUX mdraid.rc-3.1.1 815 SHA256 95f759ba9d4f719bb5122546fdcce18dd9b0060df1296cf8ae17a04137e163e2 SHA512 4bf2235bdffde101d10c408de486e9629caf1eed3f574bf3ed206d7013e8a715016066069272d24894a4c428009003de4ee3d8291323e2aaae3157fbce4318ed WHIRLPOOL 65fed6723b508405ea67d4d5973a617b21c8b90ea480c69bc7da843718c16c98ed89a32013d102860c62fe0de8b8e8002180649e0176e303a887698baa7f053e AUX raid-start.sh-3.0 4110 SHA256 809f66c15bbc9837942bcf966f23768e9ca78e248a88d237bbd4c992a82df6d1 SHA512 81bf358c2080a94d54f12de7e3b44cc19e2768781487b081edb9d6d4368cb561223bba31cc7ab7ccba935df2b15abb06c353e65892337b32a3d9ab93d144469a WHIRLPOOL 2a7305d43db4e3147c4e739069e5e7fc30e24fc364cd0e90f2fb044599c4f241e24c021191efc71746b75377b8722b78044f1b63d49000b2b2a633904f098eb8 AUX raid-stop.sh 645 SHA256 167a6bd452b5831cd5235eb80bf5f91bb2e5a10db132408fce29e60eb9d200db SHA512 8ee27e586dccf75bed3026f4beb42f429b53b0f11791122674122b90482010cd278c9d714a397bf1636617068e3e440c5fbc5babd89109f3c8e7a5a04dc82c05 WHIRLPOOL 14f76b1155299e7febd95e27e878e08997f4d57d5ef14e19b973a0917305617a47c242806399d17776e4d42885a199eec61dac8e0a12286f0ddf04f345283777 diff --git a/sys-fs/mdadm/files/mdraid.rc b/sys-fs/mdadm/files/mdraid.rc index 039681e7..8834d25b 100644 --- a/sys-fs/mdadm/files/mdraid.rc +++ b/sys-fs/mdadm/files/mdraid.rc @@ -73,6 +73,9 @@ start() { ios_name="Budget Fair" ios_module="bfq" ios_queue="bfq" + ios_fallback_name="Completely Fair" + ios_fallback_module="cfq" + ios_fallback_queue="cfq" ;; cfq|fair) ios_name="Completely Fair" @@ -92,22 +95,46 @@ start() { esac ebegin "Loading ${ios_name} I/O scheduler" - modprobe "${ios_module}-iosched" - eend $? + if [ "${ios_module}" = "bfq" ] && + [ "$( uname -r | cut -d'.' -f 1 )" = '4' ] && + [ "$( uname -r | cut -d'.' -f 2 )" -gt 11 ] + then + if [ -r /sys/module/scsi_mod/parameters/use_blk_mq ] && + [ "$( < /sys/module/scsi_mod/parameters/use_blk_mq )" = "N" ] + then + eerror "After mainline merge in Linux 4.12, 'bfq' requires 'scsi_mod.use_blk_mq=1' to" + eerror "be specified as a kernel option" + eend 1 "Falling back to 'cfq' scheduler" + ios_name="${ios_fallback_name:-}" + ios_module="${ios_fallback_module}" + ios_queue="${ios_fallback_queue}" + ebegin "Loading ${ios_name} I/O scheduler" + modprobe "${ios_module}-iosched" + else + modprobe "${ios_module}" + fi + else + modprobe "${ios_module}-iosched" + fi + eend ${?} set -- discard $( grep "^\s*DEVICE\s*" "${mdadm_conf}" ) shift while [ -n "${1}" ]; do - device="${1}" + device="$( basename "${1}" )" shift [ "${device}" = "DEVICE" ] && continue for node in /sys/block/"${device}"/queue/scheduler; do - if [ -e "${node}" ] && grep -q "${ios_queue}" "${node}"; then - ebegin "Setting I/O scheduler for device '${device}'" - printf "${ios_queue}" > "${node}" - eend $? "Cannot install ${ios_queue} scheduler" + if [ -r "${node}" ]; then + if grep -q "${ios_queue}" "${node}"; then + ebegin "Setting I/O scheduler for device '${device}'" + printf "${ios_queue}" > "${node}" + eend $? "Cannot install ${ios_queue} scheduler" + else + ewarn "Not setting scheduler '${ios_queue}' for device '${device}'" + fi fi done done @@ -120,7 +147,7 @@ start() { set -- discard $( grep "^\s*DEVICE\s*" "${mdadm_conf}" ) shift while [ -n "${1}" ]; do - device="${1}" + device="$( basename "${1}" )" shift [ "${device}" = "DEVICE" ] && continue @@ -140,9 +167,17 @@ start() { fi fi - ebegin "Starting up RAID devices" - output="$( mdadm -As ${MDADM_ASSEMBLE_OPTS} 2>&1 )" - eend $? "${output}" + if [ $( grep '^ARRAY' "${mdadm_conf}" | grep -o "md[[:digit:]]\+" | sort | tr -d $'\n' ) != \ + $( grep 'active' /proc/mdstat | grep -o "md[[:digit:]]\+" | sort | tr -d $'\n' ) ] + then + ebegin "Starting up RAID devices" + output="$( mdadm -As ${MDADM_ASSEMBLE_OPTS} 2>&1 )" + rc=${?} + [ -n "${output:-}" ] || rc=0 + eend $? "${output:-}" + else + ewarn "All RAID devices already active" + fi local pat="/dev/md_d*" set -- ${pat} |