From 1925094cb04f19de3ceb419a2fe40dc52db66169 Mon Sep 17 00:00:00 2001 From: Gleb Chesnokov Date: Tue, 1 Oct 2024 12:45:10 +0300 Subject: [PATCH 1/7] .github/workflows, scripts: Improve checkpatch compliance Use checkpatch --strict to detect more style issues. --- .github/workflows/checkpatch_pull.yml | 2 +- .github/workflows/checkpatch_push.yml | 2 +- scripts/checkpatch | 24 ++++++++++++++---------- scripts/run-regression-tests | 14 +++++++++----- 4 files changed, 25 insertions(+), 17 deletions(-) diff --git a/.github/workflows/checkpatch_pull.yml b/.github/workflows/checkpatch_pull.yml index b19aa58e5..50c23267a 100644 --- a/.github/workflows/checkpatch_pull.yml +++ b/.github/workflows/checkpatch_pull.yml @@ -47,7 +47,7 @@ jobs: for commit in $commits; do echo "Running checkpatch.pl for commit $commit" echo "========================================" - git format-patch -1 --stdout $commit | ./checkpatch.pl --no-tree --show-types --ignore="${ignore_str// /,}" - || err=1 + git format-patch -1 --stdout $commit | ./checkpatch.pl --no-tree --show-types --strict --ignore="${ignore_str// /,}" - || err=1 echo done diff --git a/.github/workflows/checkpatch_push.yml b/.github/workflows/checkpatch_push.yml index 12b692470..ac3755ed0 100644 --- a/.github/workflows/checkpatch_push.yml +++ b/.github/workflows/checkpatch_push.yml @@ -45,4 +45,4 @@ jobs: ) ignore_str=${ignore[*]} - git format-patch -1 --stdout | ./checkpatch.pl --no-tree --show-types --ignore="${ignore_str// /,}" - + git format-patch -1 --stdout | ./checkpatch.pl --no-tree --show-types --strict --ignore="${ignore_str// /,}" - diff --git a/scripts/checkpatch b/scripts/checkpatch index 8cdcfcd4b..40937e523 100755 --- a/scripts/checkpatch +++ b/scripts/checkpatch @@ -1,13 +1,17 @@ -#!/bin/bash +#!/usr/bin/env bash ignore=( - CONSTANT_COMPARISON - LINUX_VERSION_CODE - LONG_LINE - LONG_LINE_COMMENT - LONG_LINE_STRING - RETURN_VOID - SPDX_LICENSE_TAG - SYMBOLIC_PERMS + CONSTANT_COMPARISON + LINUX_VERSION_CODE + LONG_LINE + LONG_LINE_COMMENT + LONG_LINE_STRING + RETURN_VOID + SPDX_LICENSE_TAG + SYMBOLIC_PERMS ) -../linux-kernel/scripts/checkpatch.pl -f --show-types --ignore="$(echo "${ignore[@]}" | sed 's/ /,/g')" $(list-source-files | grep -vE '^debian/|^fcst/linux-patches|patch$|pdf$|png$|^iscsi-scst/usr|^qla|^scripts/|^scstadmin/|^usr/|^www/') | sed 's/^#[0-9]*: FILE: \(.*\):/\1:1:/' +ignore_str=${ignore[*]} + +src_files=$(list-source-files | grep -vE '^debian/|^fcst/linux-patches|patch$|pdf$|png$|^iscsi-scst/usr|^qla|^scripts/|^scstadmin/|^usr/|^www/') + +../linux-kernel/scripts/checkpatch.pl -f --show-types --strict --ignore="${ignore_str// /,}" $src_files | sed 's/^#[0-9]*: FILE: \(.*\):/\1:1:/' diff --git a/scripts/run-regression-tests b/scripts/run-regression-tests index e87bb64f4..05b81a6c7 100755 --- a/scripts/run-regression-tests +++ b/scripts/run-regression-tests @@ -231,7 +231,7 @@ function run_checkpatch { if [ "${multiple_patches}" = "false" ]; then echo "Running checkpatch on the SCST kernel patch ..." ( cd "${outputdir}/linux-$1" \ - && scripts/checkpatch.pl --no-tree --no-signoff - < "${patchfile}" &> "${outputfile}") + && scripts/checkpatch.pl --no-tree --no-signoff --strict - < "${patchfile}" &> "${outputfile}") else echo "Running checkpatch on the SCST kernel patches ..." rm -f "${outputfile}" @@ -239,17 +239,21 @@ function run_checkpatch { && for p in "${outputdir}/${patchdir}"/* do echo "==== $p" >>"${outputfile}" - scripts/checkpatch.pl --no-tree --no-signoff - < "$p" >> "${outputfile}" 2>&1 + scripts/checkpatch.pl --no-tree --no-signoff --strict - < "$p" >> "${outputfile}" 2>&1 done ) fi + errors=$(grep -c '^ERROR' "${outputfile}") warnings=$(grep -c '^WARNING' "${outputfile}") - echo "${errors} errors / ${warnings} warnings." - grep -E '^WARNING|^ERROR' "${outputfile}" | + checks=$(grep -c '^CHECK' "${outputfile}") + + echo "${errors} errors / ${warnings} warnings / ${checks} checks." + + grep -E '^WARNING|^ERROR|^CHECK' "${outputfile}" | sort | grep -v 'WARNING: missing space after return type' | - sed 's/^WARNING: Avoid CamelCase:.*/WARNING: Avoid CamelCase/' | + sed 's/^CHECK: Avoid CamelCase:.*/CHECK: Avoid CamelCase/' | uniq -c else echo "Skipping checkpatch step for kernel $1." From 256d695afaaf8c9c99e31f633825e725cda64a5a Mon Sep 17 00:00:00 2001 From: Gleb Chesnokov Date: Thu, 7 Nov 2024 10:45:36 +0300 Subject: [PATCH 2/7] scst: Port to Linux kernel v6.12 Support for the following changes in the Linux kernel v6.12: - 5f60d5f6bbc1 ("move asm/unaligned.h to linux/unaligned.h") - cb787f4ac0c2 ("[tree-wide] finally take no_llseek out") --- fcst/ft_sess.c | 1 - iscsi-scst/include/iscsit_transport.h | 1 - iscsi-scst/kernel/iscsi.c | 1 - iscsi-scst/kernel/isert-scst/isert_login.c | 4 ++++ qla2x00t-32gbit/qla2x00-target/qla_tgt.c | 1 - qla2x00t-32gbit/qla2x00-target/scst_qla2xxx.c | 1 - qla2x00t-32gbit/qla_def.h | 5 +++++ qla2x00t-32gbit/qla_dsd.h | 7 +++++++ qla2x00t-32gbit/qla_target.c | 1 - qla2x00t-32gbit/qla_target.h | 2 -- qla2x00t/qla2x00-target/qla2x00t.c | 1 - scst/include/backport.h | 6 +++++- scst/include/scst.h | 6 +++++- scst/src/dev_handlers/scst_cdrom.c | 1 - scst/src/dev_handlers/scst_disk.c | 1 - scst/src/dev_handlers/scst_modisk.c | 1 - scst/src/dev_handlers/scst_tape.c | 1 - scst/src/dev_handlers/scst_vdisk.c | 1 - scst/src/scst_copy_mgr.c | 2 -- scst/src/scst_lib.c | 1 - scst/src/scst_pres.c | 1 - scst/src/scst_tg.c | 1 - 22 files changed, 26 insertions(+), 21 deletions(-) diff --git a/fcst/ft_sess.c b/fcst/ft_sess.c index 5deafb759..237457bd0 100644 --- a/fcst/ft_sess.c +++ b/fcst/ft_sess.c @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include "fcst.h" diff --git a/iscsi-scst/include/iscsit_transport.h b/iscsi-scst/include/iscsit_transport.h index 38603fa96..116f724a6 100644 --- a/iscsi-scst/include/iscsit_transport.h +++ b/iscsi-scst/include/iscsit_transport.h @@ -66,4 +66,3 @@ extern void iscsit_unreg_transport(struct iscsit_transport *t); extern struct iscsit_transport *iscsit_get_transport(enum iscsit_transport_type type); #endif /* __ISCSI_TRANSPORT_H__ */ - diff --git a/iscsi-scst/kernel/iscsi.c b/iscsi-scst/kernel/iscsi.c index bb367d10d..1641b600c 100644 --- a/iscsi-scst/kernel/iscsi.c +++ b/iscsi-scst/kernel/iscsi.c @@ -22,7 +22,6 @@ #include #include #include -#include #ifdef INSIDE_KERNEL_TREE #include #else diff --git a/iscsi-scst/kernel/isert-scst/isert_login.c b/iscsi-scst/kernel/isert-scst/isert_login.c index 1ae05f9da..6516217e2 100644 --- a/iscsi-scst/kernel/isert-scst/isert_login.c +++ b/iscsi-scst/kernel/isert-scst/isert_login.c @@ -889,7 +889,9 @@ static dev_t devno; static const struct file_operations listener_fops = { .owner = THIS_MODULE, +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0) .llseek = no_llseek, +#endif .read = isert_listen_read, .unlocked_ioctl = isert_listen_ioctl, .compat_ioctl = isert_listen_ioctl, @@ -900,7 +902,9 @@ static const struct file_operations listener_fops = { static const struct file_operations conn_fops = { .owner = THIS_MODULE, +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0) .llseek = no_llseek, +#endif .read = isert_read, .write = isert_write, .unlocked_ioctl = isert_ioctl, diff --git a/qla2x00t-32gbit/qla2x00-target/qla_tgt.c b/qla2x00t-32gbit/qla2x00-target/qla_tgt.c index 36b289603..b1bd5d8f8 100644 --- a/qla2x00t-32gbit/qla2x00-target/qla_tgt.c +++ b/qla2x00t-32gbit/qla2x00-target/qla_tgt.c @@ -37,7 +37,6 @@ #include #include #include -#include #include #include #include diff --git a/qla2x00t-32gbit/qla2x00-target/scst_qla2xxx.c b/qla2x00t-32gbit/qla2x00-target/scst_qla2xxx.c index d30fce685..b7ccd974c 100644 --- a/qla2x00t-32gbit/qla2x00-target/scst_qla2xxx.c +++ b/qla2x00t-32gbit/qla2x00-target/scst_qla2xxx.c @@ -43,7 +43,6 @@ #include #include #include -#include #include #ifdef INSIDE_KERNEL_TREE #include diff --git a/qla2x00t-32gbit/qla_def.h b/qla2x00t-32gbit/qla_def.h index 733086f75..09f4a6c90 100644 --- a/qla2x00t-32gbit/qla_def.h +++ b/qla2x00t-32gbit/qla_def.h @@ -28,6 +28,11 @@ #if LINUX_VERSION_CODE < KERNEL_VERSION(6, 0, 0) #include #endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0) +#include +#else +#include +#endif #include #include #include diff --git a/qla2x00t-32gbit/qla_dsd.h b/qla2x00t-32gbit/qla_dsd.h index 20788054b..1a487d8d7 100644 --- a/qla2x00t-32gbit/qla_dsd.h +++ b/qla2x00t-32gbit/qla_dsd.h @@ -1,7 +1,14 @@ #ifndef _QLA_DSD_H_ #define _QLA_DSD_H_ +#ifndef INSIDE_KERNEL_TREE +#include +#endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0) #include +#else +#include +#endif /* 32-bit data segment descriptor (8 bytes) */ struct dsd32 { diff --git a/qla2x00t-32gbit/qla_target.c b/qla2x00t-32gbit/qla_target.c index 48c4f86e4..8964148ac 100644 --- a/qla2x00t-32gbit/qla_target.c +++ b/qla2x00t-32gbit/qla_target.c @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include diff --git a/qla2x00t-32gbit/qla_target.h b/qla2x00t-32gbit/qla_target.h index 47b80b99a..300501d23 100644 --- a/qla2x00t-32gbit/qla_target.h +++ b/qla2x00t-32gbit/qla_target.h @@ -19,8 +19,6 @@ #ifndef __QLA_TARGET_H #define __QLA_TARGET_H -#include -#include #include "qla_def.h" #include "qla_dsd.h" diff --git a/qla2x00t/qla2x00-target/qla2x00t.c b/qla2x00t/qla2x00-target/qla2x00t.c index 06ade1a19..93d498744 100644 --- a/qla2x00t/qla2x00-target/qla2x00t.c +++ b/qla2x00t/qla2x00-target/qla2x00t.c @@ -32,7 +32,6 @@ #include #include #include -#include #ifdef INSIDE_KERNEL_TREE #include diff --git a/scst/include/backport.h b/scst/include/backport.h index 7c53e9d3e..6651a39a2 100644 --- a/scst/include/backport.h +++ b/scst/include/backport.h @@ -49,7 +49,11 @@ #include /* scsi_build_sense_buffer() */ struct scsi_target; #include /* struct bsg_job */ -#include /* get_unaligned_be64() */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0) +#include +#else +#include +#endif /* */ diff --git a/scst/include/scst.h b/scst/include/scst.h index 301d10653..ebf5703bf 100644 --- a/scst/include/scst.h +++ b/scst/include/scst.h @@ -39,10 +39,14 @@ #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) #include #endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0) +#include +#else +#include +#endif #include #include #include -#include #if 0 /* Let's disable it for now to see if users will complain about it */ #define CONFIG_SCST_PER_DEVICE_CMD_COUNT_LIMIT diff --git a/scst/src/dev_handlers/scst_cdrom.c b/scst/src/dev_handlers/scst_cdrom.c index d35be0677..b3679c43a 100644 --- a/scst/src/dev_handlers/scst_cdrom.c +++ b/scst/src/dev_handlers/scst_cdrom.c @@ -21,7 +21,6 @@ #include #include #include -#include #define LOG_PREFIX "dev_cdrom" diff --git a/scst/src/dev_handlers/scst_disk.c b/scst/src/dev_handlers/scst_disk.c index df2f436b0..d8f932bd3 100644 --- a/scst/src/dev_handlers/scst_disk.c +++ b/scst/src/dev_handlers/scst_disk.c @@ -26,7 +26,6 @@ #include #include #include -#include #define LOG_PREFIX "dev_disk" diff --git a/scst/src/dev_handlers/scst_modisk.c b/scst/src/dev_handlers/scst_modisk.c index ace433646..b096cd98e 100644 --- a/scst/src/dev_handlers/scst_modisk.c +++ b/scst/src/dev_handlers/scst_modisk.c @@ -25,7 +25,6 @@ #include #include #include -#include #define LOG_PREFIX "dev_modisk" diff --git a/scst/src/dev_handlers/scst_tape.c b/scst/src/dev_handlers/scst_tape.c index 845b98e7f..f164390b8 100644 --- a/scst/src/dev_handlers/scst_tape.c +++ b/scst/src/dev_handlers/scst_tape.c @@ -25,7 +25,6 @@ #include #include #include -#include #define LOG_PREFIX "dev_tape" diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index 0234743ba..851251193 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -50,7 +50,6 @@ #include #include #include -#include #include #include #include diff --git a/scst/src/scst_copy_mgr.c b/scst/src/scst_copy_mgr.c index cf6f077e8..c6539b492 100644 --- a/scst/src/scst_copy_mgr.c +++ b/scst/src/scst_copy_mgr.c @@ -8,7 +8,6 @@ #include #include #include -#include #include #ifdef INSIDE_KERNEL_TREE @@ -3898,4 +3897,3 @@ void __exit scst_cm_exit(void) TRACE_EXIT(); return; } - diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index 551afbaf2..5dcb8b141 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -32,7 +32,6 @@ #include #include #include -#include #include #ifndef INSIDE_KERNEL_TREE #include diff --git a/scst/src/scst_pres.c b/scst/src/scst_pres.c index b9c330a80..aaf109288 100644 --- a/scst/src/scst_pres.c +++ b/scst/src/scst_pres.c @@ -40,7 +40,6 @@ #include #endif #include -#include #ifdef INSIDE_KERNEL_TREE #include diff --git a/scst/src/scst_tg.c b/scst/src/scst_tg.c index 0b8c72b4f..de5590a06 100644 --- a/scst/src/scst_tg.c +++ b/scst/src/scst_tg.c @@ -18,7 +18,6 @@ #include #include #include -#include #ifdef INSIDE_KERNEL_TREE #include #include From fca4d58822befa3b729a25cec483492be7cca29b Mon Sep 17 00:00:00 2001 From: Gleb Chesnokov Date: Thu, 7 Nov 2024 12:09:49 +0300 Subject: [PATCH 3/7] .github/workflows: Run regression tests upon a pull request Also allow regression tests to run upon a pull request. --- .github/workflows/checkpatch_pull.yml | 2 +- .github/workflows/run_regression_tests.yaml | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/checkpatch_pull.yml b/.github/workflows/checkpatch_pull.yml index 50c23267a..353c1f9a0 100644 --- a/.github/workflows/checkpatch_pull.yml +++ b/.github/workflows/checkpatch_pull.yml @@ -1,4 +1,4 @@ -name: Checkpatch upon pull +name: Checkpatch upon pull request on: pull_request: diff --git a/.github/workflows/run_regression_tests.yaml b/.github/workflows/run_regression_tests.yaml index a66974c91..20683f737 100644 --- a/.github/workflows/run_regression_tests.yaml +++ b/.github/workflows/run_regression_tests.yaml @@ -1,10 +1,13 @@ -name: Regression tests upon push +name: Run regression tests on: push: branches: - master - nightly/update + pull_request: + branches: + - master jobs: regression_tests: From 31eca7eced090a0a5c035050284fbb904fb1fd3e Mon Sep 17 00:00:00 2001 From: Gleb Chesnokov Date: Thu, 7 Nov 2024 12:49:54 +0300 Subject: [PATCH 4/7] .github/workflows: Use checkpatch scripts Inroduce several checkpatch scripts to use in workflows. --- .github/workflows/checkpatch_pull.yml | 29 +-------------------------- .github/workflows/checkpatch_push.yml | 18 +---------------- scripts/checkpatch | 25 ++++++++++++++--------- scripts/checkpatch_commits | 21 +++++++++++++++++++ scripts/checkpatch_diff | 13 ++++++++++++ scripts/checkpatch_scan | 24 ++++++++++++++++++++++ 6 files changed, 75 insertions(+), 55 deletions(-) create mode 100755 scripts/checkpatch_commits create mode 100755 scripts/checkpatch_diff create mode 100755 scripts/checkpatch_scan diff --git a/.github/workflows/checkpatch_pull.yml b/.github/workflows/checkpatch_pull.yml index 353c1f9a0..992238ea5 100644 --- a/.github/workflows/checkpatch_pull.yml +++ b/.github/workflows/checkpatch_pull.yml @@ -24,31 +24,4 @@ jobs: - name: Run checkpatch.pl run: | - ignore=( - MISSING_SIGN_OFF - EMAIL_SUBJECT - UNKNOWN_COMMIT_ID - NO_AUTHOR_SIGN_OFF - COMMIT_LOG_USE_LINK - BAD_REPORTED_BY_LINK - FILE_PATH_CHANGES - SPDX_LICENSE_TAG - LINUX_VERSION_CODE - CONSTANT_COMPARISON - NEW_TYPEDEFS - SPACING - ) - ignore_str=${ignore[*]} - - base_commit=${{github.event.pull_request.base.sha}} - commits=$(git log --pretty=format:"%h" $base_commit..HEAD) - err=0 - - for commit in $commits; do - echo "Running checkpatch.pl for commit $commit" - echo "========================================" - git format-patch -1 --stdout $commit | ./checkpatch.pl --no-tree --show-types --strict --ignore="${ignore_str// /,}" - || err=1 - echo - done - - exit $err + CHECKPATCH_PATH=. ./scripts/checkpatch_commits ${{github.event.pull_request.base.sha}} diff --git a/.github/workflows/checkpatch_push.yml b/.github/workflows/checkpatch_push.yml index ac3755ed0..a1ea507df 100644 --- a/.github/workflows/checkpatch_push.yml +++ b/.github/workflows/checkpatch_push.yml @@ -29,20 +29,4 @@ jobs: - name: Run checkpatch.pl run: | - ignore=( - MISSING_SIGN_OFF - EMAIL_SUBJECT - UNKNOWN_COMMIT_ID - NO_AUTHOR_SIGN_OFF - COMMIT_LOG_USE_LINK - BAD_REPORTED_BY_LINK - FILE_PATH_CHANGES - SPDX_LICENSE_TAG - LINUX_VERSION_CODE - CONSTANT_COMPARISON - NEW_TYPEDEFS - SPACING - ) - ignore_str=${ignore[*]} - - git format-patch -1 --stdout | ./checkpatch.pl --no-tree --show-types --strict --ignore="${ignore_str// /,}" - + git format-patch -1 --stdout | CHECKPATCH_PATH=. ./scripts/checkpatch diff --git a/scripts/checkpatch b/scripts/checkpatch index 40937e523..5c9d3ba1f 100755 --- a/scripts/checkpatch +++ b/scripts/checkpatch @@ -1,17 +1,22 @@ #!/usr/bin/env bash +set -e + +scriptpath=${CHECKPATCH_PATH:-/lib/modules/$(uname -r)/build/scripts} + ignore=( - CONSTANT_COMPARISON - LINUX_VERSION_CODE - LONG_LINE - LONG_LINE_COMMENT - LONG_LINE_STRING - RETURN_VOID + MISSING_SIGN_OFF + EMAIL_SUBJECT + UNKNOWN_COMMIT_ID + NO_AUTHOR_SIGN_OFF + COMMIT_LOG_USE_LINK + BAD_REPORTED_BY_LINK + FILE_PATH_CHANGES SPDX_LICENSE_TAG - SYMBOLIC_PERMS + LINUX_VERSION_CODE + CONSTANT_COMPARISON + NEW_TYPEDEFS ) ignore_str=${ignore[*]} -src_files=$(list-source-files | grep -vE '^debian/|^fcst/linux-patches|patch$|pdf$|png$|^iscsi-scst/usr|^qla|^scripts/|^scstadmin/|^usr/|^www/') - -../linux-kernel/scripts/checkpatch.pl -f --show-types --strict --ignore="${ignore_str// /,}" $src_files | sed 's/^#[0-9]*: FILE: \(.*\):/\1:1:/' +${scriptpath}/checkpatch.pl --no-tree --show-types --strict --ignore="${ignore_str// /,}" $@ diff --git a/scripts/checkpatch_commits b/scripts/checkpatch_commits new file mode 100755 index 000000000..d83285125 --- /dev/null +++ b/scripts/checkpatch_commits @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +set -e + +rootdir=$(readlink -f $(dirname $0)/..) +scriptsdir=${rootdir}/scripts +base_commit=${1:-master} + +commits=$(cd ${rootdir} && git log --pretty=format:"%h" ${base_commit}..HEAD) +err=0 + +for commit in $commits; do + echo "Running checkpatch for commit $commit" + echo -e "========================================\n" + + (cd ${rootdir} && + git format-patch -1 --stdout $commit | ${scriptsdir}/checkpatch -) || err=1 + echo -e "\n" +done + +exit $err diff --git a/scripts/checkpatch_diff b/scripts/checkpatch_diff new file mode 100755 index 000000000..02b064a69 --- /dev/null +++ b/scripts/checkpatch_diff @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +set -e + +rootdir=$(readlink -f $(dirname $0)/..) +scriptsdir=${rootdir}/scripts +base_commit=${1:-master} + +err=0 + +(cd ${rootdir} && git diff ${base_commit} | ${scriptsdir}/checkpatch -) || err=1 + +exit $err diff --git a/scripts/checkpatch_scan b/scripts/checkpatch_scan new file mode 100755 index 000000000..cc539b3e4 --- /dev/null +++ b/scripts/checkpatch_scan @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +set -e + +rootdir=$(readlink -f $(dirname $0)/..) +scriptsdir=${rootdir}/scripts +outputfile=checkpatch.out + +src_files=$(${scriptsdir}/list-source-files ${rootdir} | \ + grep -vE '^debian/|^fcst/linux-patches|patch$|pdf$|png$|^iscsi-scst/usr|^qla|^scripts/|^scstadmin/|^usr/|^www/' | \ + while read -r filename; do echo "${rootdir}/$filename"; done) + +${scriptsdir}/checkpatch -f $src_files 1> ${outputfile} || true + +errors=$(grep -c '^ERROR' "${outputfile}") +warnings=$(grep -c '^WARNING' "${outputfile}") +checks=$(grep -c '^CHECK' "${outputfile}") + +echo "${errors} errors / ${warnings} warnings / ${checks} checks." + +grep -E '^WARNING|^ERROR|^CHECK' "${outputfile}" | + sort | + sed 's/^CHECK:CAMELCASE: Avoid CamelCase:.*/CHECK:CAMELCASE Avoid CamelCase/' | + uniq -c From 61f365f96ea36c891a630f045f45c42caf897f58 Mon Sep 17 00:00:00 2001 From: Gleb Chesnokov Date: Thu, 7 Nov 2024 13:36:27 +0300 Subject: [PATCH 5/7] scst: Expand all create*_workqueue() invocations The workqueue maintainer wants to remove the create*_workqueue() macros because these macros always set the WQ_MEM_RECLAIM flag and because these only support literal workqueue names. Hence this patch that replaces the create*_workqueue() invocations with the definition of this macro. The WQ_MEM_RECLAIM flag has been retained because I think that flag is necessary for workqueues created by storage drivers. --- iscsi-scst/kernel/isert-scst/iser_rdma.c | 3 +-- qla2x00t-32gbit/qla_os.c | 6 ++++-- scst/src/scst_dlm.c | 2 +- scst_local/scst_local.c | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/iscsi-scst/kernel/isert-scst/iser_rdma.c b/iscsi-scst/kernel/isert-scst/iser_rdma.c index c5e30b167..08a7bbeaa 100644 --- a/iscsi-scst/kernel/isert-scst/iser_rdma.c +++ b/iscsi-scst/kernel/isert-scst/iser_rdma.c @@ -979,8 +979,7 @@ static struct isert_device *isert_device_create(struct ib_device *ib_dev) snprintf(wq_name, sizeof(wq_name), "isert_cq_%p", cq_desc); cq_desc->cq_workqueue = alloc_workqueue(wq_name, - WQ_CPU_INTENSIVE| - WQ_MEM_RECLAIM, 1); + WQ_CPU_INTENSIVE | WQ_MEM_RECLAIM, 1); if (unlikely(!cq_desc->cq_workqueue)) { PRINT_ERROR("Failed to alloc iser cq work queue for dev:%s", ib_dev->name); diff --git a/qla2x00t-32gbit/qla_os.c b/qla2x00t-32gbit/qla_os.c index 31dc333f4..5d882effc 100644 --- a/qla2x00t-32gbit/qla_os.c +++ b/qla2x00t-32gbit/qla_os.c @@ -3568,11 +3568,13 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) if (IS_QLA8031(ha) || IS_MCTP_CAPABLE(ha)) { sprintf(wq_name, "qla2xxx_%lu_dpc_lp_wq", base_vha->host_no); - ha->dpc_lp_wq = create_singlethread_workqueue(wq_name); + ha->dpc_lp_wq = + alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM, wq_name); INIT_WORK(&ha->idc_aen, qla83xx_service_idc_aen); sprintf(wq_name, "qla2xxx_%lu_dpc_hp_wq", base_vha->host_no); - ha->dpc_hp_wq = create_singlethread_workqueue(wq_name); + ha->dpc_hp_wq = + alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM, wq_name); INIT_WORK(&ha->nic_core_reset, qla83xx_nic_core_reset_work); INIT_WORK(&ha->idc_state_handler, qla83xx_idc_state_handler_work); diff --git a/scst/src/scst_dlm.c b/scst/src/scst_dlm.c index 7e634afcf..4895df446 100644 --- a/scst/src/scst_dlm.c +++ b/scst/src/scst_dlm.c @@ -1480,7 +1480,7 @@ create_st_wq(const char *fmt, ...) name = kvasprintf(GFP_KERNEL, fmt, ap); va_end(ap); if (name) - wq = create_singlethread_workqueue(name); + wq = alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM, name); kfree(name); return wq; } diff --git a/scst_local/scst_local.c b/scst_local/scst_local.c index 902153220..0a48c9b93 100644 --- a/scst_local/scst_local.c +++ b/scst_local/scst_local.c @@ -1791,7 +1791,7 @@ static int __init scst_local_init(void) * We don't expect much work on this queue, so only create a * single thread workqueue rather than one on each core. */ - aen_workqueue = create_singlethread_workqueue("scstlclaen"); + aen_workqueue = alloc_ordered_workqueue("scstlclaen", WQ_MEM_RECLAIM); if (!aen_workqueue) { PRINT_ERROR("%s", "Unable to create scst_local workqueue"); goto tgt_templ_unreg; From 2fea7e484f3ddff369503295ede5401f73c2dfc8 Mon Sep 17 00:00:00 2001 From: Gleb Chesnokov Date: Thu, 7 Nov 2024 13:39:25 +0300 Subject: [PATCH 6/7] qla2x00t-32gbit: Remove the unused 'del_list_entry' field in struct fc_port The 'del_list_entry' field in "struct fc_port" is unused. The field was introduced in commit 2d70c103fd2a ("[SCSI] qla2xxx: Add LLD target-mode infrastructure for >= 24xx series") in 2012-05 and the last user was removed in commit 726b85487067 ("qla2xxx: Add framework for async fabric discovery") in 2017-02. Remove this unused field. Signed-off-by: Christophe JAILLET Link: https://lore.kernel.org/r/69155321ab26c1f4d473d5bb6cd44b59b9b6a020.1724094686.git.christophe.jaillet@wanadoo.fr Signed-off-by: Martin K. Petersen [ commit e59f43fb6477 upstream ] --- qla2x00t-32gbit/qla_def.h | 1 - 1 file changed, 1 deletion(-) diff --git a/qla2x00t-32gbit/qla_def.h b/qla2x00t-32gbit/qla_def.h index 09f4a6c90..270705503 100644 --- a/qla2x00t-32gbit/qla_def.h +++ b/qla2x00t-32gbit/qla_def.h @@ -2681,7 +2681,6 @@ typedef struct fc_port { struct kref sess_kref; struct qla_tgt *tgt; unsigned long expires; - struct list_head del_list_entry; struct work_struct free_work; struct work_struct reg_work; uint64_t jiffies_at_registration; From 70cf2f6271fc7efccabc069dd5ae0a4763db13b2 Mon Sep 17 00:00:00 2001 From: Dhananjay Kamble Date: Tue, 5 Nov 2024 15:10:38 -0500 Subject: [PATCH 7/7] scst: Unbreak the RHEL 9.5 build --- scst/include/backport.h | 4 +++- scst/src/dev_handlers/scst_tape.c | 4 +++- scst/src/scst_lib.c | 8 ++++++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/scst/include/backport.h b/scst/include/backport.h index 6651a39a2..803fcf6e4 100644 --- a/scst/include/backport.h +++ b/scst/include/backport.h @@ -288,7 +288,9 @@ static inline void blkdev_put_backport(struct block_device *bdev, void *holder) #if LINUX_VERSION_CODE < KERNEL_VERSION(6, 7, 0) && \ (LINUX_VERSION_CODE >> 8 != KERNEL_VERSION(6, 6, 0) >> 8 || \ - LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 23)) + LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 23)) && \ + (!defined(RHEL_RELEASE_CODE) || \ + RHEL_RELEASE_CODE -0 < RHEL_RELEASE_VERSION(9, 5)) /* * See also commit e719b4d15674 ("block: Provide bdev_open_* functions") # v6.7, v6.6.23. */ diff --git a/scst/src/dev_handlers/scst_tape.c b/scst/src/dev_handlers/scst_tape.c index f164390b8..c744ba2ab 100644 --- a/scst/src/dev_handlers/scst_tape.c +++ b/scst/src/dev_handlers/scst_tape.c @@ -173,7 +173,9 @@ static int tape_attach(struct scst_device *dev) ((dev->scsi_dev->scsi_level <= SCSI_2) ? ((dev->scsi_dev->lun << 5) & 0xe0) : 0), 0 /* Mode Page 0 */, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 5, 0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 5, 0) || \ + (defined(RHEL_RELEASE_CODE) && \ + RHEL_RELEASE_CODE -0 >= RHEL_RELEASE_VERSION(9, 5)) 0 /* Sub Page */, #endif buffer, buffer_size, diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index 5dcb8b141..2e322d9a1 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -6083,7 +6083,9 @@ int scst_open_bdev_by_path(const char *path, blk_mode_t mode, void *holder, const struct blk_holder_ops *hops, struct scst_bdev_descriptor *bdev_desc) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 9, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 9, 0) && \ + (!defined(RHEL_RELEASE_CODE) || \ + RHEL_RELEASE_CODE -0 < RHEL_RELEASE_VERSION(9, 5)) struct bdev_handle *bdev_handle; bdev_handle = bdev_open_by_path(path, mode, holder, hops); @@ -6109,7 +6111,9 @@ EXPORT_SYMBOL(scst_open_bdev_by_path); void scst_release_bdev(struct scst_bdev_descriptor *bdev_desc) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 9, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 9, 0) && \ + (!defined(RHEL_RELEASE_CODE) || \ + RHEL_RELEASE_CODE -0 < RHEL_RELEASE_VERSION(9, 5)) struct bdev_handle *bdev_handle = bdev_desc->priv; if (bdev_handle)