Skip to content

Commit

Permalink
perf(90kernel-modules): use awk instead of shell monster
Browse files Browse the repository at this point in the history
~120ms -> ~2ms

Downstream: https://bugs.debian.org/1017411
  • Loading branch information
nabijaczleweli authored and johannbg committed Oct 22, 2022
1 parent 03babd9 commit 77ac95d
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions modules.d/90kernel-modules/module-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,6 @@ installkernel() {
local _blockfuncs='ahci_platform_get_resources|ata_scsi_ioctl|scsi_add_host|blk_cleanup_queue|register_mtd_blktrans|scsi_esp_register|register_virtio_device|usb_stor_disconnect|mmc_add_host|sdhci_add_host|scsi_add_host_with_dma|blk_mq_alloc_disk|blk_cleanup_disk'
local -A _hostonly_drvs

find_kernel_modules_external() {
local a

[[ -f "$srcmods/modules.dep" ]] || return 0

while IFS=: read -r a _ || [[ $a ]]; do
[[ $a =~ ^/ ]] && printf "%s\n" "$a"
done < "$srcmods/modules.dep"
}

record_block_dev_drv() {

for _mod in $(get_dev_module /dev/block/"$1"); do
Expand Down Expand Up @@ -105,7 +95,7 @@ installkernel() {
"=drivers/scsi/hisi_sas"
fi

find_kernel_modules_external | instmods
awk -F: '/^\// {print $1}' "$srcmods/modules.dep" 2> /dev/null | instmods

# if not on hostonly mode, or there are hostonly block device
# install block drivers
Expand Down

0 comments on commit 77ac95d

Please sign in to comment.