You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(19) |
Nov
(18) |
Dec
(34) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(14) |
Feb
(14) |
Mar
(3) |
Apr
(10) |
May
(10) |
Jun
(17) |
Jul
(15) |
Aug
(24) |
Sep
(24) |
Oct
(11) |
Nov
(13) |
Dec
(15) |
2008 |
Jan
(10) |
Feb
(46) |
Mar
(20) |
Apr
(42) |
May
(44) |
Jun
(22) |
Jul
(59) |
Aug
(8) |
Sep
(15) |
Oct
(52) |
Nov
(30) |
Dec
(38) |
2009 |
Jan
(27) |
Feb
(27) |
Mar
(47) |
Apr
(85) |
May
(74) |
Jun
(41) |
Jul
(70) |
Aug
(64) |
Sep
(97) |
Oct
(147) |
Nov
(67) |
Dec
(48) |
2010 |
Jan
(68) |
Feb
(33) |
Mar
(53) |
Apr
(98) |
May
(55) |
Jun
(71) |
Jul
(99) |
Aug
(132) |
Sep
(291) |
Oct
(220) |
Nov
(344) |
Dec
(300) |
2011 |
Jan
(57) |
Feb
(25) |
Mar
(59) |
Apr
(104) |
May
(60) |
Jun
(155) |
Jul
(143) |
Aug
(43) |
Sep
(53) |
Oct
(20) |
Nov
(35) |
Dec
(103) |
2012 |
Jan
(62) |
Feb
(43) |
Mar
(29) |
Apr
(80) |
May
(75) |
Jun
(61) |
Jul
(52) |
Aug
(58) |
Sep
(33) |
Oct
(32) |
Nov
(69) |
Dec
(37) |
2013 |
Jan
(77) |
Feb
(28) |
Mar
(52) |
Apr
(18) |
May
(37) |
Jun
(21) |
Jul
(22) |
Aug
(55) |
Sep
(29) |
Oct
(74) |
Nov
(50) |
Dec
(44) |
2014 |
Jan
(77) |
Feb
(62) |
Mar
(81) |
Apr
(99) |
May
(59) |
Jun
(95) |
Jul
(55) |
Aug
(34) |
Sep
(78) |
Oct
(33) |
Nov
(48) |
Dec
(51) |
2015 |
Jan
(56) |
Feb
(120) |
Mar
(37) |
Apr
(15) |
May
(22) |
Jun
(196) |
Jul
(54) |
Aug
(33) |
Sep
(32) |
Oct
(42) |
Nov
(149) |
Dec
(61) |
2016 |
Jan
(15) |
Feb
(26) |
Mar
(37) |
Apr
(27) |
May
(14) |
Jun
(11) |
Jul
(13) |
Aug
(64) |
Sep
(2) |
Oct
(36) |
Nov
(18) |
Dec
(46) |
2017 |
Jan
(6) |
Feb
(1) |
Mar
(2) |
Apr
(50) |
May
(42) |
Jun
(11) |
Jul
(4) |
Aug
(12) |
Sep
(11) |
Oct
(21) |
Nov
(15) |
Dec
(42) |
2018 |
Jan
(33) |
Feb
(27) |
Mar
(20) |
Apr
(5) |
May
(4) |
Jun
(1) |
Jul
(42) |
Aug
(29) |
Sep
(11) |
Oct
(40) |
Nov
(312) |
Dec
(18) |
2019 |
Jan
(44) |
Feb
(98) |
Mar
(125) |
Apr
(160) |
May
(123) |
Jun
(33) |
Jul
(56) |
Aug
(81) |
Sep
(24) |
Oct
(23) |
Nov
(52) |
Dec
(86) |
2020 |
Jan
(6) |
Feb
(17) |
Mar
(62) |
Apr
(21) |
May
(118) |
Jun
(42) |
Jul
(52) |
Aug
(62) |
Sep
(20) |
Oct
(5) |
Nov
(23) |
Dec
(111) |
2021 |
Jan
(31) |
Feb
(8) |
Mar
(26) |
Apr
(13) |
May
(54) |
Jun
(31) |
Jul
(17) |
Aug
(10) |
Sep
(83) |
Oct
(8) |
Nov
(21) |
Dec
(33) |
2022 |
Jan
(67) |
Feb
(11) |
Mar
(4) |
Apr
(46) |
May
(12) |
Jun
(17) |
Jul
(19) |
Aug
(7) |
Sep
(53) |
Oct
(14) |
Nov
(29) |
Dec
(22) |
2023 |
Jan
(20) |
Feb
(4) |
Mar
(37) |
Apr
(25) |
May
(15) |
Jun
(20) |
Jul
(38) |
Aug
(1) |
Sep
(1) |
Oct
(34) |
Nov
|
Dec
(8) |
2024 |
Jan
(15) |
Feb
(10) |
Mar
|
Apr
(4) |
May
(23) |
Jun
|
Jul
(8) |
Aug
(2) |
Sep
(18) |
Oct
(1) |
Nov
(18) |
Dec
(15) |
2025 |
Jan
(5) |
Feb
(1) |
Mar
(7) |
Apr
(4) |
May
(18) |
Jun
(7) |
Jul
|
Aug
(17) |
Sep
(13) |
Oct
(13) |
Nov
|
Dec
|
From: Gleb C. <lna...@ya...> - 2025-10-21 09:23:15
|
Commit: 08f5f43 GitHub URL: https://github.com/SCST-project/scst/commit/08f5f43df82f70c44b2ab13356adee9346d9dc77 Author: Gleb Chesnokov Date: 2025-10-21T12:18:36+03:00 Log Message: ----------- fcst: Fix multiple checkpatch warnings This patch does not change any functionality. Modified Paths: -------------- fcst/ft_cmd.c | 10 ++++++---- fcst/ft_io.c | 8 +++++--- fcst/ft_scst.c | 2 +- fcst/ft_sess.c | 11 +++++------ 4 files changed, 17 insertions(+), 14 deletions(-) =================================================================== diff --git a/fcst/ft_cmd.c b/fcst/ft_cmd.c index 3519a0a..2185187 100644 --- a/fcst/ft_cmd.c +++ b/fcst/ft_cmd.c @@ -213,9 +213,10 @@ int ft_send_response(struct scst_cmd *cmd) scst_cmd_get_resp_data_len(cmd); if (bi_resid) len += sizeof(__be32); - } else + } else { resid = (signed int)scst_cmd_get_bufflen(cmd) - scst_cmd_get_resp_data_len(cmd); + } } fp = fc_frame_alloc(lport, len); @@ -237,16 +238,18 @@ int ft_send_response(struct scst_cmd *cmd) if (bi_resid < 0) { fcp->resp.fr_flags |= FCP_BIDI_READ_OVER; bi_resid = -bi_resid; - } else + } else { fcp->resp.fr_flags |= FCP_BIDI_READ_UNDER; + } *(__be32 *)((u8 *)(fcp + 1) + slen) = htonl(bi_resid); } if (resid) { if (resid < 0) { resid = -resid; fcp->resp.fr_flags |= FCP_RESID_OVER; - } else + } else { fcp->resp.fr_flags |= FCP_RESID_UNDER; + } fcp->ext.fr_resid = htonl(resid); } FT_IO_DBG("response did %x oxid %x\n", ep->did, ep->oxid); @@ -285,7 +288,6 @@ err: "%s: invalid error code %d\n", __func__, error); return error; - } /* diff --git a/fcst/ft_io.c b/fcst/ft_io.c index face322..c225107 100644 --- a/fcst/ft_io.c +++ b/fcst/ft_io.c @@ -81,7 +81,7 @@ int ft_send_read_data(struct scst_cmd *cmd) return SCST_TGT_RES_SUCCESS; } FT_IO_DBG("sid %x oxid %x mem_len %zd frame_off %u remaining %zd\n", - ep->sid, ep->oxid, mem_len, frame_off, remaining); + ep->sid, ep->oxid, mem_len, frame_off, remaining); /* * If we've already transferred some of the data, skip through @@ -99,12 +99,13 @@ int ft_send_read_data(struct scst_cmd *cmd) } mem_len -= tlen; mem_off = tlen; - } else + } else { #ifdef NEW_LIBFC_API fcmd->seq = fc_seq_start_next(fcmd->seq); #else fcmd->seq = lport->tt.seq_start_next(fcmd->seq); #endif + } /* no scatter/gather in skb for odd word length due to fc_seq_send() */ use_sg = !(remaining % 4) && lport->sg_supp; @@ -202,8 +203,9 @@ int ft_send_read_data(struct scst_cmd *cmd) "retrying" : "giving up"); return error == -ENOMEM ? SCST_TGT_RES_QUEUE_FULL : SCST_TGT_RES_FATAL_ERROR; - } else + } else { fcmd->read_data_len = frame_off; + } } if (mem_len) scst_put_buf(cmd, from); diff --git a/fcst/ft_scst.c b/fcst/ft_scst.c index 447884a..6d88020 100644 --- a/fcst/ft_scst.c +++ b/fcst/ft_scst.c @@ -22,7 +22,7 @@ #include "fcst.h" unsigned int ft_debug_logging; -module_param_named(debug_logging, ft_debug_logging, int, S_IRUGO | S_IWUSR); +module_param_named(debug_logging, ft_debug_logging, int, 0644); MODULE_PARM_DESC(debug_logging, "log levels bigmask"); DEFINE_MUTEX(ft_lport_lock); diff --git a/fcst/ft_sess.c b/fcst/ft_sess.c index 237457b..5dee7af 100644 --- a/fcst/ft_sess.c +++ b/fcst/ft_sess.c @@ -301,8 +301,7 @@ static void ft_sess_close(struct ft_sess *sess) /* * Allocate and fill in the SPC Transport ID for persistent reservations. */ -int ft_get_transport_id(struct scst_tgt *tgt, struct scst_session *scst_sess, - uint8_t **result) +int ft_get_transport_id(struct scst_tgt *tgt, struct scst_session *scst_sess, uint8_t **result) { struct ft_sess *sess; struct { @@ -413,7 +412,7 @@ static int ft_prli(struct fc_rport_priv *rdata, u32 spp_len, ret = ft_prli_locked(rdata, spp_len, rspp, spp); mutex_unlock(&ft_lport_lock); FT_SESS_DBG("port_id %x flags %x ret %x\n", - rdata->ids.port_id, rspp ? rspp->spp_flags : 0, ret); + rdata->ids.port_id, rspp ? rspp->spp_flags : 0, ret); return ret; } @@ -486,7 +485,7 @@ static void ft_recv(struct fc_lport *lport, struct fc_frame *fp) return; } FT_SESS_DBG("sid %x sess lookup returned %p preempt %x\n", - sid, sess, preempt_count()); + sid, sess, preempt_count()); ft_recv_req(sess, fp); ft_sess_put(sess); } @@ -523,7 +522,7 @@ int ft_tgt_enable(struct scst_tgt *tgt, bool enable) if (enable) { FT_SESS_DBG("enable tgt %s\n", tgt->tgt_name); tport = scst_tgt_get_tgt_priv(tgt); - if (tport == NULL) { + if (!tport) { ret = -E_TGT_PRIV_NOT_YET_SET; goto out; } @@ -542,7 +541,7 @@ bool ft_tgt_enabled(struct scst_tgt *tgt) { struct ft_tport *tport; - if (tgt == NULL) + if (!tgt) return false; tport = scst_tgt_get_tgt_priv(tgt); |
From: Gleb C. <lna...@ya...> - 2025-10-21 09:22:40
|
Commit: dff8aed GitHub URL: https://github.com/SCST-project/scst/commit/dff8aedcaaca47a9b1422553d6e9dea0a98994a5 Author: Gleb Chesnokov Date: 2025-10-21T12:18:36+03:00 Log Message: ----------- scst_priv.h: Drop redundant 'extern' from function prototypes This patch does not change any functionality. Modified Paths: -------------- scst/src/scst_priv.h | 32 +++++++-------- 1 file changed, 16 insertions(+), 16 deletions(-) =================================================================== diff --git a/scst/src/scst_priv.h b/scst/src/scst_priv.h index 3f0313c..226724e 100644 --- a/scst/src/scst_priv.h +++ b/scst/src/scst_priv.h @@ -264,17 +264,17 @@ static inline void scst_reset_io_context(struct scst_tgt_dev *tgt_dev, struct io * Converts string presentation of threads pool type to enum. * Returns SCST_THREADS_POOL_TYPE_INVALID if the string is invalid. */ -extern enum scst_dev_type_threads_pool_type scst_parse_threads_pool_type(const char *p, int len); +enum scst_dev_type_threads_pool_type scst_parse_threads_pool_type(const char *p, int len); -extern int scst_add_threads(struct scst_cmd_threads *cmd_threads, struct scst_device *dev, - struct scst_tgt_dev *tgt_dev, int num); -extern void scst_del_threads(struct scst_cmd_threads *cmd_threads, int num); +int scst_add_threads(struct scst_cmd_threads *cmd_threads, struct scst_device *dev, + struct scst_tgt_dev *tgt_dev, int num); +void scst_del_threads(struct scst_cmd_threads *cmd_threads, int num); -extern int scst_create_dev_threads(struct scst_device *dev); -extern void scst_stop_dev_threads(struct scst_device *dev); +int scst_create_dev_threads(struct scst_device *dev); +void scst_stop_dev_threads(struct scst_device *dev); -extern int scst_tgt_dev_setup_threads(struct scst_tgt_dev *tgt_dev); -extern void scst_tgt_dev_stop_threads(struct scst_tgt_dev *tgt_dev); +int scst_tgt_dev_setup_threads(struct scst_tgt_dev *tgt_dev); +void scst_tgt_dev_stop_threads(struct scst_tgt_dev *tgt_dev); extern struct scst_dev_type scst_null_devtype; @@ -282,10 +282,10 @@ char *scst_get_cmd_state_name(char *name, int len, unsigned int state); char *scst_get_mcmd_state_name(char *name, int len, unsigned int state); char *scst_get_tm_fn_name(char *name, int len, unsigned int fn); -extern struct scst_cmd *__scst_check_deferred_commands_locked(struct scst_order_data *order_data, - bool return_first); -extern struct scst_cmd *__scst_check_deferred_commands(struct scst_order_data *order_data, +struct scst_cmd *__scst_check_deferred_commands_locked(struct scst_order_data *order_data, bool return_first); +struct scst_cmd *__scst_check_deferred_commands(struct scst_order_data *order_data, + bool return_first); /* Used to save the function call on the fast path */ static inline struct scst_cmd *scst_check_deferred_commands(struct scst_order_data *order_data, @@ -763,11 +763,11 @@ int scst_cm_init(void); void scst_cm_exit(void); #ifdef CONFIG_SCST_DEBUG_TM -extern void tm_dbg_check_released_cmds(void); -extern int tm_dbg_check_cmd(struct scst_cmd *cmd); -extern void tm_dbg_release_cmd(struct scst_cmd *cmd); -extern void tm_dbg_task_mgmt(struct scst_device *dev, const char *fn, int force); -extern int tm_dbg_is_release(void); +void tm_dbg_check_released_cmds(void); +int tm_dbg_check_cmd(struct scst_cmd *cmd); +void tm_dbg_release_cmd(struct scst_cmd *cmd); +void tm_dbg_task_mgmt(struct scst_device *dev, const char *fn, int force); +int tm_dbg_is_release(void); #else static inline void tm_dbg_check_released_cmds(void) { |
From: Gleb C. <lna...@ya...> - 2025-10-21 09:22:27
|
Commit: 3928d6d GitHub URL: https://github.com/SCST-project/scst/commit/3928d6d74ff63b777be61b1e046cd40b755279b2 Author: Gleb Chesnokov Date: 2025-10-21T12:18:36+03:00 Log Message: ----------- iscsi-scst: Drop redundant 'extern' from function prototypes This patch does not change any functionality. Modified Paths: -------------- iscsi-scst/include/iscsit_transport.h | 6 +- iscsi-scst/kernel/digest.h | 15 +- iscsi-scst/kernel/iscsi.h | 175 +++++++-------- iscsi-scst/kernel/iscsi_dbg.h | 5 +- 4 files changed, 102 insertions(+), 99 deletions(-) =================================================================== diff --git a/iscsi-scst/include/iscsit_transport.h b/iscsi-scst/include/iscsit_transport.h index 116f724..5528904 100644 --- a/iscsi-scst/include/iscsit_transport.h +++ b/iscsi-scst/include/iscsit_transport.h @@ -61,8 +61,8 @@ struct iscsit_transport { struct list_head transport_list_entry; } ____cacheline_aligned; -extern int iscsit_reg_transport(struct iscsit_transport *t); -extern void iscsit_unreg_transport(struct iscsit_transport *t); -extern struct iscsit_transport *iscsit_get_transport(enum iscsit_transport_type type); +int iscsit_reg_transport(struct iscsit_transport *t); +void iscsit_unreg_transport(struct iscsit_transport *t); +struct iscsit_transport *iscsit_get_transport(enum iscsit_transport_type type); #endif /* __ISCSI_TRANSPORT_H__ */ diff --git a/iscsi-scst/kernel/digest.h b/iscsi-scst/kernel/digest.h index 8ed9bf4..95df376 100644 --- a/iscsi-scst/kernel/digest.h +++ b/iscsi-scst/kernel/digest.h @@ -18,14 +18,17 @@ #ifndef __ISCSI_DIGEST_H__ #define __ISCSI_DIGEST_H__ -extern void digest_alg_available(int *val); +struct iscsi_conn; +struct iscsi_cmnd; -extern int digest_init(struct iscsi_conn *conn); +void digest_alg_available(int *val); -extern int digest_rx_header(struct iscsi_cmnd *cmnd); -extern int digest_rx_data(struct iscsi_cmnd *cmnd); +int digest_init(struct iscsi_conn *conn); -extern void digest_tx_header(struct iscsi_cmnd *cmnd); -extern void digest_tx_data(struct iscsi_cmnd *cmnd); +int digest_rx_header(struct iscsi_cmnd *cmnd); +int digest_rx_data(struct iscsi_cmnd *cmnd); + +void digest_tx_header(struct iscsi_cmnd *cmnd); +void digest_tx_data(struct iscsi_cmnd *cmnd); #endif /* __ISCSI_DIGEST_H__ */ diff --git a/iscsi-scst/kernel/iscsi.h b/iscsi-scst/kernel/iscsi.h index 8b9728c..e0eac07 100644 --- a/iscsi-scst/kernel/iscsi.h +++ b/iscsi-scst/kernel/iscsi.h @@ -531,96 +531,96 @@ extern struct kmem_cache *iscsi_conn_cache; extern struct kmem_cache *iscsi_sess_cache; /* iscsi.c */ -extern int cmnd_rx_start(struct iscsi_cmnd *cmnd); -extern int cmnd_rx_continue(struct iscsi_cmnd *req); -extern void cmnd_rx_end(struct iscsi_cmnd *cmnd); -extern void cmnd_tx_start(struct iscsi_cmnd *cmnd); -extern void cmnd_tx_end(struct iscsi_cmnd *cmnd); -extern void req_cmnd_release_force(struct iscsi_cmnd *req); -extern void rsp_cmnd_release(struct iscsi_cmnd *cmnd); -extern void iscsi_drop_delayed_tm_rsp(struct iscsi_cmnd *tm_rsp); -extern void cmnd_done(struct iscsi_cmnd *cmnd); -extern void conn_abort(struct iscsi_conn *conn); -extern void iscsi_restart_cmnd(struct iscsi_cmnd *cmnd); -extern void iscsi_fail_data_waiting_cmnd(struct iscsi_cmnd *cmnd); -extern void iscsi_send_nop_in(struct iscsi_conn *conn); -extern int iscsi_preliminary_complete(struct iscsi_cmnd *req, struct iscsi_cmnd *orig_req, - bool get_data); -extern int set_scst_preliminary_status_rsp(struct iscsi_cmnd *req, bool get_data, int key, int asc, - int ascq); -extern int iscsi_threads_pool_get(bool dedicated, const cpumask_t *cpu_mask, - struct iscsi_thread_pool **out_pool); -extern void iscsi_threads_pool_put(struct iscsi_thread_pool *p); +int cmnd_rx_start(struct iscsi_cmnd *cmnd); +int cmnd_rx_continue(struct iscsi_cmnd *req); +void cmnd_rx_end(struct iscsi_cmnd *cmnd); +void cmnd_tx_start(struct iscsi_cmnd *cmnd); +void cmnd_tx_end(struct iscsi_cmnd *cmnd); +void req_cmnd_release_force(struct iscsi_cmnd *req); +void rsp_cmnd_release(struct iscsi_cmnd *cmnd); +void iscsi_drop_delayed_tm_rsp(struct iscsi_cmnd *tm_rsp); +void cmnd_done(struct iscsi_cmnd *cmnd); +void conn_abort(struct iscsi_conn *conn); +void iscsi_restart_cmnd(struct iscsi_cmnd *cmnd); +void iscsi_fail_data_waiting_cmnd(struct iscsi_cmnd *cmnd); +void iscsi_send_nop_in(struct iscsi_conn *conn); +int iscsi_preliminary_complete(struct iscsi_cmnd *req, struct iscsi_cmnd *orig_req, bool get_data); +int set_scst_preliminary_status_rsp(struct iscsi_cmnd *req, bool get_data, int key, int asc, + int ascq); +int iscsi_threads_pool_get(bool dedicated, const cpumask_t *cpu_mask, + struct iscsi_thread_pool **out_pool); +void iscsi_threads_pool_put(struct iscsi_thread_pool *p); /* conn.c */ extern struct kobj_type iscsi_conn_ktype; -extern struct iscsi_conn *conn_lookup(struct iscsi_session *session, u16 cid); -extern void conn_reinst_finished(struct iscsi_conn *conn); -extern int __add_conn(struct iscsi_session *session, struct iscsi_kern_conn_info *info); -extern int __del_conn(struct iscsi_session *session, struct iscsi_kern_conn_info *info); -extern void conn_free(struct iscsi_conn *conn); -extern void iscsi_make_conn_rd_active(struct iscsi_conn *conn); + +struct iscsi_conn *conn_lookup(struct iscsi_session *session, u16 cid); +void conn_reinst_finished(struct iscsi_conn *conn); +int __add_conn(struct iscsi_session *session, struct iscsi_kern_conn_info *info); +int __del_conn(struct iscsi_session *session, struct iscsi_kern_conn_info *info); +void conn_free(struct iscsi_conn *conn); +void iscsi_make_conn_rd_active(struct iscsi_conn *conn); #define ISCSI_CONN_ACTIVE_CLOSE 1 #define ISCSI_CONN_DELETING 2 -extern void __mark_conn_closed(struct iscsi_conn *conn, int flags); -extern void mark_conn_closed(struct iscsi_conn *conn); -extern void iscsi_make_conn_wr_active(struct iscsi_conn *conn); -extern void iscsi_check_tm_data_wait_timeouts(struct iscsi_conn *conn, bool force); -extern void __iscsi_write_space_ready(struct iscsi_conn *conn); +void __mark_conn_closed(struct iscsi_conn *conn, int flags); +void mark_conn_closed(struct iscsi_conn *conn); +void iscsi_make_conn_wr_active(struct iscsi_conn *conn); +void iscsi_check_tm_data_wait_timeouts(struct iscsi_conn *conn, bool force); +void __iscsi_write_space_ready(struct iscsi_conn *conn); /* nthread.c */ -extern int iscsi_send(struct iscsi_conn *conn); -extern int istrd(void *arg); -extern int istwr(void *arg); -extern void iscsi_task_mgmt_affected_cmds_done(struct scst_mgmt_cmd *scst_mcmd); -extern void req_add_to_write_timeout_list(struct iscsi_cmnd *req); +int iscsi_send(struct iscsi_conn *conn); +int istrd(void *arg); +int istwr(void *arg); +void iscsi_task_mgmt_affected_cmds_done(struct scst_mgmt_cmd *scst_mcmd); +void req_add_to_write_timeout_list(struct iscsi_cmnd *req); /* target.c */ extern const struct attribute *iscsi_tgt_attrs[]; -extern int iscsi_enable_target(struct scst_tgt *scst_tgt, bool enable); -extern bool iscsi_is_target_enabled(struct scst_tgt *scst_tgt); -extern ssize_t iscsi_sysfs_send_event(uint32_t tid, enum iscsi_kern_event_code code, - const char *param1, const char *param2, void **data); -extern struct iscsi_target *target_lookup_by_id(u32 id); -extern int __add_target(struct iscsi_kern_target_info *info); -extern int __del_target(u32 id); -extern ssize_t iscsi_sysfs_add_target(const char *target_name, char *params); -extern ssize_t iscsi_sysfs_del_target(const char *target_name); -extern ssize_t iscsi_sysfs_mgmt_cmd(char *cmd); -extern void target_del_session(struct iscsi_target *target, struct iscsi_session *session, - int flags); -extern void target_del_all_sess(struct iscsi_target *target, int flags); -extern void target_del_all(void); + +int iscsi_enable_target(struct scst_tgt *scst_tgt, bool enable); +bool iscsi_is_target_enabled(struct scst_tgt *scst_tgt); +ssize_t iscsi_sysfs_send_event(uint32_t tid, enum iscsi_kern_event_code code, const char *param1, + const char *param2, void **data); +struct iscsi_target *target_lookup_by_id(u32 id); +int __add_target(struct iscsi_kern_target_info *info); +int __del_target(u32 id); +ssize_t iscsi_sysfs_add_target(const char *target_name, char *params); +ssize_t iscsi_sysfs_del_target(const char *target_name); +ssize_t iscsi_sysfs_mgmt_cmd(char *cmd); +void target_del_session(struct iscsi_target *target, struct iscsi_session *session, int flags); +void target_del_all_sess(struct iscsi_target *target, int flags); +void target_del_all(void); /* config.c */ -extern int conn_sysfs_add(struct iscsi_conn *conn); extern const struct attribute *iscsi_attrs[]; -extern int iscsi_add_attr(struct iscsi_target *target, const struct iscsi_kern_attr *user_info); -extern void __iscsi_del_attr(struct iscsi_target *target, struct iscsi_attr *tgt_attr); + +int conn_sysfs_add(struct iscsi_conn *conn); +int iscsi_add_attr(struct iscsi_target *target, const struct iscsi_kern_attr *user_info); +void __iscsi_del_attr(struct iscsi_target *target, struct iscsi_attr *tgt_attr); /* session.c */ extern const struct attribute *iscsi_sess_attrs[]; extern const struct attribute *iscsi_acg_attrs[]; extern const struct file_operations session_seq_fops; -extern struct iscsi_session *session_lookup(struct iscsi_target *target, - u64 sid); -extern void sess_reinst_finished(struct iscsi_session *session); -extern int __add_session(struct iscsi_target *target, struct iscsi_kern_session_info *info); -extern int __del_session(struct iscsi_target *target, u64 sid); -extern int session_free(struct iscsi_session *session, bool del); -extern void iscsi_sess_force_close(struct iscsi_session *sess); + +struct iscsi_session *session_lookup(struct iscsi_target *target, u64 sid); +void sess_reinst_finished(struct iscsi_session *session); +int __add_session(struct iscsi_target *target, struct iscsi_kern_session_info *info); +int __del_session(struct iscsi_target *target, u64 sid); +int session_free(struct iscsi_session *session, bool del); +void iscsi_sess_force_close(struct iscsi_session *sess); /* params.c */ -extern const char *iscsi_get_digest_name(int val, char *res); -extern const char *iscsi_get_bool_value(int val); -extern int iscsi_params_set(struct iscsi_target *target, struct iscsi_kern_params_info *info, - int set); +const char *iscsi_get_digest_name(int val, char *res); +const char *iscsi_get_bool_value(int val); +int iscsi_params_set(struct iscsi_target *target, struct iscsi_kern_params_info *info, int set); /* event.c */ -extern int event_send(u32 tid, u64 sid, u32 cid, u32 cookie, enum iscsi_kern_event_code code, - const char *param1, const char *param2); -extern int event_init(void); -extern void event_exit(void); +int event_send(u32 tid, u64 sid, u32 cid, u32 cookie, enum iscsi_kern_event_code code, + const char *param1, const char *param2); +int event_init(void); +void event_exit(void); #define get_pgcnt(size, offset) \ ((((size) + ((offset) & ~PAGE_MASK)) + PAGE_SIZE - 1) >> PAGE_SHIFT) @@ -803,29 +803,28 @@ static inline void conn_put(struct iscsi_conn *conn) } #ifdef CONFIG_SCST_EXTRACHECKS -extern void iscsi_extracheck_is_rd_thread(struct iscsi_conn *conn); -extern void iscsi_extracheck_is_wr_thread(struct iscsi_conn *conn); +void iscsi_extracheck_is_rd_thread(struct iscsi_conn *conn); +void iscsi_extracheck_is_wr_thread(struct iscsi_conn *conn); #else static inline void iscsi_extracheck_is_rd_thread(struct iscsi_conn *conn) {} static inline void iscsi_extracheck_is_wr_thread(struct iscsi_conn *conn) {} #endif -extern int iscsi_conn_alloc(struct iscsi_session *session, struct iscsi_kern_conn_info *info, - struct iscsi_conn **new_conn, struct iscsit_transport *t); - -extern int conn_activate(struct iscsi_conn *conn); -extern void iscsi_tcp_mark_conn_closed(struct iscsi_conn *conn, int flags); -extern void iscsi_tcp_conn_free(struct iscsi_conn *conn); -extern void iscsi_cmnd_init(struct iscsi_conn *conn, struct iscsi_cmnd *cmnd, - struct iscsi_cmnd *parent); -extern struct iscsi_cmnd *iscsi_get_send_cmnd(struct iscsi_conn *conn); -extern void start_close_conn(struct iscsi_conn *conn); -extern __be32 cmnd_set_sn(struct iscsi_cmnd *cmnd, int set_stat_sn); -extern void iscsi_set_resid(struct iscsi_cmnd *rsp); -extern int iscsi_init_conn(struct iscsi_session *session, struct iscsi_kern_conn_info *info, - struct iscsi_conn *conn); -extern void req_cmnd_pre_release(struct iscsi_cmnd *req); -extern struct iscsi_cmnd *create_status_rsp(struct iscsi_cmnd *req, int status, - const u8 *sense_buf, int sense_len); -extern int iscsi_cmnd_set_write_buf(struct iscsi_cmnd *req); +int iscsi_conn_alloc(struct iscsi_session *session, struct iscsi_kern_conn_info *info, + struct iscsi_conn **new_conn, struct iscsit_transport *t); + +int conn_activate(struct iscsi_conn *conn); +void iscsi_tcp_mark_conn_closed(struct iscsi_conn *conn, int flags); +void iscsi_tcp_conn_free(struct iscsi_conn *conn); +void iscsi_cmnd_init(struct iscsi_conn *conn, struct iscsi_cmnd *cmnd, struct iscsi_cmnd *parent); +struct iscsi_cmnd *iscsi_get_send_cmnd(struct iscsi_conn *conn); +void start_close_conn(struct iscsi_conn *conn); +__be32 cmnd_set_sn(struct iscsi_cmnd *cmnd, int set_stat_sn); +void iscsi_set_resid(struct iscsi_cmnd *rsp); +int iscsi_init_conn(struct iscsi_session *session, struct iscsi_kern_conn_info *info, + struct iscsi_conn *conn); +void req_cmnd_pre_release(struct iscsi_cmnd *req); +struct iscsi_cmnd *create_status_rsp(struct iscsi_cmnd *req, int status, const u8 *sense_buf, + int sense_len); +int iscsi_cmnd_set_write_buf(struct iscsi_cmnd *req); #endif /* __ISCSI_H__ */ diff --git a/iscsi-scst/kernel/iscsi_dbg.h b/iscsi-scst/kernel/iscsi_dbg.h index 550e79b..144081c 100644 --- a/iscsi-scst/kernel/iscsi_dbg.h +++ b/iscsi-scst/kernel/iscsi_dbg.h @@ -47,8 +47,9 @@ #ifdef CONFIG_SCST_DEBUG struct iscsi_pdu; struct iscsi_cmnd; -extern void iscsi_dump_pdu(struct iscsi_pdu *pdu); -extern unsigned long iscsi_get_flow_ctrl_or_mgmt_dbg_log_flag(struct iscsi_cmnd *cmnd); + +void iscsi_dump_pdu(struct iscsi_pdu *pdu); +unsigned long iscsi_get_flow_ctrl_or_mgmt_dbg_log_flag(struct iscsi_cmnd *cmnd); #else #define iscsi_dump_pdu(x) do {} while (0) #define iscsi_get_flow_ctrl_or_mgmt_dbg_log_flag(x) 0 |
From: Gleb C. <lna...@ya...> - 2025-10-21 09:22:03
|
Commit: 6a2b3e3 GitHub URL: https://github.com/SCST-project/scst/commit/6a2b3e36e41e5eeae0f717d0ff01d797a0f08795 Author: Gleb Chesnokov Date: 2025-10-21T12:18:36+03:00 Log Message: ----------- ib_srpt: Fix multiple checkpatch warnings This patch does not change any functionality. Modified Paths: -------------- srpt/src/ib_srpt.c | 150 +++++++-------- 1 file changed, 66 insertions(+), 84 deletions(-) =================================================================== diff --git a/srpt/src/ib_srpt.c b/srpt/src/ib_srpt.c index 07d628c..270fae0 100644 --- a/srpt/src/ib_srpt.c +++ b/srpt/src/ib_srpt.c @@ -72,8 +72,7 @@ #define DEFAULT_SRPT_ID_STRING "SCST SRP target" MODULE_AUTHOR("Vu Pham and Bart Van Assche"); -MODULE_DESCRIPTION("SCSI RDMA Protocol target driver " - "v" DRV_VERSION " (" DRV_RELDATE ")"); +MODULE_DESCRIPTION("SCSI RDMA Protocol target driver v" DRV_VERSION " (" DRV_RELDATE ")"); MODULE_LICENSE("Dual BSD/GPL"); MODULE_IMPORT_NS(SCST_NAMESPACE); @@ -104,16 +103,16 @@ MODULE_PARM_DESC(srp_max_req_size, "Maximum size of SRP request messages in bytes."); static unsigned int srp_max_rsp_size = DEFAULT_MAX_RSP_SIZE; -module_param(srp_max_rsp_size, int, S_IRUGO | S_IWUSR); +module_param(srp_max_rsp_size, int, 0644); MODULE_PARM_DESC(srp_max_rsp_size, "Maximum size of SRP response messages in bytes."); static bool use_srq; -module_param(use_srq, bool, S_IRUGO | S_IWUSR); +module_param(use_srq, bool, 0644); MODULE_PARM_DESC(use_srq, "Whether or not to use SRQ"); static int srpt_srq_size = DEFAULT_SRPT_SRQ_SIZE; -module_param(srpt_srq_size, int, S_IRUGO | S_IWUSR); +module_param(srpt_srq_size, int, 0644); MODULE_PARM_DESC(srpt_srq_size, "Shared receive queue (SRQ) size."); @@ -432,14 +431,12 @@ static void srpt_get_ioc(struct srpt_port *sport, u32 slot, iocp = (struct ib_dm_ioc_profile *)mad->data; if (!slot || slot > 16) { - mad->mad_hdr.status - = cpu_to_be16(DM_MAD_STATUS_INVALID_FIELD); + mad->mad_hdr.status = cpu_to_be16(DM_MAD_STATUS_INVALID_FIELD); return; } if (slot > 2) { - mad->mad_hdr.status - = cpu_to_be16(DM_MAD_STATUS_NO_IOC); + mad->mad_hdr.status = cpu_to_be16(DM_MAD_STATUS_NO_IOC); return; } @@ -495,14 +492,12 @@ static void srpt_get_svc_entries(u64 ioc_guid, WARN_ON(!ioc_guid); if (!slot || slot > 16) { - mad->mad_hdr.status - = cpu_to_be16(DM_MAD_STATUS_INVALID_FIELD); + mad->mad_hdr.status = cpu_to_be16(DM_MAD_STATUS_INVALID_FIELD); return; } if (slot > 2 || lo > hi || hi > 1) { - mad->mad_hdr.status - = cpu_to_be16(DM_MAD_STATUS_NO_IOC); + mad->mad_hdr.status = cpu_to_be16(DM_MAD_STATUS_NO_IOC); return; } @@ -545,9 +540,9 @@ static void srpt_mgmt_method_get(struct srpt_port *sp, struct ib_mad *rq_mad, break; case DM_ATTR_SVC_ENTRIES: slot = be32_to_cpu(rq_mad->mad_hdr.attr_mod); - hi = (u8) ((slot >> 8) & 0xff); - lo = (u8) (slot & 0xff); - slot = (u16) ((slot >> 16) & 0xffff); + hi = (u8)((slot >> 8) & 0xff); + lo = (u8)(slot & 0xff); + slot = (u16)((slot >> 16) & 0xffff); srpt_get_svc_entries(srpt_service_guid, slot, hi, lo, rsp_mad); break; @@ -840,11 +835,9 @@ static void srpt_free_ioctx(struct srpt_device *sdev, struct srpt_ioctx *ioctx, * unit starts. * @dir: DMA data direction. */ -static struct srpt_ioctx **srpt_alloc_ioctx_ring(struct srpt_device *sdev, - int ring_size, int ioctx_size, - struct kmem_cache *buf_cache, - int alignment_offset, - enum dma_data_direction dir) +static struct srpt_ioctx **srpt_alloc_ioctx_ring(struct srpt_device *sdev, int ring_size, + int ioctx_size, struct kmem_cache *buf_cache, + int alignment_offset, enum dma_data_direction dir) { struct srpt_ioctx **ring; int i; @@ -1146,9 +1139,9 @@ static int srpt_get_desc_tbl(struct srpt_recv_ioctx *recv_ioctx, return -EINVAL; } - if (ioctx->n_rbuf == 1) + if (ioctx->n_rbuf == 1) { ioctx->rbufs = &ioctx->single_rbuf; - else { + } else { ioctx->rbufs = kmalloc_array(ioctx->n_rbuf, sizeof(*db), GFP_ATOMIC); if (!ioctx->rbufs) { @@ -1441,8 +1434,7 @@ static void srpt_abort_cmd(struct srpt_send_ioctx *ioctx, break; case SRPT_STATE_NEED_DATA: pr_debug("tag %#llx: RDMA read error\n", ioctx->cmd.tag); - scst_set_cmd_error(cmd, - SCST_LOAD_SENSE(scst_sense_write_error)); + scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_write_error)); scst_rx_data(cmd, SCST_RX_STATUS_ERROR_SENSE_SET, context); break; case SRPT_STATE_CMD_RSP_SENT: @@ -1753,7 +1745,7 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch, srp_cmd = recv_ioctx->ioctx.buf + recv_ioctx->ioctx.offset; cmd = &send_ioctx->cmd; - ret = scst_rx_cmd_prealloced(cmd, ch->sess, (u8 *) &srp_cmd->lun, + ret = scst_rx_cmd_prealloced(cmd, ch->sess, (u8 *)&srp_cmd->lun, sizeof(srp_cmd->lun), srp_cmd->cdb, sizeof(srp_cmd->cdb), in_interrupt()); if (ret) { @@ -1767,8 +1759,7 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch, if (ret) { pr_err("0x%llx: parsing SRP descriptor table failed.\n", srp_cmd->tag); - scst_set_cmd_error(cmd, - SCST_LOAD_SENSE(scst_sense_invalid_field_in_cdb)); + scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_invalid_field_in_cdb)); } switch (srp_cmd->task_attr) { @@ -2262,8 +2253,7 @@ retry: ib_req_notify_cq(ch->cq, IB_CQ_NEXT_COMP); qp_init->qp_context = (void *)ch; - qp_init->event_handler - = (void(*)(struct ib_event *, void*))srpt_qp_event; + qp_init->event_handler = (void(*)(struct ib_event *, void*))srpt_qp_event; qp_init->send_cq = ch->cq; qp_init->recv_cq = ch->cq; qp_init->sq_sig_type = IB_SIGNAL_REQ_WR; @@ -2276,11 +2266,10 @@ retry: #endif qp_init->cap.max_send_sge = ch->max_send_sge; qp_init->cap.max_recv_sge = 1; - if (sdev->use_srq) { + if (sdev->use_srq) qp_init->srq = sdev->srq; - } else { + else qp_init->cap.max_recv_wr = ch->rq_size; - } if (ch->using_rdma_cm) { ret = rdma_create_qp(ch->rdma_cm.cm_id, sdev->pd, qp_init); @@ -2319,9 +2308,9 @@ retry: atomic_set(&ch->sq_wr_avail, qp_init->cap.max_send_wr); - pr_debug("%s: max_cqe= %d max_sge= %d sq_size = %d ch= %p\n", __func__, - ch->cq->cqe, qp_init->cap.max_send_sge, - qp_init->cap.max_send_wr, ch); + pr_debug("%s: max_cqe= %d max_sge= %d sq_size = %d ch= %p\n", + __func__, ch->cq->cqe, qp_init->cap.max_send_sge, + qp_init->cap.max_send_wr, ch); out: kfree(qp_init); @@ -2584,8 +2573,7 @@ static int srpt_cm_req_recv(struct srpt_device *const sdev, ret = -EINVAL; if (it_iu_len > srp_max_req_size || it_iu_len < 64) { - rej->reason = cpu_to_be32( - SRP_LOGIN_REJ_REQ_IT_IU_LENGTH_TOO_LARGE); + rej->reason = cpu_to_be32(SRP_LOGIN_REJ_REQ_IT_IU_LENGTH_TOO_LARGE); pr_err("rejected SRP_LOGIN_REQ because its length (%d bytes) is out of range (%d .. %d)\n", it_iu_len, 64, srp_max_req_size); goto reject; @@ -2598,11 +2586,9 @@ static int srpt_cm_req_recv(struct srpt_device *const sdev, goto reject; } - if (*(__be64 *)req->target_port_id != cpu_to_be64(srpt_service_guid) - || *(__be64 *)(req->target_port_id + 8) != - cpu_to_be64(srpt_service_guid)) { - rej->reason = cpu_to_be32( - SRP_LOGIN_REJ_UNABLE_ASSOCIATE_CHANNEL); + if (*(__be64 *)req->target_port_id != cpu_to_be64(srpt_service_guid) || + *(__be64 *)(req->target_port_id + 8) != cpu_to_be64(srpt_service_guid)) { + rej->reason = cpu_to_be32(SRP_LOGIN_REJ_UNABLE_ASSOCIATE_CHANNEL); pr_err("rejected SRP_LOGIN_REQ because it has an invalid target port identifier.\n"); goto reject; } @@ -2739,8 +2725,7 @@ static int srpt_cm_req_recv(struct srpt_device *const sdev, list_add_tail_rcu(&ch->list, &nexus->ch_list); if (!sport->enabled) { - rej->reason = cpu_to_be32( - SRP_LOGIN_REJ_INSUFFICIENT_RESOURCES); + rej->reason = cpu_to_be32(SRP_LOGIN_REJ_INSUFFICIENT_RESOURCES); pr_info("rejected SRP_LOGIN_REQ because the target %s (%s) is not enabled\n", sport->scst_tgt->tgt_name, dev_name(&sdev->device->dev)); @@ -2962,10 +2947,13 @@ static void srpt_cm_rej_recv(struct srpt_rdma_ch *ch, char *priv = NULL; int i; - if (private_data_len && (priv = kmalloc(private_data_len * 3 + 1, - GFP_KERNEL))) { - for (i = 0; i < private_data_len; i++) - sprintf(priv + 3 * i, " %02x", private_data[i]); + if (private_data_len) { + priv = kmalloc(private_data_len * 3 + 1, GFP_KERNEL); + + if (priv) { + for (i = 0; i < private_data_len; i++) + sprintf(priv + 3 * i, " %02x", private_data[i]); + } } pr_info("Received CM REJ for ch %s-%d; reason %d%s%s.\n", ch->sess_name, ch->qp->qp_num, reason, private_data_len ? @@ -2998,8 +2986,8 @@ static void srpt_check_timeout(struct srpt_rdma_ch *ch) T_tr_ms = T_tr_ns; do_div(T_tr_ms, 1000000); pr_debug("%s-%d: QP local ack timeout = %d or T_tr = %llu ms; retry_cnt = %d; max compl. time = %d ms\n", - ch->sess_name, ch->qp->qp_num, attr.timeout, T_tr_ms, - attr.retry_cnt, (unsigned int)max_compl_time_ms); + ch->sess_name, ch->qp->qp_num, attr.timeout, T_tr_ms, + attr.retry_cnt, (unsigned int)max_compl_time_ms); if (max_compl_time_ms >= RDMA_COMPL_TIMEOUT_S * 1000) { pr_err("Maximum RDMA completion time (%lld ms) exceeds ib_srpt timeout (%d ms)\n", @@ -3243,7 +3231,6 @@ static int srpt_map_sg_to_ib_sge(struct srpt_rdma_ch *ch, /* calculate how many sge required for this remote_buf */ while (rsize > 0 && tsize > 0) { - if (rsize >= dma_len) { tsize -= dma_len; rsize -= dma_len; @@ -3326,8 +3313,9 @@ static int srpt_map_sg_to_ib_sge(struct srpt_rdma_ch *ch, ++riu; sge = riu->sge; k = 0; - } else if (rsize > 0 && tsize > 0) + } else if (rsize > 0 && tsize > 0) { ++sge; + } } } @@ -3692,8 +3680,7 @@ static int srpt_xmit_response(struct scst_cmd *cmd) scst_copy_sg(cmd, SCST_SG_COPY_TO_TARGET); /* For read commands, transfer the data to the initiator. */ - if (dir == SCST_DATA_READ - && scst_cmd_get_adjusted_resp_data_len(cmd)) { + if (dir == SCST_DATA_READ && scst_cmd_get_adjusted_resp_data_len(cmd)) { ret = srpt_xfer_data(ch, ioctx); if (unlikely(ret != 0)) { srpt_set_cmd_state(ioctx, state); @@ -3766,8 +3753,7 @@ static void srpt_tsk_mgmt_done(struct scst_mgmt_cmd *mcmnd) ioctx->req_lim_delta = srpt_inc_req_lim(ch); rsp_len = srpt_build_tskmgmt_rsp(ch, ioctx, - scst_to_srp_tsk_mgmt_status( - scst_mgmt_cmd_get_status(mcmnd)), + scst_to_srp_tsk_mgmt_status(scst_mgmt_cmd_get_status(mcmnd)), ioctx->tsk_mgmt.tag); /* * Note: the srpt_post_send() call below sends the task management @@ -3787,8 +3773,8 @@ static void srpt_tsk_mgmt_done(struct scst_mgmt_cmd *mcmnd) * * See also SPC-3, section 7.5.4.5, TransportID for initiator ports using SRP. */ -static int srpt_get_initiator_port_transport_id(struct scst_tgt *tgt, - struct scst_session *sess, uint8_t **transport_id) +static int srpt_get_initiator_port_transport_id(struct scst_tgt *tgt, struct scst_session *sess, + uint8_t **transport_id) { struct srpt_rdma_ch *ch; struct spc_rdma_transport_id { @@ -3808,7 +3794,7 @@ static int srpt_get_initiator_port_transport_id(struct scst_tgt *tgt, BUILD_BUG_ON(sizeof(*tr_id) != 24); res = -ENOMEM; - tr_id = kzalloc(sizeof(struct spc_rdma_transport_id), GFP_KERNEL); + tr_id = kzalloc(sizeof(*tr_id), GFP_KERNEL); if (!tr_id) goto out; @@ -4002,8 +3988,7 @@ out: } static struct kobj_attribute srpt_show_comp_v_mask_attr = - __ATTR(comp_v_mask, S_IRUGO | S_IWUSR, show_comp_v_mask, - store_comp_v_mask); + __ATTR(comp_v_mask, 0644, show_comp_v_mask, store_comp_v_mask); static ssize_t srpt_show_device(struct kobject *kobj, struct kobj_attribute *attr, char *buf) @@ -4025,7 +4010,7 @@ out: } static struct kobj_attribute srpt_device_attr = - __ATTR(device, S_IRUGO, srpt_show_device, NULL); + __ATTR(device, 0444, srpt_show_device, NULL); /* * The link layer names in this function match those used by the IB core. @@ -4061,7 +4046,7 @@ out: } static struct kobj_attribute srpt_link_layer_attr = - __ATTR(link_layer, S_IRUGO, srpt_show_link_layer, NULL); + __ATTR(link_layer, 0444, srpt_show_link_layer, NULL); static ssize_t show_port_id(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { @@ -4115,7 +4100,7 @@ out: } static struct kobj_attribute srpt_port_id_attr = - __ATTR(port_id, S_IRUGO | S_IWUSR, show_port_id, store_port_id); + __ATTR(port_id, 0644, show_port_id, store_port_id); static ssize_t show_login_info(struct kobject *kobj, struct kobj_attribute *attr, char *buf) @@ -4131,14 +4116,14 @@ static ssize_t show_login_info(struct kobject *kobj, res = sysfs_emit(buf, "tid_ext=%016llx,ioc_guid=%016llx,pkey=ffff,dgid=%04x%04x%04x%04x%04x%04x%04x%04x,service_id=%016llx\n", srpt_service_guid, srpt_service_guid, - be16_to_cpu(((__be16 *) sport->gid.raw)[0]), - be16_to_cpu(((__be16 *) sport->gid.raw)[1]), - be16_to_cpu(((__be16 *) sport->gid.raw)[2]), - be16_to_cpu(((__be16 *) sport->gid.raw)[3]), - be16_to_cpu(((__be16 *) sport->gid.raw)[4]), - be16_to_cpu(((__be16 *) sport->gid.raw)[5]), - be16_to_cpu(((__be16 *) sport->gid.raw)[6]), - be16_to_cpu(((__be16 *) sport->gid.raw)[7]), + be16_to_cpu(((__be16 *)sport->gid.raw)[0]), + be16_to_cpu(((__be16 *)sport->gid.raw)[1]), + be16_to_cpu(((__be16 *)sport->gid.raw)[2]), + be16_to_cpu(((__be16 *)sport->gid.raw)[3]), + be16_to_cpu(((__be16 *)sport->gid.raw)[4]), + be16_to_cpu(((__be16 *)sport->gid.raw)[5]), + be16_to_cpu(((__be16 *)sport->gid.raw)[6]), + be16_to_cpu(((__be16 *)sport->gid.raw)[7]), srpt_service_guid); out: @@ -4146,7 +4131,7 @@ out: } static struct kobj_attribute srpt_show_login_info_attr = - __ATTR(login_info, S_IRUGO, show_login_info, NULL); + __ATTR(login_info, 0444, show_login_info, NULL); static const struct attribute *srpt_tgt_attrs[] = { &srpt_show_comp_v_mask_attr.attr, @@ -4215,13 +4200,13 @@ static ssize_t show_comp_vector(struct kobject *kobj, } static const struct kobj_attribute srpt_req_lim_attr = - __ATTR(req_lim, S_IRUGO, show_req_lim, NULL); + __ATTR(req_lim, 0444, show_req_lim, NULL); static const struct kobj_attribute srpt_req_lim_delta_attr = - __ATTR(req_lim_delta, S_IRUGO, show_req_lim_delta, NULL); + __ATTR(req_lim_delta, 0444, show_req_lim_delta, NULL); static const struct kobj_attribute srpt_ch_state_attr = - __ATTR(ch_state, S_IRUGO, show_ch_state, NULL); + __ATTR(ch_state, 0444, show_ch_state, NULL); static const struct kobj_attribute srpt_comp_vector_attr = - __ATTR(comp_vector, S_IRUGO, show_comp_vector, NULL); + __ATTR(comp_vector, 0444, show_comp_vector, NULL); static const struct attribute *srpt_sess_attrs[] = { &srpt_req_lim_attr.attr, @@ -4252,7 +4237,6 @@ static struct scst_tgt_template srpt_template = { .get_scsi_transport_version = srpt_get_scsi_transport_version, }; - /* Note: the caller must have zero-initialized *@sport. */ static void srpt_init_sport(struct srpt_port *sport, struct ib_device *ib_dev) { @@ -4342,8 +4326,8 @@ static int srpt_add_one(struct ib_device *device) sdev->srq_size, sdev->dev_attr.max_srq_wr, device->name); - sdev->req_buf_cache = kmem_cache_create("srpt-srq-req-buf", - srp_max_req_size, 0, 0, NULL); + sdev->req_buf_cache = kmem_cache_create("srpt-srq-req-buf", srp_max_req_size, + 0, 0, NULL); if (!sdev->req_buf_cache) { ret = -ENOMEM; goto free_srq; @@ -4534,7 +4518,6 @@ static struct ib_client srpt_client = { .remove = srpt_remove_one }; - /** * srpt_init_module - kernel module initialization * @@ -4560,8 +4543,7 @@ static int __init srpt_init_module(void) goto out; } - if (srpt_srq_size < MIN_SRPT_SRQ_SIZE - || srpt_srq_size > MAX_SRPT_SRQ_SIZE) { + if (srpt_srq_size < MIN_SRPT_SRQ_SIZE || srpt_srq_size > MAX_SRPT_SRQ_SIZE) { pr_err("invalid value %d for kernel module parameter srpt_srq_size -- must be in the range [%d..%d].\n", srpt_srq_size, MIN_SRPT_SRQ_SIZE, MAX_SRPT_SRQ_SIZE); goto out; |
From: Gleb C. <lna...@ya...> - 2025-10-21 09:21:54
|
Commit: 3b6e2ed GitHub URL: https://github.com/SCST-project/scst/commit/3b6e2ed8be55b5f625ae9f27b3a432ce9947d29a Author: Gleb Chesnokov Date: 2025-10-21T12:18:36+03:00 Log Message: ----------- scst_local_cmd: Fix multiple checkpatch warnings This patch does not change any functionality. Modified Paths: -------------- scst/src/scst_local_cmd.c | 254 +++++++-------- 1 file changed, 110 insertions(+), 144 deletions(-) =================================================================== diff --git a/scst/src/scst_local_cmd.c b/scst/src/scst_local_cmd.c index 50157bf..d700b6a 100644 --- a/scst/src/scst_local_cmd.c +++ b/scst/src/scst_local_cmd.c @@ -42,9 +42,10 @@ enum scst_exec_res scst_report_luns_local(struct scst_cmd *cmd) cmd->host_status = DID_OK; cmd->driver_status = 0; - if ((cmd->cdb[2] != 0) && (cmd->cdb[2] != 2)) { - TRACE(TRACE_MINOR, "Unsupported SELECT REPORT value %#x in " - "REPORT LUNS command", cmd->cdb[2]); + if (cmd->cdb[2] != 0 && cmd->cdb[2] != 2) { + TRACE(TRACE_MINOR, + "Unsupported SELECT REPORT value %#x in REPORT LUNS command", + cmd->cdb[2]); scst_set_invalid_field_in_cdb(cmd, 2, 0); goto out_compl; } @@ -74,9 +75,8 @@ enum scst_exec_res scst_report_luns_local(struct scst_cmd *cmd) overflow = 1; goto inc_dev_cnt; } - *(__force __be64 *)&buffer[offs] - = scst_pack_lun(tgt_dev->lun, - cmd->sess->acg->addr_method); + *(__force __be64 *)&buffer[offs] = + scst_pack_lun(tgt_dev->lun, cmd->sess->acg->addr_method); offs += 8; } inc_dev_cnt: @@ -84,15 +84,12 @@ inc_dev_cnt: /* Clear sense_reported_luns_data_changed UA. */ spin_lock_bh(&tgt_dev->tgt_dev_lock); - list_for_each_entry(ua, &tgt_dev->UA_list, - UA_list_entry) { - if (scst_analyze_sense(ua->UA_sense_buffer, - ua->UA_valid_sense_len, - SCST_SENSE_ALL_VALID, - SCST_LOAD_SENSE(scst_sense_reported_luns_data_changed))) { - TRACE_DBG("Freeing not needed " - "REPORTED LUNS DATA CHANGED UA " - "%p", ua); + list_for_each_entry(ua, &tgt_dev->UA_list, UA_list_entry) { + if (scst_analyze_sense(ua->UA_sense_buffer, ua->UA_valid_sense_len, + SCST_SENSE_ALL_VALID, + SCST_LOAD_SENSE(scst_sense_reported_luns_data_changed))) { + TRACE_DBG("Freeing not needed REPORTED LUNS DATA CHANGED UA %p", + ua); scst_tgt_dev_del_free_UA(tgt_dev, ua); break; } @@ -156,7 +153,7 @@ enum scst_exec_res scst_request_sense_local(struct scst_cmd *cmd) spin_unlock_bh(&tgt_dev->tgt_dev_lock); buf = kzalloc(size, GFP_KERNEL); - if (buf == NULL) + if (!buf) goto out_put_busy; rc = scst_set_pending_UA(cmd, buf, &size); @@ -188,37 +185,33 @@ enum scst_exec_res scst_request_sense_local(struct scst_cmd *cmd) if (((scst_sense_response_code(tgt_dev->tgt_dev_sense) == 0x70) || (scst_sense_response_code(tgt_dev->tgt_dev_sense) == 0x71)) && (cmd->cdb[1] & 1)) { - PRINT_WARNING("%s: Fixed format of the saved sense, but " - "descriptor format requested. Conversion will " - "truncated data", cmd->op_name); - PRINT_BUFFER("Original sense", tgt_dev->tgt_dev_sense, - tgt_dev->tgt_dev_valid_sense_len); + PRINT_WARNING("%s: Fixed format of the saved sense, but descriptor format requested. Conversion will truncated data", + cmd->op_name); + PRINT_BUFFER("Original sense", + tgt_dev->tgt_dev_sense, tgt_dev->tgt_dev_valid_sense_len); buffer_size = min(SCST_STANDARD_SENSE_LEN, buffer_size); - sl = scst_set_sense(buffer, buffer_size, true, - tgt_dev->tgt_dev_sense[2], tgt_dev->tgt_dev_sense[12], - tgt_dev->tgt_dev_sense[13]); + sl = scst_set_sense(buffer, buffer_size, true, tgt_dev->tgt_dev_sense[2], + tgt_dev->tgt_dev_sense[12], tgt_dev->tgt_dev_sense[13]); } else if (((scst_sense_response_code(tgt_dev->tgt_dev_sense) == 0x72) || (scst_sense_response_code(tgt_dev->tgt_dev_sense) == 0x73)) && !(cmd->cdb[1] & 1)) { - PRINT_WARNING("%s: Descriptor format of the " - "saved sense, but fixed format requested. Conversion " - "will truncate data", cmd->op_name); - PRINT_BUFFER("Original sense", tgt_dev->tgt_dev_sense, - tgt_dev->tgt_dev_valid_sense_len); + PRINT_WARNING("%s: Descriptor format of the saved sense, but fixed format requested. Conversion will truncate data", + cmd->op_name); + PRINT_BUFFER("Original sense", + tgt_dev->tgt_dev_sense, tgt_dev->tgt_dev_valid_sense_len); buffer_size = min(SCST_STANDARD_SENSE_LEN, buffer_size); - sl = scst_set_sense(buffer, buffer_size, false, - tgt_dev->tgt_dev_sense[1], tgt_dev->tgt_dev_sense[2], - tgt_dev->tgt_dev_sense[3]); + sl = scst_set_sense(buffer, buffer_size, false, tgt_dev->tgt_dev_sense[1], + tgt_dev->tgt_dev_sense[2], tgt_dev->tgt_dev_sense[3]); } else { - if (buffer_size >= tgt_dev->tgt_dev_valid_sense_len) + if (buffer_size >= tgt_dev->tgt_dev_valid_sense_len) { sl = tgt_dev->tgt_dev_valid_sense_len; - else { + } else { sl = buffer_size; - TRACE(TRACE_SCSI|TRACE_MINOR, "%s: Being returned sense " - "truncated to size %d (needed %d)", cmd->op_name, - buffer_size, tgt_dev->tgt_dev_valid_sense_len); + TRACE(TRACE_SCSI | TRACE_MINOR, + "%s: Being returned sense truncated to size %d (needed %d)", + cmd->op_name, buffer_size, tgt_dev->tgt_dev_valid_sense_len); } memcpy(buffer, tgt_dev->tgt_dev_sense, sl); } @@ -278,8 +271,7 @@ static enum scst_exec_res scst_report_tpgs(struct scst_cmd *cmd) scst_set_busy(cmd); goto out_put; } else if (res < 0) { - scst_set_cmd_error(cmd, - SCST_LOAD_SENSE(scst_sense_invalid_field_in_cdb)); + scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_invalid_field_in_cdb)); goto out_put; } @@ -308,11 +300,10 @@ static enum scst_exec_res scst_exec_set_tpgs(struct scst_cmd *cmd) int rc; if (!dev->expl_alua) { - PRINT_ERROR("SET TARGET PORT GROUPS: not explicit ALUA mode " - "(dev %s)", dev->virt_name); + PRINT_ERROR("SET TARGET PORT GROUPS: not explicit ALUA mode (dev %s)", + dev->virt_name); /* Invalid opcode, i.e. SA field */ - scst_set_invalid_field_in_cdb(cmd, 1, - 0 | SCST_INVAL_FIELD_BIT_OFFS_VALID); + scst_set_invalid_field_in_cdb(cmd, 1, 0 | SCST_INVAL_FIELD_BIT_OFFS_VALID); goto out; } @@ -347,9 +338,9 @@ static enum scst_exec_res scst_report_supported_tm_fns(struct scst_cmd *cmd) buf[0] = 0xF8; /* ATS, ATSS, CACAS, CTSS, LURS */ buf[1] = 0; - if ((cmd->cdb[2] & 0x80) == 0) + if ((cmd->cdb[2] & 0x80) == 0) { resp_len = 4; - else { + } else { buf[3] = 0x0C; #if 1 buf[4] = 1; /* TMFTMOV */ @@ -402,7 +393,7 @@ static enum scst_exec_res scst_report_supported_opcodes(struct scst_cmd *cmd) goto out_compl; TRACE_DBG("cmd %p, options %d, req_opcode %x, req_sa %x, rctd %d", - cmd, options, req_opcode, req_sa, rctd); + cmd, options, req_opcode, req_sa, rctd); switch (options) { case 0: /* all */ @@ -419,13 +410,12 @@ static enum scst_exec_res scst_report_supported_opcodes(struct scst_cmd *cmd) if (req_opcode == supp_opcodes[i]->od_opcode) { op = supp_opcodes[i]; if (op->od_serv_action_valid) { - TRACE(TRACE_MINOR, "Requested opcode %x " - "with unexpected service action " - "(dev %s, initiator %s)", - req_opcode, cmd->dev->virt_name, - cmd->sess->initiator_name); + TRACE(TRACE_MINOR, + "Requested opcode %x ith unexpected service action (dev %s, initiator %s)", + req_opcode, cmd->dev->virt_name, + cmd->sess->initiator_name); scst_set_invalid_field_in_cdb(cmd, 2, - SCST_INVAL_FIELD_BIT_OFFS_VALID | 0); + SCST_INVAL_FIELD_BIT_OFFS_VALID | 0); goto out_compl; } buf_len = 4 + op->od_cdb_size; @@ -434,10 +424,10 @@ static enum scst_exec_res scst_report_supported_opcodes(struct scst_cmd *cmd) break; } } - if (op == NULL) { - TRACE(TRACE_MINOR, "Requested opcode %x not found " - "(dev %s, initiator %s)", req_opcode, - cmd->dev->virt_name, cmd->sess->initiator_name); + if (!op) { + TRACE(TRACE_MINOR, + "Requested opcode %x not found (dev %s, initiator %s)", + req_opcode, cmd->dev->virt_name, cmd->sess->initiator_name); buf_len = 4; } break; @@ -447,13 +437,12 @@ static enum scst_exec_res scst_report_supported_opcodes(struct scst_cmd *cmd) if (req_opcode == supp_opcodes[i]->od_opcode) { op = supp_opcodes[i]; if (!op->od_serv_action_valid) { - TRACE(TRACE_MINOR, "Requested opcode %x " - "without expected service action " - "(dev %s, initiator %s)", - req_opcode, cmd->dev->virt_name, - cmd->sess->initiator_name); + TRACE(TRACE_MINOR, + "Requested opcode %x without expected service action (dev %s, initiator %s)", + req_opcode, cmd->dev->virt_name, + cmd->sess->initiator_name); scst_set_invalid_field_in_cdb(cmd, 2, - SCST_INVAL_FIELD_BIT_OFFS_VALID | 0); + SCST_INVAL_FIELD_BIT_OFFS_VALID | 0); goto out_compl; } if (req_sa != op->od_serv_action) { @@ -466,19 +455,17 @@ static enum scst_exec_res scst_report_supported_opcodes(struct scst_cmd *cmd) break; } } - if (op == NULL) { - TRACE(TRACE_MINOR, "Requested opcode %x/%x not found " - "(dev %s, initiator %s)", req_opcode, req_sa, - cmd->dev->virt_name, cmd->sess->initiator_name); + if (!op) { + TRACE(TRACE_MINOR, + "Requested opcode %x/%x not found (dev %s, initiator %s)", + req_opcode, req_sa, cmd->dev->virt_name, cmd->sess->initiator_name); buf_len = 4; } break; default: - PRINT_ERROR("REPORT SUPPORTED OPERATION CODES: REPORTING OPTIONS " - "%x not supported (dev %s, initiator %s)", options, - cmd->dev->virt_name, cmd->sess->initiator_name); - scst_set_invalid_field_in_cdb(cmd, 2, - SCST_INVAL_FIELD_BIT_OFFS_VALID | 0); + PRINT_ERROR("REPORT SUPPORTED OPERATION CODES: REPORTING OPTIONS %x not supported (dev %s, initiator %s)", + options, cmd->dev->virt_name, cmd->sess->initiator_name); + scst_set_invalid_field_in_cdb(cmd, 2, SCST_INVAL_FIELD_BIT_OFFS_VALID | 0); goto out_compl; } @@ -492,9 +479,9 @@ static enum scst_exec_res scst_report_supported_opcodes(struct scst_cmd *cmd) inline_buf = true; } else { buf = vmalloc(buf_len); /* it can be big */ - if (buf == NULL) { - PRINT_ERROR("Unable to allocate REPORT SUPPORTED " - "OPERATION CODES buffer with size %d", buf_len); + if (!buf) { + PRINT_ERROR("Unable to allocate REPORT SUPPORTED OPERATION CODES buffer with size %d", + buf_len); scst_set_busy(cmd); goto out_err_put; } @@ -528,7 +515,7 @@ static enum scst_exec_res scst_report_supported_opcodes(struct scst_cmd *cmd) break; case 1: case 2: - if (op != NULL) { + if (op) { buf[1] |= op->od_support; put_unaligned_be16(op->od_cdb_size, &buf[2]); memcpy(&buf[4], op->od_cdb_usage_bits, op->od_cdb_size); @@ -558,7 +545,7 @@ static enum scst_exec_res scst_report_supported_opcodes(struct scst_cmd *cmd) scst_set_resp_data_len(cmd, length); out_compl: - if ((supp_opcodes != NULL) && (cmd->devt->put_supported_opcodes != NULL)) + if (supp_opcodes && cmd->devt->put_supported_opcodes) cmd->devt->put_supported_opcodes(cmd, supp_opcodes, supp_opcodes_cnt); cmd->completed = 1; @@ -624,18 +611,16 @@ enum scst_exec_res scst_reserve_local(struct scst_cmd *cmd) TRACE_ENTRY(); if (cmd->sess->sess_mq) { - PRINT_WARNING_ONCE("MQ session (%p) from initiator %s (tgt %s), " - "reservations not supported", cmd->sess, - cmd->sess->initiator_name, cmd->sess->tgt->tgt_name); + PRINT_WARNING_ONCE("MQ session (%p) from initiator %s (tgt %s), reservations not supported", + cmd->sess, cmd->sess->initiator_name, cmd->sess->tgt->tgt_name); scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_invalid_opcode)); goto out_done; } - if ((cmd->cdb[0] == RESERVE_10) && (cmd->cdb[2] & SCST_RES_3RDPTY)) { - PRINT_ERROR("RESERVE_10: 3rdPty RESERVE not implemented " - "(lun=%lld)", (unsigned long long)cmd->lun); - scst_set_invalid_field_in_cdb(cmd, 2, - SCST_INVAL_FIELD_BIT_OFFS_VALID | 4); + if (cmd->cdb[0] == RESERVE_10 && (cmd->cdb[2] & SCST_RES_3RDPTY)) { + PRINT_ERROR("RESERVE_10: 3rdPty RESERVE not implemented (lun=%lld)", + (unsigned long long)cmd->lun); + scst_set_invalid_field_in_cdb(cmd, 2, SCST_INVAL_FIELD_BIT_OFFS_VALID | 4); goto out_done; } @@ -661,11 +646,9 @@ enum scst_exec_res scst_reserve_local(struct scst_cmd *cmd) if (!list_empty(&dev->dev_registrants_list)) { if (scst_pr_crh_case(cmd)) goto out_completed; - else { - scst_set_cmd_error_status(cmd, - SAM_STAT_RESERVATION_CONFLICT); - goto out_done; - } + + scst_set_cmd_error_status(cmd, SAM_STAT_RESERVATION_CONFLICT); + goto out_done; } scst_res_lock(dev, &pr_lksb); @@ -700,9 +683,8 @@ enum scst_exec_res scst_release_local(struct scst_cmd *cmd) TRACE_ENTRY(); if (cmd->sess->sess_mq) { - PRINT_WARNING_ONCE("MQ session (%p) from initiator %s (tgt %s), " - "reservations not supported", cmd->sess, - cmd->sess->initiator_name, cmd->sess->tgt->tgt_name); + PRINT_WARNING_ONCE("MQ session (%p) from initiator %s (tgt %s), reservations not supported", + cmd->sess, cmd->sess->initiator_name, cmd->sess->tgt->tgt_name); scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_invalid_opcode)); goto out_done; } @@ -717,11 +699,9 @@ enum scst_exec_res scst_release_local(struct scst_cmd *cmd) if (!list_empty(&dev->dev_registrants_list)) { if (scst_pr_crh_case(cmd)) goto out_completed; - else { - scst_set_cmd_error_status(cmd, - SAM_STAT_RESERVATION_CONFLICT); - goto out_done; - } + + scst_set_cmd_error_status(cmd, SAM_STAT_RESERVATION_CONFLICT); + goto out_done; } scst_res_lock(dev, &pr_lksb); @@ -785,35 +765,30 @@ enum scst_exec_res scst_persistent_reserve_in_local(struct scst_cmd *cmd) session = cmd->sess; if (session->sess_mq) { - PRINT_WARNING_ONCE("MQ session %p from initiator %s (tgt %s), " - "persistent reservations not supported", session, - session->initiator_name, session->tgt->tgt_name); + PRINT_WARNING_ONCE("MQ session %p from initiator %s (tgt %s), persistent reservations not supported", + session, session->initiator_name, session->tgt->tgt_name); scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_invalid_opcode)); goto out_done; } if (unlikely(dev->not_pr_supporting_tgt_devs_num != 0)) { - PRINT_WARNING("Persistent Reservation command %s refused for " - "device %s, because the device has not supporting PR " - "transports connected", scst_get_opcode_name(cmd), - dev->virt_name); - scst_set_cmd_error(cmd, - SCST_LOAD_SENSE(scst_sense_invalid_opcode)); + PRINT_WARNING("Persistent Reservation command %s refused for device %s, because the device has not supporting PR transports connected", + scst_get_opcode_name(cmd), dev->virt_name); + scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_invalid_opcode)); goto out_done; } if (scst_dev_reserved(dev)) { - TRACE_PR("PR command rejected, because device %s holds regular " - "reservation", dev->virt_name); + TRACE_PR("PR command rejected, because device %s holds regular reservation", + dev->virt_name); scst_set_cmd_error_status(cmd, SAM_STAT_RESERVATION_CONFLICT); goto out_done; } if (cmd->tgt->tgt_forward_src && dev->scsi_dev && !dev->cluster_mode) { - PRINT_WARNING("PR commands for pass-through devices not " - "supported (device %s)", dev->virt_name); - scst_set_cmd_error(cmd, - SCST_LOAD_SENSE(scst_sense_invalid_opcode)); + PRINT_WARNING("PR commands for pass-through devices not supported (device %s)", + dev->virt_name); + scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_invalid_opcode)); goto out_done; } @@ -832,7 +807,7 @@ enum scst_exec_res scst_persistent_reserve_in_local(struct scst_cmd *cmd) action = cmd->cdb[1] & 0x1f; TRACE(TRACE_SCSI, "PR IN action %x for '%s' (LUN %llx) from '%s'", - action, dev->virt_name, tgt_dev->lun, session->initiator_name); + action, dev->virt_name, tgt_dev->lun, session->initiator_name); switch (action) { case PR_READ_KEYS: @@ -867,8 +842,7 @@ out_done: return SCST_EXEC_COMPLETED; out_unsup_act: - scst_set_invalid_field_in_cdb(cmd, 1, - SCST_INVAL_FIELD_BIT_OFFS_VALID | 0); + scst_set_invalid_field_in_cdb(cmd, 1, SCST_INVAL_FIELD_BIT_OFFS_VALID | 0); goto out_complete; } @@ -894,18 +868,15 @@ enum scst_exec_res scst_persistent_reserve_out_local(struct scst_cmd *cmd) session = cmd->sess; if (session->sess_mq) { - PRINT_WARNING_ONCE("MQ session (%p) from initiator %s (tgt %s), " - "persistent reservations not supported", session, - session->initiator_name, session->tgt->tgt_name); + PRINT_WARNING_ONCE("MQ session (%p) from initiator %s (tgt %s), persistent reservations not supported", + session, session->initiator_name, session->tgt->tgt_name); scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_invalid_opcode)); goto out_done; } if (unlikely(dev->not_pr_supporting_tgt_devs_num != 0)) { - PRINT_WARNING("Persistent Reservation command %s refused for " - "device %s, because the device has not supporting PR " - "transports connected", scst_get_opcode_name(cmd), - dev->virt_name); + PRINT_WARNING("Persistent Reservation command %s refused for device %s, because the device has not supporting PR transports connected", + scst_get_opcode_name(cmd), dev->virt_name); scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_invalid_opcode)); goto out_done; } @@ -913,11 +884,11 @@ enum scst_exec_res scst_persistent_reserve_out_local(struct scst_cmd *cmd) action = cmd->cdb[1] & 0x1f; TRACE(TRACE_SCSI, "PR OUT action %x for '%s' (LUN %llx) from '%s'", - action, dev->virt_name, tgt_dev->lun, session->initiator_name); + action, dev->virt_name, tgt_dev->lun, session->initiator_name); if (scst_dev_reserved(dev)) { - TRACE_PR("PR command rejected, because device %s holds regular " - "reservation", dev->virt_name); + TRACE_PR("PR command rejected, because device %s holds regular reservation", + dev->virt_name); scst_set_cmd_error_status(cmd, SAM_STAT_RESERVATION_CONFLICT); goto out_done; } @@ -935,37 +906,34 @@ enum scst_exec_res scst_persistent_reserve_out_local(struct scst_cmd *cmd) * REGISTER AND MOVE and RESERVE will be additionally checked for * conflicts later. */ - if ((action != PR_REGISTER) && (action != PR_REGISTER_AND_IGNORE) && - (tgt_dev->registrant == NULL)) { + if (action != PR_REGISTER && action != PR_REGISTER_AND_IGNORE && + !tgt_dev->registrant) { TRACE_PR("'%s' not registered", cmd->sess->initiator_name); scst_set_cmd_error_status(cmd, SAM_STAT_RESERVATION_CONFLICT); goto out_unlock; } /* Check scope */ - if ((action != PR_REGISTER) && (action != PR_REGISTER_AND_IGNORE) && - (action != PR_CLEAR) && (cmd->cdb[2] >> 4) != SCOPE_LU) { + if (action != PR_REGISTER && action != PR_REGISTER_AND_IGNORE && + action != PR_CLEAR && (cmd->cdb[2] >> 4) != SCOPE_LU) { TRACE_PR("Scope must be SCOPE_LU for action %x", action); - scst_set_invalid_field_in_cdb(cmd, 2, - SCST_INVAL_FIELD_BIT_OFFS_VALID | 4); + scst_set_invalid_field_in_cdb(cmd, 2, SCST_INVAL_FIELD_BIT_OFFS_VALID | 4); goto out_unlock; } /* Check SPEC_I_PT (PR_REGISTER_AND_MOVE has another format) */ - if ((action != PR_REGISTER) && (action != PR_REGISTER_AND_MOVE) && + if (action != PR_REGISTER && action != PR_REGISTER_AND_MOVE && ((buffer[20] >> 3) & 0x01)) { TRACE_PR("SPEC_I_PT must be zero for action %x", action); - scst_set_invalid_field_in_parm_list(cmd, 20, - SCST_INVAL_FIELD_BIT_OFFS_VALID | 3); + scst_set_invalid_field_in_parm_list(cmd, 20, SCST_INVAL_FIELD_BIT_OFFS_VALID | 3); goto out_unlock; } /* Check ALL_TG_PT (PR_REGISTER_AND_MOVE has another format) */ - if ((action != PR_REGISTER) && (action != PR_REGISTER_AND_IGNORE) && - (action != PR_REGISTER_AND_MOVE) && ((buffer[20] >> 2) & 0x01)) { + if (action != PR_REGISTER && action != PR_REGISTER_AND_IGNORE && + action != PR_REGISTER_AND_MOVE && ((buffer[20] >> 2) & 0x01)) { TRACE_PR("ALL_TG_PT must be zero for action %x", action); - scst_set_invalid_field_in_parm_list(cmd, 20, - SCST_INVAL_FIELD_BIT_OFFS_VALID | 2); + scst_set_invalid_field_in_parm_list(cmd, 20, SCST_INVAL_FIELD_BIT_OFFS_VALID | 2); goto out_unlock; } @@ -1002,16 +970,15 @@ enum scst_exec_res scst_persistent_reserve_out_local(struct scst_cmd *cmd) scst_pr_register_and_move(cmd, buffer, buffer_size); break; default: - scst_set_invalid_field_in_cdb(cmd, 1, - SCST_INVAL_FIELD_BIT_OFFS_VALID | 0); + scst_set_invalid_field_in_cdb(cmd, 1, SCST_INVAL_FIELD_BIT_OFFS_VALID | 0); goto out_unlock; } if (cmd->status == SAM_STAT_GOOD) scst_pr_sync_device_file(dev); - if ((cmd->devt->pr_cmds_notifications) && - (cmd->status == SAM_STAT_GOOD)) /* sync file may change status */ + /* sync file may change status */ + if (cmd->devt->pr_cmds_notifications && cmd->status == SAM_STAT_GOOD) res = SCST_EXEC_NOT_COMPLETED; out_unlock: @@ -1023,8 +990,7 @@ out_done: if (res == SCST_EXEC_COMPLETED) { if (!aborted) cmd->completed = 1; - cmd->scst_cmd_done(cmd, SCST_CMD_STATE_DEFAULT, - SCST_CONTEXT_SAME); + cmd->scst_cmd_done(cmd, SCST_CMD_STATE_DEFAULT, SCST_CONTEXT_SAME); } TRACE_EXIT_RES(res); |
From: Gleb C. <lna...@ya...> - 2025-10-21 09:19:09
|
Commit: 6ca7f49 GitHub URL: https://github.com/SCST-project/scst/commit/6ca7f49b8cd30fe52b8769e084ef6ba3fcdba25b Author: Gleb Chesnokov Date: 2025-10-21T12:18:36+03:00 Log Message: ----------- scst_tg: Fix multiple checkpatch warnings This patch does not change any functionality. Modified Paths: -------------- scst/src/scst_tg.c | 136 +++++++-------- 1 file changed, 59 insertions(+), 77 deletions(-) =================================================================== diff --git a/scst/src/scst_tg.c b/scst/src/scst_tg.c index f2415b0..e69899d 100644 --- a/scst/src/scst_tg.c +++ b/scst/src/scst_tg.c @@ -426,15 +426,13 @@ static void scst_alua_transitioning_work_fn(struct work_struct *work) TRACE_DBG("Retrying transitioning cmd %p", cmd); spin_lock_irq(&cmd->cmd_threads->cmd_list_lock); - list_add(&cmd->cmd_list_entry, - &cmd->cmd_threads->active_cmd_list); + list_add(&cmd->cmd_list_entry, &cmd->cmd_threads->active_cmd_list); wake_up(&cmd->cmd_threads->cmd_list_waitQ); spin_unlock_irq(&cmd->cmd_threads->cmd_list_lock); kfree(retry); TRACE_EXIT(); - return; } /* @@ -471,19 +469,17 @@ static int scst_tg_accept_transitioning(struct scst_cmd *cmd) break; } - if (cmd->already_transitioning) + if (cmd->already_transitioning) { TRACE_DBG("cmd %p already transitioned checked, failing", cmd); - else { + } else { struct scst_alua_retry *retry; TRACE_DBG("ALUA transitioning: delaying cmd %p", cmd); retry = kzalloc(sizeof(*retry), GFP_KERNEL); - if (retry == NULL) { - TRACE_DBG("Unable to allocate ALUA retry " - "struct, failing cmd %p", cmd); - scst_set_cmd_error(cmd, - SCST_LOAD_SENSE(scst_sense_alua_transitioning)); + if (!retry) { + TRACE_DBG("Unable to allocate ALUA retry struct, failing cmd %p", cmd); + scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_alua_transitioning)); res = SCST_ALUA_CHECK_ERROR; goto out; } @@ -493,13 +489,12 @@ static int scst_tg_accept_transitioning(struct scst_cmd *cmd) INIT_DELAYED_WORK(&retry->alua_retry_work, scst_alua_transitioning_work_fn); cmd->already_transitioning = 1; - schedule_delayed_work(&retry->alua_retry_work, HZ/2); + schedule_delayed_work(&retry->alua_retry_work, HZ / 2); res = SCST_ALUA_CHECK_DELAYED; goto out; } - scst_set_cmd_error(cmd, - SCST_LOAD_SENSE(scst_sense_alua_transitioning)); + scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_alua_transitioning)); res = SCST_ALUA_CHECK_ERROR; out: @@ -548,16 +543,14 @@ static void scst_check_alua_invariant(void) SCST_TG_STATE_OPTIMIZED; if (tgt_dev->alua_filter != scst_alua_filter[expected_state]) { - PRINT_ERROR("LUN %s/%s/%s/%lld/%s: ALUA filter" - " %p <> %p", - tgt_dev->acg_dev->acg->tgt->tgt_name, - tgt_dev->acg_dev->acg->acg_name ? : - "(default)", - tgt_dev->sess->initiator_name, - tgt_dev->lun, - tgt_dev->dev->virt_name ? : "(null)", - tgt_dev->alua_filter, - scst_alua_filter[expected_state]); + PRINT_ERROR("LUN %s/%s/%s/%lld/%s: ALUA filter %p <> %p", + tgt_dev->acg_dev->acg->tgt->tgt_name, + tgt_dev->acg_dev->acg->acg_name ?: "(default)", + tgt_dev->sess->initiator_name, + tgt_dev->lun, + tgt_dev->dev->virt_name ?: "(null)", + tgt_dev->alua_filter, + scst_alua_filter[expected_state]); } } } @@ -580,12 +573,11 @@ static void scst_tg_change_tgt_dev_state(struct scst_tgt_dev *tgt_dev, lockdep_assert_held(&scst_dg_mutex); TRACE_MGMT_DBG("ALUA state of tgt_dev %p has changed (gen_ua %d)", - tgt_dev, gen_ua); + tgt_dev, gen_ua); scst_update_tgt_dev_alua_filter(tgt_dev, state); if (gen_ua) - scst_gen_aen_or_ua(tgt_dev, - SCST_LOAD_SENSE(scst_sense_asym_access_state_changed)); + scst_gen_aen_or_ua(tgt_dev, SCST_LOAD_SENSE(scst_sense_asym_access_state_changed)); } /* Initialize ALUA state of LUN tgt_dev */ @@ -646,8 +638,7 @@ static void scst_reset_tgt_alua_filter(struct scst_target_group *tg, list_for_each_entry(tgt_dev, &dgd->dev->dev_tgt_dev_list, dev_tgt_dev_list_entry) { if (tgt_dev->acg_dev->acg->tgt == tgt) - scst_update_tgt_dev_alua_filter(tgt_dev, - SCST_TG_STATE_OPTIMIZED); + scst_update_tgt_dev_alua_filter(tgt_dev, SCST_TG_STATE_OPTIMIZED); } } @@ -882,9 +873,8 @@ static void scst_event_stpg_notify_fn(struct scst_event *event, TRACE_ENTRY(); - PRINT_INFO("Notification for event %u (id %d) received " - "with status %d (priv %p)", event->event_code, - event->event_id, status, priv); + PRINT_INFO("Notification for event %u (id %d) received with status %d (priv %p)", + event->event_code, event->event_id, status, priv); mutex_lock(&scst_mutex); mutex_lock(&scst_dg_mutex); @@ -892,14 +882,14 @@ static void scst_event_stpg_notify_fn(struct scst_event *event, dg = __lookup_dg_by_dev(cmd->dev); if (!dg) { PRINT_ERROR("STPG: unable to find DG for device %s", - cmd->dev->virt_name); + cmd->dev->virt_name); goto out_fail; } list_for_each_entry(dgd, &dg->dev_list, entry) { if (dgd->dev->stpg_ext_blocked) { TRACE_DBG("STPG: ext unblocking dev %s", - dgd->dev->virt_name); + dgd->dev->virt_name); scst_ext_unblock_dev(dgd->dev, true); dgd->dev->stpg_ext_blocked = 0; } @@ -910,7 +900,7 @@ static void scst_event_stpg_notify_fn(struct scst_event *event, if (status != 0) { PRINT_ERROR("on_stpg script for device group %s failed with status %d", - dg->name, status); + dg->name, status); goto out_fail; } @@ -921,9 +911,8 @@ static void scst_event_stpg_notify_fn(struct scst_event *event, PRINT_ERROR("STPG: unable to find TG %d", d->group_id); goto out_fail; } else if (tg->state == scst_alua_name_to_state(d->prev_state)) { - PRINT_ERROR("on_stpg script did not change ALUA state" - " for device group %s / target group %s", - dg->name, tg->name); + PRINT_ERROR("on_stpg script did not change ALUA state for device group %s / target group %s", + dg->name, tg->name); goto out_fail; } } @@ -953,9 +942,8 @@ out_fail: * @invoke_callbacks: Whether or not to invoke the on_alua_state_changed_* * callback functions. */ -static void __scst_tgt_set_state(struct scst_target_group *tg, - struct scst_tgt_dev *tgt_dev, enum scst_tg_state state, - bool invoke_callbacks) +static void __scst_tgt_set_state(struct scst_target_group *tg, struct scst_tgt_dev *tgt_dev, + enum scst_tg_state state, bool invoke_callbacks) { bool gen_ua = state != SCST_TG_STATE_TRANSITIONING; struct scst_tgt *tgt = tgt_dev->sess->tgt; @@ -1102,7 +1090,7 @@ static void __scst_gen_alua_state_changed_ua(struct scst_target_group *tg) tgt = tgt_dev->sess->tgt; if (__scst_tg_have_tgt(tg, tgt)) scst_gen_aen_or_ua(tgt_dev, - SCST_LOAD_SENSE(scst_sense_asym_access_state_changed)); + SCST_LOAD_SENSE(scst_sense_asym_access_state_changed)); } } } @@ -1127,8 +1115,7 @@ static void __scst_tg_set_preferred(struct scst_target_group *tg, __scst_gen_alua_state_changed_ua(tg); } -int scst_tg_set_preferred(struct scst_target_group *tg, - bool preferred) +int scst_tg_set_preferred(struct scst_target_group *tg, bool preferred) { int res; @@ -1235,8 +1222,8 @@ static void __scst_dg_dev_remove(struct scst_dev_group *dg, struct scst_dg_dev *dgdev) { if (dgdev->dev->stpg_ext_blocked) { - TRACE_DBG("DG %s remove: unblocking STPG ext blocked " - "dev %s", dg->name, dgdev->dev->virt_name); + TRACE_DBG("DG %s remove: unblocking STPG ext blocked dev %s", + dg->name, dgdev->dev->virt_name); scst_ext_unblock_dev(dgdev->dev, true); dgdev->dev->stpg_ext_blocked = 0; } @@ -1430,7 +1417,6 @@ struct scst_dev_group *scst_lookup_dg_by_dev(struct scst_device *dev) return __lookup_dg_by_dev(dev); } - /* * Target group module management. */ @@ -1534,7 +1520,7 @@ bool scst_alua_configured(struct scst_device *dev) dg = __lookup_dg_by_dev(dev); mutex_unlock(&scst_dg_mutex); - return dg != NULL; + return dg; } EXPORT_SYMBOL_GPL(scst_alua_configured); @@ -1671,21 +1657,19 @@ static void scst_stpg_check_blocking_done(struct scst_stpg_wait *wait) if (atomic_dec_and_test(&wait->stpg_wait_left)) { if (wait->status == 0) scst_event_queue(SCST_EVENT_STPG_USER_INVOKE, - SCST_EVENT_SCST_CORE_ISSUER, wait->event_entry); - else { + SCST_EVENT_SCST_CORE_ISSUER, wait->event_entry); + else wait->event_entry->event_notify_fn(&wait->event_entry->event, - wait->event_entry->notify_fn_priv, wait->status); - } + wait->event_entry->notify_fn_priv, + wait->status); kfree(wait); } TRACE_EXIT(); - return; } /* No locks */ -static void scst_stpg_ext_blocking_done(struct scst_device *dev, - uint8_t *data, int len) +static void scst_stpg_ext_blocking_done(struct scst_device *dev, uint8_t *data, int len) { sBUG_ON(len != sizeof(data)); scst_stpg_check_blocking_done(*((struct scst_stpg_wait **)data)); @@ -1723,15 +1707,16 @@ static int scst_emit_stpg_event(struct scst_cmd *cmd, struct scst_dev_group *dg, payload_len = sizeof(*payload) + sizeof(*descr) * tpg_desc_count; event_entry_len = sizeof(*event_entry) + payload_len; + event_entry = kzalloc(event_entry_len, GFP_KERNEL); - if (event_entry == NULL) { + if (!event_entry) { PRINT_ERROR("Unable to allocate event (size %d)", event_entry_len); res = -ENOMEM; goto out; } - TRACE_MEM("event_entry %p (len %d) allocated", event_entry, - event_entry_len); + TRACE_MEM("event_entry %p (len %d) allocated", + event_entry, event_entry_len); event = &event_entry->event; event->payload_len = payload_len; @@ -1741,8 +1726,7 @@ static int scst_emit_stpg_event(struct scst_cmd *cmd, struct scst_dev_group *dg, res = 1; - if (strscpy(payload->device_name, dev->virt_name, - sizeof(payload->device_name)) < 0) { + if (strscpy(payload->device_name, dev->virt_name, sizeof(payload->device_name)) < 0) { PRINT_ERROR("Device name %s too long", dev->virt_name); goto out_too_long; } @@ -1786,16 +1770,16 @@ static int scst_emit_stpg_event(struct scst_cmd *cmd, struct scst_dev_group *dg, dg->stpg_rel_tgt_id = cmd->tgt->rel_tgt_id; dg->stpg_transport_id = kmemdup(cmd->sess->transport_id, - scst_tid_size(cmd->sess->transport_id), GFP_KERNEL); - if (dg->stpg_transport_id == NULL) { + scst_tid_size(cmd->sess->transport_id), GFP_KERNEL); + if (!dg->stpg_transport_id) { PRINT_ERROR("Unable to duplicate stpg_transport_id"); goto out; } wait = kzalloc(sizeof(*wait), GFP_KERNEL); - if (wait == NULL) { - PRINT_ERROR("Unable to allocate STPG wait struct " - "(size %zd)", sizeof(*wait)); + if (!wait) { + PRINT_ERROR("Unable to allocate STPG wait struct (size %zd)", + sizeof(*wait)); res = -ENOMEM; goto out; } @@ -1822,8 +1806,8 @@ static int scst_emit_stpg_event(struct scst_cmd *cmd, struct scst_dev_group *dg, scst_stpg_ext_blocking_done, &wait, sizeof(wait), true); if (rc != 0) { - TRACE_DBG("scst_ext_block_dev() failed " - "with %d, reverting (cmd %p)", rc, cmd); + TRACE_DBG("scst_ext_block_dev() failed with %d, reverting (cmd %p)", + rc, cmd); wait->status = rc; wait->dg = dg; atomic_dec(&wait->stpg_wait_left); @@ -1897,7 +1881,7 @@ int scst_tg_set_group_info(struct scst_cmd *cmd) /* Check for some reasonable limit */ if (tpg_desc_count > 64) { PRINT_ERROR("Too many STPG descriptors (%d) for dev %s", - tpg_desc_count, dev->virt_name); + tpg_desc_count, dev->virt_name); res = -EINVAL; scst_set_invalid_field_in_cdb(cmd, 6, 0); goto out_put; @@ -1914,16 +1898,16 @@ int scst_tg_set_group_info(struct scst_cmd *cmd) res = mutex_lock_interruptible(&scst_mutex); if (res) { - PRINT_INFO("mutex_lock_interruptible() returned %d, finishing " - "cmd %p", res, cmd); + PRINT_INFO("mutex_lock_interruptible() returned %d, finishing cmd %p", + res, cmd); scst_set_busy(cmd); goto out_put; } res = mutex_lock_interruptible(&scst_dg_mutex); if (res) { - PRINT_INFO("mutex_lock_interruptible() returned %d, finishing " - "cmd %p", res, cmd); + PRINT_INFO("mutex_lock_interruptible() returned %d, finishing cmd %p", + res, cmd); scst_set_busy(cmd); goto out_unlock_sm_fail; } @@ -1978,15 +1962,14 @@ int scst_tg_set_group_info(struct scst_cmd *cmd) if (osi[j].tg->state == SCST_TG_STATE_TRANSITIONING) { TRACE_MGMT_DBG("TG %p is transitioning", osi[j].tg); res = -EBUSY; - scst_set_cmd_error(cmd, - SCST_LOAD_SENSE(scst_sense_alua_transitioning)); + scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_alua_transitioning)); /* second sense will not override the set one */ goto out_unlock_fail; } osi[j].prev_state = osi[j].tg->state; - TRACE_DBG("j %d, group_id %u, tg %s (%p), state %d", j, osi[j].group_id, - osi[j].tg->name, osi[j].tg, osi[j].tg->state); + TRACE_DBG("j %d, group_id %u, tg %s (%p), state %d", + j, osi[j].group_id, osi[j].tg->name, osi[j].tg, osi[j].tg->state); } mutex_unlock(&scst_dg_mutex); @@ -2006,8 +1989,7 @@ int scst_tg_set_group_info(struct scst_cmd *cmd) WARN_ONCE(true, "res = %d\n", res); fallthrough; case -EOVERFLOW: - scst_set_cmd_error(cmd, - SCST_LOAD_SENSE(scst_sense_set_target_pgs_failed)); + scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_set_target_pgs_failed)); break; } |
From: Gleb C. <lna...@ya...> - 2025-10-01 19:15:52
|
Commit: 6543c4c GitHub URL: https://github.com/SCST-project/scst/commit/6543c4c316ebe03e6afa5235544df78c26643c14 Author: Gleb Chesnokov Date: 2025-10-01T22:11:28+03:00 Log Message: ----------- qla2x00t-32gbit: Remove firmware URL The historic QLogic firmware URL redirects to a Marvell page that only provides drivers. Refer to linux-firmware instead. Cc: Nilesh Javali <nj...@ma...> Cc: James E.J. Bottomley <Jam...@Ha...> Cc: Martin K. Petersen <mar...@or...> Cc: QLOGIC ML <GR-...@ma...> Cc: LINUX SCSI ML <lin...@vg...> Signed-off-by: Xose Vazquez Perez <xos...@gm...> Link: https://lore.kernel.org/r/202...@gm... Signed-off-by: Martin K. Petersen <mar...@or...> [ commit b152f199fa43 upstream ] Modified Paths: -------------- qla2x00t-32gbit/Kconfig | 6 +----- qla2x00t-32gbit/qla_init.c | 4 ---- 2 files changed, 1 insertion(+), 9 deletions(-) =================================================================== diff --git a/qla2x00t-32gbit/Kconfig b/qla2x00t-32gbit/Kconfig index f82ae0b..2b047bb 100644 --- a/qla2x00t-32gbit/Kconfig +++ b/qla2x00t-32gbit/Kconfig @@ -25,11 +25,7 @@ config SCSI_QLA_FC Upon request, the driver caches the firmware image until the driver is unloaded. - Firmware images can be retrieved from: - - http://ldriver.qlogic.com/firmware/ - - They are also included in the linux-firmware tree as well. + Firmware images are included in the linux-firmware tree. config SCSI_QLA2XXX_TARGET bool "QLogic 2xxx target mode support" diff --git a/qla2x00t-32gbit/qla_init.c b/qla2x00t-32gbit/qla_init.c index 950b72f..4799315 100644 --- a/qla2x00t-32gbit/qla_init.c +++ b/qla2x00t-32gbit/qla_init.c @@ -8606,8 +8606,6 @@ failed: return QLA_SUCCESS; } -#define QLA_FW_URL "http://ldriver.qlogic.com/firmware/" - int qla2x00_load_risc(scsi_qla_host_t *vha, uint32_t *srisc_addr) { @@ -8625,8 +8623,6 @@ qla2x00_load_risc(scsi_qla_host_t *vha, uint32_t *srisc_addr) if (!blob) { ql_log(ql_log_info, vha, 0x0083, "Firmware image unavailable.\n"); - ql_log(ql_log_info, vha, 0x0084, - "Firmware images can be retrieved from: "QLA_FW_URL ".\n"); return QLA_FUNCTION_FAILED; } |
From: Gleb C. <lna...@ya...> - 2025-10-01 19:15:41
|
Commit: 0e890f5 GitHub URL: https://github.com/SCST-project/scst/commit/0e890f51676e4ccfe0660d3dc62b37f72f0546de Author: Gleb Chesnokov Date: 2025-10-01T22:11:28+03:00 Log Message: ----------- scst: Indent Kconfig help text Fix indentation of config option's help text by adding leading spaces. Generally help text is indented by couple of spaces more beyond the leading tab <\t> character. It helps Kconfig parsers to read file without error. Modified Paths: -------------- qla2x00t-32gbit/Kconfig | 44 +++++++-------- qla2x00t/Kconfig | 40 ++++++------- srpt/src/Kconfig | 14 ++--- 3 files changed, 49 insertions(+), 49 deletions(-) =================================================================== diff --git a/qla2x00t-32gbit/Kconfig b/qla2x00t-32gbit/Kconfig index 133a47a..f82ae0b 100644 --- a/qla2x00t-32gbit/Kconfig +++ b/qla2x00t-32gbit/Kconfig @@ -7,44 +7,44 @@ config SCSI_QLA_FC select FW_LOADER select BTREE help - This qla2xxx driver supports all QLogic Fibre Channel - PCI and PCIe host adapters. + This qla2xxx driver supports all QLogic Fibre Channel + PCI and PCIe host adapters. - By default, firmware for the ISP parts will be loaded - via the Firmware Loader interface. + By default, firmware for the ISP parts will be loaded + via the Firmware Loader interface. - ISP Firmware Filename - ---------- ----------------- - 21xx ql2100_fw.bin - 22xx ql2200_fw.bin - 2300, 2312, 6312 ql2300_fw.bin - 2322, 6322 ql2322_fw.bin - 24xx, 54xx ql2400_fw.bin - 25xx ql2500_fw.bin + ISP Firmware Filename + ---------- ----------------- + 21xx ql2100_fw.bin + 22xx ql2200_fw.bin + 2300, 2312, 6312 ql2300_fw.bin + 2322, 6322 ql2322_fw.bin + 24xx, 54xx ql2400_fw.bin + 25xx ql2500_fw.bin - Upon request, the driver caches the firmware image until - the driver is unloaded. + Upon request, the driver caches the firmware image until + the driver is unloaded. - Firmware images can be retrieved from: + Firmware images can be retrieved from: - http://ldriver.qlogic.com/firmware/ + http://ldriver.qlogic.com/firmware/ - They are also included in the linux-firmware tree as well. + They are also included in the linux-firmware tree as well. config SCSI_QLA2XXX_TARGET bool "QLogic 2xxx target mode support" depends on SCSI_QLA_FC default y help - This option enables target mode hooks used by the SCST qla2x00t - driver. Once qla2x00tgt module is loaded, target mode for each - port can be enable via sysfs interface. + This option enables target mode hooks used by the SCST qla2x00t + driver. Once qla2x00tgt module is loaded, target mode for each + port can be enable via sysfs interface. - You will also need the SCST middle level for qla2x00t. + You will also need the SCST middle level for qla2x00t. config SCST_QLA_TGT_ADDON tristate "QLogic SCST Target Driver" depends on SCSI_QLA2XXX_TARGET default y help - SCST QLogic 32 gbit/s target driver. + SCST QLogic 32 gbit/s target driver. diff --git a/qla2x00t/Kconfig b/qla2x00t/Kconfig index 12edf3c..2c22878 100644 --- a/qla2x00t/Kconfig +++ b/qla2x00t/Kconfig @@ -4,38 +4,38 @@ config SCSI_QLA_FC select SCSI_FC_ATTRS select FW_LOADER help - This qla2xxx driver supports all QLogic Fibre Channel - PCI and PCIe host adapters. + This qla2xxx driver supports all QLogic Fibre Channel + PCI and PCIe host adapters. - By default, firmware for the ISP parts will be loaded - via the Firmware Loader interface. + By default, firmware for the ISP parts will be loaded + via the Firmware Loader interface. - ISP Firmware Filename - ---------- ----------------- - 21xx ql2100_fw.bin - 22xx ql2200_fw.bin - 2300, 2312, 6312 ql2300_fw.bin - 2322, 6322 ql2322_fw.bin - 24xx, 54xx ql2400_fw.bin - 25xx ql2500_fw.bin + ISP Firmware Filename + ---------- ----------------- + 21xx ql2100_fw.bin + 22xx ql2200_fw.bin + 2300, 2312, 6312 ql2300_fw.bin + 2322, 6322 ql2322_fw.bin + 24xx, 54xx ql2400_fw.bin + 25xx ql2500_fw.bin - Upon request, the driver caches the firmware image until - the driver is unloaded. + Upon request, the driver caches the firmware image until + the driver is unloaded. - Firmware images can be retrieved from: + Firmware images can be retrieved from: - http://ldriver.qlogic.com/firmware/ + http://ldriver.qlogic.com/firmware/ config SCSI_QLA2XXX_TARGET bool "QLogic 2xxx target mode support" depends on SCSI_QLA_FC default y help - This option enables target mode hooks used by the SCST qla2x00t - driver. Once qla2x00tgt module is loaded, target mode for each - port can be enable via sysfs interface. + This option enables target mode hooks used by the SCST qla2x00t + driver. Once qla2x00tgt module is loaded, target mode for each + port can be enable via sysfs interface. - You will also need the SCST middle level for qla2x00t. + You will also need the SCST middle level for qla2x00t. config SCST_QLA_TGT_ADDON tristate "QLogic 2XXX Target Mode Add-On" diff --git a/srpt/src/Kconfig b/srpt/src/Kconfig index d580ec0..7746759 100644 --- a/srpt/src/Kconfig +++ b/srpt/src/Kconfig @@ -2,10 +2,10 @@ config SCST_SRPT tristate "InfiniBand SCSI RDMA Protocol target support" depends on INFINIBAND && SCST help - Support for the SCSI RDMA Protocol (SRP) Target driver. The - SRP protocol is a protocol that allows an initiator to access - a block storage device on another host (target) over a network - that supports the RDMA protocol. Currently the RDMA protocol is - supported by InfiniBand and by iWarp network hardware. More - information about the SRP protocol can be found on the website - of the INCITS T10 technical committee (http://www.t10.org/). + Support for the SCSI RDMA Protocol (SRP) Target driver. The + SRP protocol is a protocol that allows an initiator to access + a block storage device on another host (target) over a network + that supports the RDMA protocol. Currently the RDMA protocol is + supported by InfiniBand and by iWarp network hardware. More + information about the SRP protocol can be found on the website + of the INCITS T10 technical committee (http://www.t10.org/). |
From: Gleb C. <lna...@ya...> - 2025-10-01 19:15:17
|
Commit: 2c69fe0 GitHub URL: https://github.com/SCST-project/scst/commit/2c69fe018cc19328ae365d9e4198ae0aff5b0cc2 Author: Gleb Chesnokov Date: 2025-10-01T22:11:28+03:00 Log Message: ----------- scst: Use block layer helpers to calculate num of queues The calculation of the upper limit for queues does not depend solely on the number of online CPUs; for example, the isolcpus kernel command-line option must also be considered. To account for this, the block layer provides a helper function to retrieve the maximum number of queues. Use it to set an appropriate upper queue number limit. Modified Paths: -------------- iscsi-scst/kernel/iscsi.c | 2 +- iscsi-scst/kernel/isert-scst/iser_rdma.c | 3 +-- qla2x00t-32gbit/qla_isr.c | 10 +++---- qla2x00t/qla_os.c | 4 +-- scst/include/backport.h | 21 +++++++++++++++ scst/src/scst_main.c | 12 ++++----- scst_local/scst_local.c | 2 +- 7 files changed, 37 insertions(+), 17 deletions(-) =================================================================== diff --git a/iscsi-scst/kernel/iscsi.c b/iscsi-scst/kernel/iscsi.c index 1e0d11f..dd3d497 100644 --- a/iscsi-scst/kernel/iscsi.c +++ b/iscsi-scst/kernel/iscsi.c @@ -4108,7 +4108,7 @@ create: if (dedicated) { count = 1; } else if (!cpu_mask) { - count = max_t(int, num_online_cpus(), 2); + count = blk_mq_num_online_queues(2); } else { count = 0; for_each_cpu(i, cpu_mask) diff --git a/iscsi-scst/kernel/isert-scst/iser_rdma.c b/iscsi-scst/kernel/isert-scst/iser_rdma.c index 3971106..6ed53bc 100644 --- a/iscsi-scst/kernel/isert-scst/iser_rdma.c +++ b/iscsi-scst/kernel/isert-scst/iser_rdma.c @@ -922,8 +922,7 @@ static struct isert_device *isert_device_create(struct ib_device *ib_dev) isert_dev->device_attr = ib_dev->attrs; #endif - isert_dev->num_cqs = min_t(int, num_online_cpus(), - ib_dev->num_comp_vectors); + isert_dev->num_cqs = blk_mq_num_online_queues(ib_dev->num_comp_vectors); isert_dev->cq_qps = kcalloc(isert_dev->num_cqs, sizeof(*isert_dev->cq_qps), diff --git a/qla2x00t-32gbit/qla_isr.c b/qla2x00t-32gbit/qla_isr.c index 913152b..7f2eb9c 100644 --- a/qla2x00t-32gbit/qla_isr.c +++ b/qla2x00t-32gbit/qla_isr.c @@ -4628,13 +4628,13 @@ msix_failed: if (USER_CTRL_IRQ(ha) || !ha->mqiobase) { /* user wants to control IRQ setting for target mode */ ret = pci_alloc_irq_vectors(ha->pdev, min_vecs, - min((u16)ha->msix_count, (u16)(num_online_cpus() + min_vecs)), - PCI_IRQ_MSIX); + blk_mq_num_online_queues(ha->msix_count) + min_vecs, + PCI_IRQ_MSIX); } else ret = pci_alloc_irq_vectors_affinity(ha->pdev, min_vecs, - min((u16)ha->msix_count, (u16)(num_online_cpus() + min_vecs)), - PCI_IRQ_MSIX | PCI_IRQ_AFFINITY, - &desc); + blk_mq_num_online_queues(ha->msix_count) + min_vecs, + PCI_IRQ_MSIX | PCI_IRQ_AFFINITY, + &desc); #endif if (ret < 0) { diff --git a/qla2x00t/qla_os.c b/qla2x00t/qla_os.c index c2940f6..c06cd8e 100644 --- a/qla2x00t/qla_os.c +++ b/qla2x00t/qla_os.c @@ -1689,7 +1689,7 @@ skip_pio: /* Max queues are bounded by available msix vectors */ /* queue 0 uses two msix vectors */ if (ql2xmultique_tag) { - cpus = num_online_cpus(); + cpus = blk_mq_num_online_queues(0); ha->max_rsp_queues = (ha->msix_count - 1 > cpus) ? (cpus + 1) : (ha->msix_count - 1); ha->max_req_queues = 2; @@ -1778,7 +1778,7 @@ qla83xx_iospace_config(struct qla_hw_data *ha) /* Max queues are bounded by available msix vectors */ /* queue 0 uses two msix vectors */ if (ql2xmultique_tag) { - cpus = num_online_cpus(); + cpus = blk_mq_num_online_queues(0); ha->max_rsp_queues = (ha->msix_count - 1 > cpus) ? (cpus + 1) : (ha->msix_count - 1); ha->max_req_queues = 2; diff --git a/scst/include/backport.h b/scst/include/backport.h index 83a0154..ba9b457 100644 --- a/scst/include/backport.h +++ b/scst/include/backport.h @@ -237,6 +237,27 @@ void blk_execute_rq_nowait_backport(struct request *rq, bool at_head) #define blk_execute_rq_nowait blk_execute_rq_nowait_backport #endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 17, 0) +static inline unsigned int blk_mq_num_queues(const struct cpumask *mask, + unsigned int max_queues) +{ + unsigned int num; + + num = cpumask_weight(mask); + return min_not_zero(num, max_queues); +} + +static inline unsigned int blk_mq_num_possible_queues(unsigned int max_queues) +{ + return blk_mq_num_queues(cpu_possible_mask, max_queues); +} + +static inline unsigned int blk_mq_num_online_queues(unsigned int max_queues) +{ + return blk_mq_num_queues(cpu_online_mask, max_queues); +} +#endif + /* <linux/blkdev.h> */ #if LINUX_VERSION_CODE < KERNEL_VERSION(6, 5, 0) && \ diff --git a/scst/src/scst_main.c b/scst/src/scst_main.c index 137ed83..a10cb69 100644 --- a/scst/src/scst_main.c +++ b/scst/src/scst_main.c @@ -2237,7 +2237,7 @@ static void scst_suspended(struct percpu_ref *ref) static int __init init_scst(void) { int res, i; - int scst_num_cpus; + int num_online_queues; TRACE_ENTRY(); @@ -2284,16 +2284,16 @@ static int __init init_scst(void) if (res != 0) goto out_deinit_threads; - scst_num_cpus = num_online_cpus(); + num_online_queues = blk_mq_num_online_queues(0); /* ToDo: register_cpu_notifier() */ if (scst_threads == 0) - scst_threads = scst_num_cpus; + scst_threads = num_online_queues; if (scst_threads < 1) { PRINT_ERROR("scst_threads can not be less than 1"); - scst_threads = scst_num_cpus; + scst_threads = num_online_queues; } /* Used for rarely used or read-mostly on fast path structures */ @@ -2456,8 +2456,8 @@ static int __init init_scst(void) (unsigned long)&scst_percpu_infos[i]); } - TRACE_DBG("%d CPUs found, starting %d threads", - scst_num_cpus, scst_threads); + TRACE_DBG("%d online queues, starting %d threads", + num_online_queues, scst_threads); res = scst_start_global_threads(scst_threads); if (res < 0) diff --git a/scst_local/scst_local.c b/scst_local/scst_local.c index 4e83358..93ffd61 100644 --- a/scst_local/scst_local.c +++ b/scst_local/scst_local.c @@ -1445,7 +1445,7 @@ static int scst_local_driver_probe(struct device *dev) } #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) - hpnt->nr_hw_queues = num_possible_cpus(); + hpnt->nr_hw_queues = blk_mq_num_possible_queues(0); #endif sess->shost = hpnt; |
From: Gleb C. <lna...@ya...> - 2025-10-01 19:15:10
|
Commit: 3960dc8 GitHub URL: https://github.com/SCST-project/scst/commit/3960dc87ac922f1e9bc143fb6266c5fbc0f5c400 Author: Gleb Chesnokov Date: 2025-10-01T22:11:28+03:00 Log Message: ----------- qla2x00t-32gbit: Avoid stack frame size warning in qla_dfs The qla2x00_dfs_tgt_port_database_show() function constructs a fake fc_port_t object on the stack, which--depending on the configuration--is large enough to exceed the stack size warning limit: drivers/scsi/qla2xxx/qla_dfs.c:176:1: error: stack frame size (1392) exceeds limit (1280) in 'qla2x00_dfs_tgt_port_database_show' [-Werror,-Wframe-larger-than] Rework this function to no longer need the structure but instead call a custom helper function that just prints the data directly from the port_database_24xx structure. Signed-off-by: Arnd Bergmann <ar...@ar...> Link: https://lore.kernel.org/r/202...@ke... Signed-off-by: Martin K. Petersen <mar...@or...> [ commit 6243146bb019 upstream ] Modified Paths: -------------- qla2x00t-32gbit/qla_dfs.c | 20 ++---- qla2x00t-32gbit/qla_gbl.h | 1 + qla2x00t-32gbit/qla_mbx.c | 48 +++++++++++++++ 3 files changed, 55 insertions(+), 14 deletions(-) =================================================================== diff --git a/qla2x00t-32gbit/qla_dfs.c b/qla2x00t-32gbit/qla_dfs.c index fbfe051..35be0fe 100644 --- a/qla2x00t-32gbit/qla_dfs.c +++ b/qla2x00t-32gbit/qla_dfs.c @@ -183,10 +183,9 @@ qla2x00_dfs_tgt_port_database_show(struct seq_file *s, void *unused) struct qla_hw_data *ha = vha->hw; struct gid_list_info *gid_list; dma_addr_t gid_list_dma; - fc_port_t fc_port; char *id_iter; int rc, i; - uint16_t entries, loop_id; + uint16_t entries; seq_printf(s, "%s\n", vha->host_str); gid_list = dma_alloc_coherent(&ha->pdev->dev, @@ -209,18 +208,11 @@ qla2x00_dfs_tgt_port_database_show(struct seq_file *s, void *unused) seq_puts(s, "Port Name Port ID Loop ID\n"); for (i = 0; i < entries; i++) { - struct gid_list_info *gid = - (struct gid_list_info *)id_iter; - loop_id = le16_to_cpu(gid->loop_id); - memset(&fc_port, 0, sizeof(fc_port_t)); - - fc_port.loop_id = loop_id; - - rc = qla24xx_gpdb_wait(vha, &fc_port, 0); - seq_printf(s, "%8phC %02x%02x%02x %d\n", - fc_port.port_name, fc_port.d_id.b.domain, - fc_port.d_id.b.area, fc_port.d_id.b.al_pa, - fc_port.loop_id); + struct gid_list_info *gid = (struct gid_list_info *)id_iter; + + rc = qla24xx_print_fc_port_id(vha, s, le16_to_cpu(gid->loop_id)); + if (rc != QLA_SUCCESS) + break; id_iter += ha->gid_list_info_size; } out_free_id_list: diff --git a/qla2x00t-32gbit/qla_gbl.h b/qla2x00t-32gbit/qla_gbl.h index 5cf5608..ee7e82e 100644 --- a/qla2x00t-32gbit/qla_gbl.h +++ b/qla2x00t-32gbit/qla_gbl.h @@ -563,6 +563,7 @@ qla26xx_dport_diagnostics_v2(scsi_qla_host_t *, int qla24xx_send_mb_cmd(struct scsi_qla_host *, mbx_cmd_t *); int qla24xx_gpdb_wait(struct scsi_qla_host *, fc_port_t *, u8); +int qla24xx_print_fc_port_id(struct scsi_qla_host *, struct seq_file *, u16); int qla24xx_gidlist_wait(struct scsi_qla_host *, void *, dma_addr_t, uint16_t *); int __qla24xx_parse_gpdb(struct scsi_qla_host *, fc_port_t *, diff --git a/qla2x00t-32gbit/qla_mbx.c b/qla2x00t-32gbit/qla_mbx.c index 13b6cb1..32eb0ce 100644 --- a/qla2x00t-32gbit/qla_mbx.c +++ b/qla2x00t-32gbit/qla_mbx.c @@ -6597,6 +6597,54 @@ done: return rval; } +int qla24xx_print_fc_port_id(struct scsi_qla_host *vha, struct seq_file *s, u16 loop_id) +{ + int rval = QLA_FUNCTION_FAILED; + dma_addr_t pd_dma; + struct port_database_24xx *pd; + struct qla_hw_data *ha = vha->hw; + mbx_cmd_t mc; + + if (!vha->hw->flags.fw_started) + goto done; + + pd = dma_pool_zalloc(ha->s_dma_pool, GFP_KERNEL, &pd_dma); + if (pd == NULL) { + ql_log(ql_log_warn, vha, 0xd047, + "Failed to allocate port database structure.\n"); + goto done; + } + + memset(&mc, 0, sizeof(mc)); + mc.mb[0] = MBC_GET_PORT_DATABASE; + mc.mb[1] = loop_id; + mc.mb[2] = MSW(pd_dma); + mc.mb[3] = LSW(pd_dma); + mc.mb[6] = MSW(MSD(pd_dma)); + mc.mb[7] = LSW(MSD(pd_dma)); + mc.mb[9] = vha->vp_idx; + + rval = qla24xx_send_mb_cmd(vha, &mc); + if (rval != QLA_SUCCESS) { + ql_dbg(ql_dbg_mbx, vha, 0x1193, "%s: fail\n", __func__); + goto done_free_sp; + } + + ql_dbg(ql_dbg_mbx, vha, 0x1197, "%s: %8phC done\n", + __func__, pd->port_name); + + seq_printf(s, "%8phC %02x%02x%02x %d\n", + pd->port_name, pd->port_id[0], + pd->port_id[1], pd->port_id[2], + loop_id); + +done_free_sp: + if (pd) + dma_pool_free(ha->s_dma_pool, pd, pd_dma); +done: + return rval; +} + /* * qla24xx_gpdb_wait * NOTE: Do not call this routine from DPC thread |
From: Gleb C. <lna...@ya...> - 2025-10-01 19:12:14
|
Commit: fae9d2a GitHub URL: https://github.com/SCST-project/scst/commit/fae9d2a1e582b952e4420a39aab27537579506b2 Author: Gleb Chesnokov Date: 2025-10-01T22:11:28+03:00 Log Message: ----------- scst: Unbreak UEK and RHEL builds Drop OL6/UEK R4 support. Modified Paths: -------------- .github/workflows/run_regression_tests.yaml | 3 +- nightly/conf/nightly.conf | 1 - qla2x00t-32gbit/qla_os.c | 6 +-- qla2x00t/qla_os.c | 4 +- scst/include/backport.h | 30 +++++++++------ 5 files changed, 25 insertions(+), 19 deletions(-) =================================================================== diff --git a/.github/workflows/run_regression_tests.yaml b/.github/workflows/run_regression_tests.yaml index e04a616..5e3fd93 100644 --- a/.github/workflows/run_regression_tests.yaml +++ b/.github/workflows/run_regression_tests.yaml @@ -59,8 +59,7 @@ jobs: '5.15.0-312.187.5.3.el9uek^UEK^9', '5.4.17-2136.347.6.3.el8uek^UEK^8', '4.14.35-2047.543.3.1.el7uek^UEK^7', - '4.1.12-124.93.1.el7uek^UEK^7', - '4.1.12-124.48.6.el6uek^UEK^6' + '4.1.12-124.93.1.el7uek^UEK^7' ] steps: - name: Checkout code diff --git a/nightly/conf/nightly.conf b/nightly/conf/nightly.conf index fb64e81..37791e5 100644 --- a/nightly/conf/nightly.conf +++ b/nightly/conf/nightly.conf @@ -101,5 +101,4 @@ ABT_KERNELS=" \ 5.4.17-2136.347.6.3.el8uek^UEK^8-nc \ 4.14.35-2047.543.3.1.el7uek^UEK^7-nc \ 4.1.12-124.93.1.el7uek^UEK^7-nc \ -4.1.12-124.48.6.el6uek^UEK^6-nc \ " diff --git a/qla2x00t-32gbit/qla_os.c b/qla2x00t-32gbit/qla_os.c index 56764e9..581e324 100644 --- a/qla2x00t-32gbit/qla_os.c +++ b/qla2x00t-32gbit/qla_os.c @@ -3032,7 +3032,7 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) #if LINUX_VERSION_CODE < KERNEL_VERSION(6, 0, 0) && \ (!defined(RHEL_RELEASE_CODE) || \ - RHEL_RELEASE_CODE -0 < RHEL_RELEASE_VERSION(9, 5)) + RHEL_RELEASE_CODE -0 < RHEL_RELEASE_VERSION(9, 4)) /* This may fail but that's ok */ pci_enable_pcie_error_reporting(pdev); #endif @@ -4063,7 +4063,7 @@ qla2x00_remove_one(struct pci_dev *pdev) #if LINUX_VERSION_CODE < KERNEL_VERSION(6, 0, 0) && \ (!defined(RHEL_RELEASE_CODE) || \ - RHEL_RELEASE_CODE -0 < RHEL_RELEASE_VERSION(9, 5)) + RHEL_RELEASE_CODE -0 < RHEL_RELEASE_VERSION(9, 4)) pci_disable_pcie_error_reporting(pdev); #endif @@ -6966,7 +6966,7 @@ qla2x00_disable_board_on_pci_error(struct work_struct *work) pci_release_selected_regions(ha->pdev, ha->bars); #if LINUX_VERSION_CODE < KERNEL_VERSION(6, 0, 0) && \ (!defined(RHEL_RELEASE_CODE) || \ - RHEL_RELEASE_CODE -0 < RHEL_RELEASE_VERSION(9, 5)) + RHEL_RELEASE_CODE -0 < RHEL_RELEASE_VERSION(9, 4)) pci_disable_pcie_error_reporting(pdev); #endif pci_disable_device(pdev); diff --git a/qla2x00t/qla_os.c b/qla2x00t/qla_os.c index c3e2d37..c2940f6 100644 --- a/qla2x00t/qla_os.c +++ b/qla2x00t/qla_os.c @@ -2395,7 +2395,7 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) #if LINUX_VERSION_CODE < KERNEL_VERSION(6, 0, 0) && \ (!defined(RHEL_RELEASE_CODE) || \ - RHEL_RELEASE_CODE -0 < RHEL_RELEASE_VERSION(9, 5)) + RHEL_RELEASE_CODE -0 < RHEL_RELEASE_VERSION(9, 4)) /* This may fail but that's ok */ pci_enable_pcie_error_reporting(pdev); #endif @@ -3052,7 +3052,7 @@ qla2x00_remove_one(struct pci_dev *pdev) #if LINUX_VERSION_CODE < KERNEL_VERSION(6, 0, 0) && \ (!defined(RHEL_RELEASE_CODE) || \ - RHEL_RELEASE_CODE -0 < RHEL_RELEASE_VERSION(9, 5)) + RHEL_RELEASE_CODE -0 < RHEL_RELEASE_VERSION(9, 4)) pci_disable_pcie_error_reporting(pdev); #endif pci_disable_device(pdev); diff --git a/scst/include/backport.h b/scst/include/backport.h index 0d58c05..83a0154 100644 --- a/scst/include/backport.h +++ b/scst/include/backport.h @@ -373,10 +373,11 @@ blkdev_issue_discard_backport(struct block_device *bdev, sector_t sector, * See also f2f2efb807d3 ("byteorder: Move {cpu_to_be32, be32_to_cpu}_array() * from Thunderbolt to core") # v4.15. */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0) && \ +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0) && \ (!defined(RHEL_MAJOR) || RHEL_MAJOR -0 < 7 || \ - RHEL_MAJOR -0 == 7 && RHEL_MINOR -0 < 5) && \ - !defined(UEK_KABI_RENAME) + RHEL_MAJOR -0 == 7 && RHEL_MINOR -0 < 5) && \ + (!defined(UEK_KABI_RENAME) || \ + LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 0)) static inline void cpu_to_be32_array(__be32 *dst, const u32 *src, size_t len) { int i; @@ -941,7 +942,8 @@ static inline void *kvmalloc_array(size_t n, size_t size, gfp_t flags) RHEL_MAJOR -0 == 7 && RHEL_MINOR -0 < 7) && \ !defined(CONFIG_SUSE_KERNEL) && \ !defined(_COMPAT_LINUX_MM_H) && \ - !defined(UEK_KABI_RENAME) + (!defined(UEK_KABI_RENAME) || \ + LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 0)) /* See also commit 1c542f38ab8d ("mm: Introduce kvcalloc()") # v4.18. */ static inline void *kvcalloc(size_t n, size_t size, gfp_t flags) { @@ -1926,7 +1928,9 @@ static inline struct request *scsi_cmd_to_rq(struct scsi_cmnd *scmd) #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0) || \ (defined(RHEL_RELEASE_CODE) && \ - RHEL_RELEASE_CODE -0 < RHEL_RELEASE_VERSION(8, 7)) + RHEL_RELEASE_CODE -0 < RHEL_RELEASE_VERSION(8, 7)) || \ + (defined(UEK_KABI_RENAME) && \ + LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)) static inline u32 scsi_prot_ref_tag(struct scsi_cmnd *scmd) { #if defined(RHEL_MAJOR) && RHEL_MAJOR -0 == 7 @@ -2099,7 +2103,8 @@ enum { (!defined(RHEL_MAJOR) || RHEL_MAJOR -0 < 8 || \ RHEL_MAJOR -0 == 8 && RHEL_MINOR -0 < 9 || \ RHEL_MAJOR -0 == 9 && RHEL_MINOR -0 < 3) && \ - !defined(UEK_KABI_RENAME) + (!defined(UEK_KABI_RENAME) || \ + LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0)) /* * See also commit 64fd2ba977b1 ("scsi: scsi_transport_fc: Add an additional * flag to fc_host_fpin_rcv()") # v6.3 @@ -2142,7 +2147,9 @@ static inline int fc_block_rport(struct fc_rport *rport) /* See also commit a7dff3ad4787 ("scsi: fc: add FPIN ELS definition") # v5.2 */ #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 2, 0) && \ (!defined(RHEL_MAJOR) || RHEL_MAJOR -0 < 8 || \ - (RHEL_MAJOR -0 == 8 && RHEL_MINOR -0 < 2)) + (RHEL_MAJOR -0 == 8 && RHEL_MINOR -0 < 2)) && \ + (!defined(UEK_KABI_RENAME) || \ + LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 0)) #define ELS_FPIN 0x16 #endif @@ -2150,10 +2157,11 @@ static inline int fc_block_rport(struct fc_rport *rport) * See also commit 62e9dd177732 ("scsi: qla2xxx: Change in PUREX to handle FPIN * ELS requests"). */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 9, 0) && \ - (!defined(RHEL_MAJOR) || RHEL_MAJOR -0 < 8 || \ - (RHEL_MAJOR -0 == 8 && RHEL_MINOR -0 < 4)) && \ - !(defined(UEK_KABI_RENAME) && defined(FC_PORTSPEED_256GBIT)) +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 9, 0) && \ + (!defined(RHEL_MAJOR) || RHEL_MAJOR -0 < 8 || \ + (RHEL_MAJOR -0 == 8 && RHEL_MINOR -0 < 4)) && \ + (!defined(UEK_KABI_RENAME) || \ + LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 0)) #define ELS_RDP 0x18 #endif |
From: Gleb C. <lna...@ya...> - 2025-10-01 19:11:59
|
Commit: 5245d1c GitHub URL: https://github.com/SCST-project/scst/commit/5245d1cb15b8ccf6a3a044ea58ce87652788c639 Author: Gleb Chesnokov Date: 2025-10-01T22:11:28+03:00 Log Message: ----------- .github/workflows: Print compilation output and improve annotations Show the kernel compilation output whenever the run reached the compilation stage (both pass/fail cases) and add a readable prefix with the actual filename. Also refactor to use variables for version, workdir, and output; quote expansions; and switch to titled GitHub Actions annotations. Drop `-k` and rely on explicit cleanup. Modified Paths: -------------- .github/workflows/run_regression_tests.yaml | 23 +++++++++++---- 1 file changed, 17 insertions(+), 6 deletions(-) =================================================================== diff --git a/.github/workflows/run_regression_tests.yaml b/.github/workflows/run_regression_tests.yaml index 2bf37f2..e04a616 100644 --- a/.github/workflows/run_regression_tests.yaml +++ b/.github/workflows/run_regression_tests.yaml @@ -85,19 +85,30 @@ jobs: - name: Run regression tests run: | err=0 + version="${{matrix.version}}" + workdir="/tmp/scst-${version}" + out="output.txt" - ./scripts/run-regression-tests -l -q -k -d /tmp/scst-${{matrix.version}} ${{matrix.version}}-nc-ns-nm | tee output.txt + ./scripts/run-regression-tests -l -q -d "${workdir}" "${version}-nc-ns-nm" | tee "${out}" - if ! grep -q "Compiling the patched kernel" output.txt; then - echo "::error ::run-regression-tests failed" + if ! grep -q "Compiling the patched kernel" "${out}"; then + echo "::error title=Regression tests::run-regression-tests failed" err=1 else - if grep -A1 "Compiling the patched kernel" output.txt | grep -E -q "FAILED|[1-9][0-9]* errors"; then - echo "::error ::Regression test failed" + if grep -A1 "Compiling the patched kernel" "${out}" | grep -E -q "FAILED|[1-9][0-9]* errors"; then + echo "::error title=Regression tests::Regression test failed" err=1 + else + echo "::notice title=Regression tests::Succeeded" fi + + f=( "${workdir}"/compilation-*-output.txt ) + echo + echo "===== $(basename "${f[0]}") =====" + cat "${f[0]}" fi - rm -f output.txt + rm -rf "${workdir}" + rm -f "${out}" exit $err |
From: Gleb C. <lna...@ya...> - 2025-10-01 19:11:49
|
Commit: 59bdb24 GitHub URL: https://github.com/SCST-project/scst/commit/59bdb2463c1c7f4ea4e5363db043784139b294f5 Author: Gleb Chesnokov Date: 2025-10-01T22:11:28+03:00 Log Message: ----------- scripts/specialize-patch: treat "#if 0" and "#if 0 && ..." as constant-false Partial evaluation can yield guards like "+#if 0 && ...". These are false but bypassed the filter that only matched exact "+#if 0"/"+#elif 0". Tighten the regex to match the original spacing and catch both forms. This is the minimal change addressing the bug observed in logs such as: (c) +#if 0 && !(1 && defined(FC_PORTSPEED_256GBIT)) ... (g2) ... output = 1 <-- wrong After this change such guards are dropped correctly (output = 0). Modified Paths: -------------- scripts/specialize-patch | 2 +- scst/include/backport.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) =================================================================== diff --git a/scripts/specialize-patch b/scripts/specialize-patch index 5c00244..06e49ba 100755 --- a/scripts/specialize-patch +++ b/scripts/specialize-patch @@ -553,7 +553,7 @@ function process_preprocessor_statement(evaluated, condition) { if (debug) printf "/* debug specialize-patch: (g1b) %s: decision[%d] = %s */\n", \ evaluated, i, decision[i] - output = output && decision[i] != "+#if 0" && decision[i] != "+#elif 0" + output = output && decision[i] !~ "^+#(if|elif) 0($| &&)" } if (output) any_section_output[if_nesting_level] = 1 diff --git a/scst/include/backport.h b/scst/include/backport.h index ef02080..0d58c05 100644 --- a/scst/include/backport.h +++ b/scst/include/backport.h @@ -2152,7 +2152,7 @@ static inline int fc_block_rport(struct fc_rport *rport) */ #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 9, 0) && \ (!defined(RHEL_MAJOR) || RHEL_MAJOR -0 < 8 || \ - RHEL_MAJOR -0 == 8 && RHEL_MINOR -0 < 4) && \ + (RHEL_MAJOR -0 == 8 && RHEL_MINOR -0 < 4)) && \ !(defined(UEK_KABI_RENAME) && defined(FC_PORTSPEED_256GBIT)) #define ELS_RDP 0x18 #endif |
From: Gleb C. <lna...@ya...> - 2025-09-30 15:12:02
|
Commit: 9543060 GitHub URL: https://github.com/SCST-project/scst/commit/9543060a2ccbb5c3c5a214da8582abaa1278386e Author: Gleb Chesnokov Date: 2025-09-30T18:09:11+03:00 Log Message: ----------- scripts/generate-kernel-patch: Use krel for qla2xxx patch paths Fix mismatch where generate-kernel-patch keyed paths by full_kver (with ‘^’) but in-tree patches were written under krel (before ‘^’). Derive krel=${full_kver/^*} and use it for qla2xxx path resolution. Modified Paths: -------------- qla2x00t-32gbit/extract-qla2xxx-orig | 28 ++++++++------- qla2x00t-32gbit/generate-in-tree-patches | 26 +++++++------- qla2x00t/extract-qla2xxx-orig | 21 ++++++----- qla2x00t/generate-in-tree-patches | 22 ++++++------ scripts/generate-kernel-patch | 18 ++++++---- scripts/run-regression-tests | 6 ++-- 6 files changed, 65 insertions(+), 56 deletions(-) =================================================================== diff --git a/qla2x00t-32gbit/extract-qla2xxx-orig b/qla2x00t-32gbit/extract-qla2xxx-orig index c969fbf..124f324 100755 --- a/qla2x00t-32gbit/extract-qla2xxx-orig +++ b/qla2x00t-32gbit/extract-qla2xxx-orig @@ -6,25 +6,27 @@ source "$(dirname "$0")/../scripts/kernel-functions" || exit $? # Argument verification # ######################### -kernel_version="$1" +full_kver="$1" -if [ "$1" = "" ]; then +if [ "${full_kver}" = "" ]; then echo "Error: missing kernel version argument." exit 1 fi +krel=${full_kver/^*} + mkdir -p qla2xxx-orig cd qla2xxx-orig || exit $? -download_and_extract_kernel_tree "${kernel_version}" || exit $? -kernel_version=${kernel_version/^*} -touch "linux-${kernel_version}"/drivers/scsi/qla2xxx/* -rm -rf "${kernel_version}" -mkdir -p "${kernel_version}/include/trace/events" -mv "linux-${kernel_version}"/drivers/scsi/qla2xxx/* "${kernel_version}" -if [ -e "linux-${kernel_version}"/include/trace/events/qla.h ]; then - touch "linux-${kernel_version}"/include/trace/events/qla.h - mv "linux-${kernel_version}"/include/trace/events/qla.h \ - "${kernel_version}/include/trace/events" +download_and_extract_kernel_tree "${full_kver}" || exit $? + +touch "linux-${krel}"/drivers/scsi/qla2xxx/* +rm -rf "${krel}" +mkdir -p "${krel}/include/trace/events" + +mv "linux-${krel}"/drivers/scsi/qla2xxx/* "${krel}" +if [ -e "linux-${krel}"/include/trace/events/qla.h ]; then + touch "linux-${krel}"/include/trace/events/qla.h + mv "linux-${krel}"/include/trace/events/qla.h "${krel}/include/trace/events" fi -rm -rf "linux-${kernel_version}" +rm -rf "linux-${krel}" cd .. diff --git a/qla2x00t-32gbit/generate-in-tree-patches b/qla2x00t-32gbit/generate-in-tree-patches index bcc5db2..4ab0e5c 100755 --- a/qla2x00t-32gbit/generate-in-tree-patches +++ b/qla2x00t-32gbit/generate-in-tree-patches @@ -1,24 +1,24 @@ #!/bin/bash -kernel_version="$1" +full_kver="$1" -if [ "$kernel_version" = "" ]; then +if [ "$full_kver" = "" ]; then echo "Error: missing kernel version argument." exit 1 fi -if [ ! -e qla2xxx-orig/${kernel_version/^*} ]; then - "$(dirname "$0")/extract-qla2xxx-orig" "$kernel_version" || exit $? -fi +krel=${full_kver/^*} -kernel_version=${kernel_version/^*} +if [ ! -e qla2xxx-orig/"${krel}" ]; then + "$(dirname "$0")/extract-qla2xxx-orig" "${full_kver}" || exit $? +fi -mkdir -p in-tree-patches/"${kernel_version}" +mkdir -p in-tree-patches/"${krel}" for g in Kconfig *.[ch]; do - f1="qla2xxx-orig/${kernel_version}/$g" + f1="qla2xxx-orig/${krel}/$g" f2="$g" - f3="in-tree-patches/${kernel_version}/$g.patch" + f3="in-tree-patches/${krel}/$g.patch" if [ "$f1" -nt "$f3" -o "$f2" -nt "$f3" ]; then if [ -e "$f1" ]; then diff -up "$f1" "$f2" > "$f3" @@ -29,9 +29,9 @@ for g in Kconfig *.[ch]; do done for g in include/trace/events/qla.h; do - f1="qla2xxx-orig/${kernel_version}/$g" + f1="qla2xxx-orig/${krel}/$g" f2="$g" - f3="in-tree-patches/${kernel_version}/${g#include/trace/events/}.patch" + f3="in-tree-patches/${krel}/${g#include/trace/events/}.patch" if [ "$f1" -nt "$f3" -o "$f2" -nt "$f3" ]; then if [ -e "$f1" ]; then diff -up "$f1" "$f2" > "$f3" @@ -42,9 +42,9 @@ for g in include/trace/events/qla.h; do done for g in Makefile; do - f1="qla2xxx-orig/${kernel_version}/$g" + f1="qla2xxx-orig/${krel}/$g" f2="${g}_in-tree" - f3="in-tree-patches/${kernel_version}/$g.patch" + f3="in-tree-patches/${krel}/$g.patch" if [ "$f1" -nt "$f3" -o "$f2" -nt "$f3" ]; then diff -up "$f1" "$f2" > "$f3" fi diff --git a/qla2x00t/extract-qla2xxx-orig b/qla2x00t/extract-qla2xxx-orig index 2f9e8c3..7f1b502 100755 --- a/qla2x00t/extract-qla2xxx-orig +++ b/qla2x00t/extract-qla2xxx-orig @@ -6,20 +6,23 @@ source "$(dirname "$0")/../scripts/kernel-functions" || exit $? # Argument verification # ######################### -kernel_version="$1" +full_kver="$1" -if [ "$1" = "" ]; then +if [ "${full_kver}" = "" ]; then echo "Error: missing kernel version argument." exit 1 fi +krel=${full_kver/^*} + mkdir -p qla2xxx-orig cd qla2xxx-orig || exit $? -download_and_extract_kernel_tree "${kernel_version}" || exit $? -kernel_version=${kernel_version/^*} -touch "linux-${kernel_version}"/drivers/scsi/qla2xxx/* -rm -rf "${kernel_version}" -mkdir -p "${kernel_version}" -mv "linux-${kernel_version}"/drivers/scsi/qla2xxx/* "${kernel_version}" -rm -rf "linux-${kernel_version}" +download_and_extract_kernel_tree "${full_kver}" || exit $? + +touch "linux-${krel}"/drivers/scsi/qla2xxx/* +rm -rf "${krel}" +mkdir -p "${krel}" + +mv "linux-${krel}"/drivers/scsi/qla2xxx/* "${krel}" +rm -rf "linux-${krel}" cd .. diff --git a/qla2x00t/generate-in-tree-patches b/qla2x00t/generate-in-tree-patches index 5d57317..3256f56 100755 --- a/qla2x00t/generate-in-tree-patches +++ b/qla2x00t/generate-in-tree-patches @@ -1,24 +1,24 @@ #!/bin/bash -kernel_version="$1" +full_kver="$1" -if [ "$kernel_version" = "" ]; then +if [ "${full_kver}" = "" ]; then echo "Error: missing kernel version argument." exit 1 fi -if [ ! -e qla2xxx-orig/${kernel_version/^*} ]; then - "$(dirname "$0")/extract-qla2xxx-orig" "$kernel_version" || exit $? -fi +krel=${full_kver/^*} -kernel_version=${kernel_version/^*} +if [ ! -e qla2xxx-orig/"${krel}" ]; then + "$(dirname "$0")/extract-qla2xxx-orig" "${full_kver}" || exit $? +fi -mkdir -p in-tree-patches/"${kernel_version}" +mkdir -p in-tree-patches/"${krel}" for g in Kconfig *.[ch]; do - f1="qla2xxx-orig/${kernel_version}/$g" + f1="qla2xxx-orig/${krel}/$g" f2="$g" - f3="in-tree-patches/${kernel_version}/$g.patch" + f3="in-tree-patches/${krel}/$g.patch" if [ "$f1" -nt "$f3" -o "$f2" -nt "$f3" ]; then if [ -e "$f1" ]; then diff -up "$f1" "$f2" > "$f3" @@ -29,9 +29,9 @@ for g in Kconfig *.[ch]; do done for g in Makefile; do - f1="qla2xxx-orig/${kernel_version}/$g" + f1="qla2xxx-orig/${krel}/$g" f2="${g}_in-tree" - f3="in-tree-patches/${kernel_version}/$g.patch" + f3="in-tree-patches/${krel}/$g.patch" if [ "$f1" -nt "$f3" -o "$f2" -nt "$f3" ]; then diff -up "$f1" "$f2" > "$f3" fi diff --git a/scripts/generate-kernel-patch b/scripts/generate-kernel-patch index ca73bce..e54b65a 100755 --- a/scripts/generate-kernel-patch +++ b/scripts/generate-kernel-patch @@ -236,7 +236,8 @@ fi # Strip patch level from the kernel version number. full_kver="$1" -kver="$(kernel_version "$1")" +kver="$(kernel_version "${full_kver}")" +krel=${full_kver/^*} # See also commit 89d9a567952b ("[SCSI] add support for per-host cmd pools"; # v3.15). @@ -490,11 +491,11 @@ add_file "iscsi-scst/README_in-tree" "Documentation/scst/README.iscsi" \ if [ "${qla2x00t}" = "true" ]; then - ( cd qla2x00t && "$PWD/generate-in-tree-patches" "$1" ) || exit $? + ( cd qla2x00t && "$PWD/generate-in-tree-patches" "${full_kver}" ) || exit $? - for f in qla2x00t/in-tree-patches/"$1"/*.patch; do + for f in qla2x00t/in-tree-patches/"${krel}"/*.patch; do [ -e "$f" ] || continue - g="${f#qla2x00t/in-tree-patches/$1/}" + g="${f#qla2x00t/in-tree-patches/"${krel}"/}" g="${g%.patch}" add_patch "${f}" "drivers/scsi/qla2xxx/${g}" done @@ -516,12 +517,14 @@ if [ "${qla2x00t}" = "true" ]; then elif [ "${qla2x00t_32gbit}" = "true" ]; then - ( cd qla2x00t-32gbit && "$PWD/generate-in-tree-patches" "$1" ) || exit $? + ( cd qla2x00t-32gbit && "$PWD/generate-in-tree-patches" "${full_kver}" ) || exit $? - for f in qla2x00t-32gbit/in-tree-patches/"$1"/*.patch; do + for f in qla2x00t-32gbit/in-tree-patches/"${krel}"/*.patch; do [ -e "$f" ] || continue - g="${f#qla2x00t-32gbit/in-tree-patches/$1/}" + + g="${f#qla2x00t-32gbit/in-tree-patches/"${krel}"/}" g="${g%.patch}" + if [ "$g" = "qla.h" ]; then add_patch "${f}" "include/trace/events/${g}" else @@ -531,6 +534,7 @@ elif [ "${qla2x00t_32gbit}" = "true" ]; then for f in qla2x00t-32gbit/qla2x00-target/*.[ch]; do [ -e "$f" ] || continue + add_file "${f}" "drivers/scsi/qla2xxx/${f#qla2x00t-32gbit/qla2x00-target/}" done diff --git a/scripts/run-regression-tests b/scripts/run-regression-tests index 40a3da8..f16ab18 100755 --- a/scripts/run-regression-tests +++ b/scripts/run-regression-tests @@ -210,11 +210,11 @@ function generate_kernel_patch { kver="$(kernel_version "${1/^*}")" driver_options=(-l) - "${scriptsdir}"/generate-kernel-patch "${driver_options[@]}" $2 "$1" > "${patchfile}" + "${scriptsdir}"/generate-kernel-patch "${driver_options[@]}" "$2" "$1" > "${patchfile}" - "${scriptsdir}"/generate-kernel-patch "${driver_options[@]}" -n $2 "$1" > "${patchfile_m}" + "${scriptsdir}"/generate-kernel-patch "${driver_options[@]}" -n "$2" "$1" > "${patchfile_m}" - "${scriptsdir}"/generate-kernel-patch "${driver_options[@]}" -p "${outputdir}/${patchdir}" $2 "$1" + "${scriptsdir}"/generate-kernel-patch "${driver_options[@]}" -p "${outputdir}/${patchdir}" "$2" "$1" } # Run checkpatch on the generated kernel patch. Assumes that there is a |
From: Gleb C. <lna...@ya...> - 2025-09-30 15:11:10
|
Commit: 90c26fa GitHub URL: https://github.com/SCST-project/scst/commit/90c26fa844f03fcaa6eff9fd1747452fbae91a17 Author: Gleb Chesnokov Date: 2025-09-30T18:09:11+03:00 Log Message: ----------- scripts/run-regression-tests: Drop 2.6.x paths and simplify builds Always include drivers/scsi/qla2xxx in subdirs and extend the local module build loop to cover both qla2x00t and qla2x00t-32gbit. Modified Paths: -------------- scripts/generate-kernel-patch | 66 +++------------ scripts/run-regression-tests | 29 ++----- scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.18.patch | 12 --- scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.23.patch | 12 --- scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.24.patch | 12 --- scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.25.patch | 12 --- scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.26.patch | 12 --- scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.27.patch | 12 --- scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.28.patch | 12 --- scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.29.patch | 12 --- scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.30.patch | 12 --- scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.31.patch | 12 --- scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.32.patch | 12 --- scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.33.patch | 12 --- scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.34.patch | 12 --- scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.35.patch | 12 --- scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.36.patch | 12 --- scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.7.patch | 11 --- scst/kernel/in-tree/Makefile.dev_handlers-2.6.23 | 11 --- scst/kernel/in-tree/Makefile.dev_handlers-2.6.24 | 11 --- scst/kernel/in-tree/Makefile.dev_handlers-2.6.25 | 11 --- scst/kernel/in-tree/Makefile.dev_handlers-2.6.26 | 11 --- scst/kernel/in-tree/Makefile.dev_handlers-2.6.27 | 11 --- scst/kernel/in-tree/Makefile.dev_handlers-2.6.28 | 11 --- scst/kernel/in-tree/Makefile.dev_handlers-2.6.29 | 11 --- scst/kernel/in-tree/Makefile.dev_handlers-2.6.30 | 11 --- scst/kernel/in-tree/Makefile.dev_handlers-2.6.31 | 11 --- scst/kernel/in-tree/Makefile.dev_handlers-2.6.32 | 11 --- scst/kernel/in-tree/Makefile.dev_handlers-2.6.33 | 11 --- scst/kernel/in-tree/Makefile.dev_handlers-2.6.34 | 11 --- scst/kernel/in-tree/Makefile.drivers.Linux-2.6.15.patch | 10 --- scst/kernel/in-tree/Makefile.drivers.Linux-2.6.18.patch | 11 --- scst/kernel/in-tree/Makefile.drivers.Linux-2.6.23.patch | 11 --- scst/kernel/in-tree/Makefile.drivers.Linux-2.6.24.patch | 11 --- scst/kernel/in-tree/Makefile.drivers.Linux-2.6.25.patch | 11 --- scst/kernel/in-tree/Makefile.drivers.Linux-2.6.26.patch | 11 --- scst/kernel/in-tree/Makefile.drivers.Linux-2.6.27.patch | 11 --- scst/kernel/in-tree/Makefile.drivers.Linux-2.6.28.patch | 11 --- scst/kernel/in-tree/Makefile.drivers.Linux-2.6.29.patch | 11 --- scst/kernel/in-tree/Makefile.drivers.Linux-2.6.30.patch | 11 --- scst/kernel/in-tree/Makefile.drivers.Linux-2.6.31.patch | 11 --- scst/kernel/in-tree/Makefile.drivers.Linux-2.6.32.patch | 11 --- scst/kernel/in-tree/Makefile.drivers.Linux-2.6.33.patch | 11 --- scst/kernel/in-tree/Makefile.drivers.Linux-2.6.34.patch | 11 --- scst/kernel/in-tree/Makefile.drivers.Linux-2.6.35.patch | 8 -- scst/kernel/in-tree/Makefile.drivers.Linux-2.6.36.patch | 8 -- scst/kernel/in-tree/Makefile.drivers.Linux-2.6.37.patch | 9 -- scst/kernel/in-tree/Makefile.drivers.Linux-2.6.38.patch | 11 --- scst/kernel/in-tree/Makefile.drivers.Linux-2.6.39.patch | 11 --- scst/kernel/in-tree/Makefile.drivers.Linux-2.6.7.patch | 10 --- scst/kernel/in-tree/Makefile.drivers.Linux-3.0.patch | 11 --- scst/kernel/in-tree/Makefile.drivers.Linux-3.1.patch | 11 --- scst/kernel/in-tree/Makefile.drivers.Linux-3.2.patch | 11 --- scst/kernel/in-tree/Makefile.drivers.Linux-3.3.patch | 12 --- scst/kernel/in-tree/Makefile.drivers.Linux-3.4.patch | 12 --- scst/kernel/in-tree/Makefile.drivers.Linux-3.5.patch | 12 --- scst/kernel/in-tree/Makefile.drivers.Linux-3.6.patch | 12 --- scst/kernel/in-tree/Makefile.scst-2.6.23 | 16 ---- scst/kernel/in-tree/Makefile.scst-2.6.24 | 16 ---- scst/kernel/in-tree/Makefile.scst-2.6.25 | 16 ---- scst/kernel/in-tree/Makefile.scst-2.6.26 | 16 ---- scst/kernel/in-tree/Makefile.scst-2.6.27 | 16 ---- scst/kernel/in-tree/Makefile.scst-2.6.28 | 16 ---- scst/kernel/in-tree/Makefile.scst-2.6.29 | 16 ---- scst/kernel/in-tree/Makefile.scst-2.6.30 | 16 ---- scst/kernel/in-tree/Makefile.scst-2.6.31 | 16 ---- scst/kernel/in-tree/Makefile.scst-2.6.32 | 16 ---- 67 files changed, 20 insertions(+), 849 deletions(-) =================================================================== diff --git a/scripts/generate-kernel-patch b/scripts/generate-kernel-patch index 7a0480a..ca73bce 100755 --- a/scripts/generate-kernel-patch +++ b/scripts/generate-kernel-patch @@ -238,13 +238,6 @@ fi full_kver="$1" kver="$(kernel_version "$1")" -# Include fcst in the patch for kernel versions 2.6.33 and later. -if kernel_version_le "2.6.37" "${kver}"; then - include_fcst="true" -else - include_fcst="false" -fi - # See also commit 89d9a567952b ("[SCSI] add support for per-host cmd pools"; # v3.15). if kernel_version_lt "$kver" 3.18; then @@ -261,15 +254,8 @@ else scst_makefile="Makefile.scst" fi -# Make sure that for kernel 2.6.26 and later the line -# "#define CONFIG_SCST_PROC" is removed from scst/include/scst.h. -if grep -qw scst_sysfs scst/kernel/in-tree/${scst_makefile} \ - || [ "${generating_upstream_patch}" = "true" ]; -then - specialize_patch_options+=(-v "config_scst_proc_undefined=1") -else - include_proc_impl="true" -fi +specialize_patch_options+=(-v "config_scst_proc_undefined=1") + if [ "${debug_specialize}" = "true" ]; then specialize_patch_options+=(-v "debug=1") fi @@ -315,7 +301,6 @@ scst_06_lib="scst/src/scst_lib.c" scst_07_pres="scst/src/scst_pres.h scst/src/scst_pres.c" scst_08_sysfs="scst/src/scst_sysfs.c" scst_09_debug="scst/include/scst_debug.h scst/src/scst_debug.c" -scst_proc="scst/src/scst_proc.c" scst_10_sgv="scst/include/scst_sgv.h scst/src/scst_mem.h scst/src/scst_mem.c doc/scst_pg.sgml" scst_user="scst/include/scst_user.h scst/src/dev_handlers/scst_user.c" scst_13_vdisk="scst/src/dev_handlers/scst_vdisk.c" @@ -323,11 +308,8 @@ scst_14_tg="scst/src/scst_tg.c" separate_patches="scst_03_public_headers scst_04_main scst_05_targ scst_06_lib scst_07_pres scst_08_sysfs scst_09_debug scst_10_sgv scst_user scst_13_vdisk scst_14_tg" # Suppress shellcheck warnings about unused variables. -echo "$scst_03_public_headers $scst_04_main $scst_05_targ $scst_06_lib $scst_07_pres $scst_08_sysfs $scst_09_debug $scst_proc $scst_10_sgv $scst_user $scst_13_vdisk $scst_14_tg" >/dev/null +echo "$scst_03_public_headers $scst_04_main $scst_05_targ $scst_06_lib $scst_07_pres $scst_08_sysfs $scst_09_debug $scst_10_sgv $scst_user $scst_13_vdisk $scst_14_tg" >/dev/null -if [ "$include_proc_impl" = "true" ]; then - separate_patches+=" scst_proc" -fi source_files_in_separate_patch="" for s in ${separate_patches} do @@ -347,8 +329,7 @@ else "drivers/Kconfig" fi -if [ "${full_kver#2.6.32-}" = "${full_kver}" ] && - [ -e "scst/kernel/in-tree/Makefile.drivers.Linux-${kver}.patch" ]; then +if [ -e "scst/kernel/in-tree/Makefile.drivers.Linux-${kver}.patch" ]; then add_patch "scst/kernel/in-tree/Makefile.drivers.Linux-${kver}.patch"\ "drivers/Makefile" else @@ -366,29 +347,11 @@ tmpdir="/tmp/scst-$$" mkdir -p "${tmpdir}" tmp_Kconfig="${tmpdir}/Kconfig.scst-${kver}" -# shellcheck disable=SC2002 -cat "scst/kernel/in-tree/Kconfig.scst" | \ -if [ "${include_fcst}" = true ]; then - cat -else - grep -v '^source "drivers/scst/fcst/Kconfig"$' -fi >"${tmp_Kconfig}" +cat "scst/kernel/in-tree/Kconfig.scst" >"${tmp_Kconfig}" add_file "${tmp_Kconfig}" "drivers/scst/Kconfig" tmp_Makefile="${tmpdir}/${scst_makefile}" -# shellcheck disable=SC2002 -cat "scst/kernel/in-tree/${scst_makefile}" | \ -if [ "$include_proc_impl" != "true" ]; then - grep -v 'scst_proc' -else - cat -fi | \ - if [ "${include_fcst}" = true ] && [ "${kver}" != "2.6.37" ] && - [ "${kver}" != "2.6.38" ]; then - cat -else - sed -e 's: fcst/* : :' -fi >"$tmp_Makefile" +cat "scst/kernel/in-tree/${scst_makefile}" >"${tmp_Makefile}" add_file "$tmp_Makefile" "drivers/scst/Makefile" rm -rf "${tmpdir}" @@ -434,8 +397,7 @@ done # Directory drivers/scst/dev_handlers/ -if [ -e "scst/kernel/in-tree/Makefile.dev_handlers-${kver}" ] -then +if [ -e "scst/kernel/in-tree/Makefile.dev_handlers-${kver}" ]; then add_file "scst/kernel/in-tree/Makefile.dev_handlers-${kver}" \ "drivers/scst/dev_handlers/Makefile" \ | process_patch "scst_11_dev_handlers_makefile.diff" @@ -456,7 +418,7 @@ done \ # Directory drivers/scst/fcst/ -if [ "${include_fcst}" = true ]; then +( if [ -e "${fcst_patch_series}" ]; then grep -v '^#' "${fcst_patch_series}" | while read -r f; do @@ -474,8 +436,7 @@ if [ "${include_fcst}" = true ]; then [ -e "$f" ] || continue add_file "${f}" "drivers/scst/fcst/${f#fcst/}" done -fi \ -| process_patch "fcst.diff" +) | process_patch "fcst.diff" add_file "fcst/README" "Documentation/scst/README.fcst" \ | process_patch "fcst-doc.diff" @@ -519,8 +480,7 @@ for f in iscsi-scst/kernel/isert-scst/*.[ch]; do done add_file "iscsi-scst/kernel/isert-scst/Makefile.in-kernel" "drivers/scst/iscsi-scst/isert-scst/Makefile" add_file "iscsi-scst/kernel/isert-scst/Kconfig" "drivers/scst/iscsi-scst/isert-scst/Kconfig" -) \ -| process_patch "iscsi-scst.diff" +) | process_patch "iscsi-scst.diff" add_file "iscsi-scst/README_in-tree" "Documentation/scst/README.iscsi" \ | process_patch "iscsi-scst-doc.diff" @@ -578,8 +538,7 @@ elif [ "${qla2x00t_32gbit}" = "true" ]; then "Documentation/scst/README.qla2x00t" \ | process_patch "qla2x00t-doc.diff" -fi \ -| process_patch "qla2x00t.diff" +fi | process_patch "qla2x00t.diff" # Directory drivers/scst/srpt @@ -639,5 +598,4 @@ fi \ fi add_file "scst_local/scst_local.c" "drivers/scst/scst_local/scst_local.c" -) \ -| process_patch "scst_16_local.diff" +) | process_patch "scst_16_local.diff" diff --git a/scripts/run-regression-tests b/scripts/run-regression-tests index 05b81a6..40a3da8 100755 --- a/scripts/run-regression-tests +++ b/scripts/run-regression-tests @@ -125,12 +125,12 @@ function make_dpkg { function compile_scst { ( - for p in scst scst_local iscsi-scst srpt qla2x00t qla2x00t-32gbit; do - if [ "${p%qla2x00t}" != "$p" ]; then + for d in scst iscsi-scst qla2x00t qla2x00t-32gbit srpt scst_local fcst usr; do + if [[ $d = qla2x00t || $d = qla2x00t-32gbit ]]; then BUILD_2X_MODULE=y CONFIG_SCSI_QLA_FC=y CONFIG_SCSI_QLA2XXX_TARGET=y \ - make -C "$p/qla2x00-target" || return $? + make -j"$(nproc)" -C "$d" || return $? else - make -C "$p" || return $? + make -j"$(nproc)" -C "$d" || return $? fi done ) @@ -321,17 +321,8 @@ CONFIG_LTO_CLANG \ " local enable="CONFIG_UNWINDER_FRAME_POINTER" - case "$1" in - 2.6.32-*) - echo "Enabling CONFIG_EVENT_TRACING for CentOS 6.x" - enable="$enable \ - CONFIG_DEBUG_KERNEL \ - CONFIG_FTRACE \ - CONFIG_EVENT_TRACING \ - CONFIG_DYNAMIC_DEBUG";; - *) - disable="$disable CONFIG_EVENT_TRACING";; - esac + # SCST does not need event tracing on supported kernels + disable="$disable CONFIG_EVENT_TRACING" echo "Patching and configuring kernel ..." if [ "$ipv6" = "false" ]; then @@ -394,7 +385,7 @@ function compile_kernel { if (cd "${outputdir}/linux-$k" \ && make -s modules_prepare \ && make -s scripts \ - && for subdir; do LC_ALL=C KBUILD_MODPOST_WARN=1 make -j$(nproc) -k M="${subdir}"; done + && for subdir; do LC_ALL=C KBUILD_MODPOST_WARN=1 make -j"$(nproc)" -k M="${subdir}"; done ) &> "${outputfile}" then local errors warnings @@ -581,7 +572,6 @@ kernel_versions="" outputdir="${PWD}/regression-test-output-$(date +%Y-%m-%d_%Hh%Mm%Ss)" # Driver configuration. multiple_patches="false" -qla2x00t="true" remove_temporary_files_at_end="false" run_local_compilation="true" quiet_download="false" @@ -713,7 +703,7 @@ do fi done export KCFLAGS - subdirs=(drivers/scst) + subdirs=(drivers/scst drivers/scsi/qla2xxx) if [ "${run_sparse}" = "true" ]; then run_sparse "$k" "${subdirs[@]}" mv "${outputdir}/sparse-$k-output.txt" \ @@ -728,9 +718,6 @@ do if [ "${run_smatch}" = "true" ]; then run_smatch "$k" "${subdirs[@]}" fi - if [ "${qla2x00t}" = "true" ] && kernel_version_le 2.6.37 "$k"; then - subdirs+=(drivers/scsi/qla2xxx) - fi compile_kernel "$k" "${subdirs[@]}" if [ "${full_check}" = "true" ]; then run_headers_check "$k" diff --git a/scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.18.patch b/scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.18.patch deleted file mode 100644 index f6ed088..0000000 --- a/scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.18.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -uprN ../orig/linux-2.6.24/drivers/Kconfig linux-2.6.24/drivers/Kconfig ---- ../orig/linux-2.6.24/drivers/Kconfig 2008-01-24 23:58:37.000000000 +0100 -+++ linux-2.6.24/drivers/Kconfig 2008-05-13 13:05:55.000000000 +0200 -@@ -18,6 +18,8 @@ - - source "drivers/scsi/Kconfig" - -+source "drivers/scst/Kconfig" -+ - source "drivers/cdrom/Kconfig" - - source "drivers/md/Kconfig" diff --git a/scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.23.patch b/scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.23.patch deleted file mode 100644 index 27828ce..0000000 --- a/scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.23.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -uprN ../orig/linux-2.6.23/drivers/Kconfig linux-2.6.23/drivers/Kconfig ---- ../orig/linux-2.6.23/drivers/Kconfig 2008-01-24 23:58:37.000000000 +0100 -+++ linux-2.6.23/drivers/Kconfig 2008-05-13 13:05:55.000000000 +0200 -@@ -24,6 +24,8 @@ - - source "drivers/scsi/Kconfig" - -+source "drivers/scst/Kconfig" -+ - source "drivers/ata/Kconfig" - - source "drivers/md/Kconfig" diff --git a/scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.24.patch b/scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.24.patch deleted file mode 100644 index 01aeb90..0000000 --- a/scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.24.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -uprN ../orig/linux-2.6.24/drivers/Kconfig linux-2.6.24/drivers/Kconfig ---- ../orig/linux-2.6.24/drivers/Kconfig 2008-01-24 23:58:37.000000000 +0100 -+++ linux-2.6.24/drivers/Kconfig 2008-05-13 13:05:55.000000000 +0200 -@@ -24,6 +24,8 @@ - - source "drivers/scsi/Kconfig" - -+source "drivers/scst/Kconfig" -+ - source "drivers/ata/Kconfig" - - source "drivers/md/Kconfig" diff --git a/scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.25.patch b/scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.25.patch deleted file mode 100644 index 01aeb90..0000000 --- a/scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.25.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -uprN ../orig/linux-2.6.24/drivers/Kconfig linux-2.6.24/drivers/Kconfig ---- ../orig/linux-2.6.24/drivers/Kconfig 2008-01-24 23:58:37.000000000 +0100 -+++ linux-2.6.24/drivers/Kconfig 2008-05-13 13:05:55.000000000 +0200 -@@ -24,6 +24,8 @@ - - source "drivers/scsi/Kconfig" - -+source "drivers/scst/Kconfig" -+ - source "drivers/ata/Kconfig" - - source "drivers/md/Kconfig" diff --git a/scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.26.patch b/scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.26.patch deleted file mode 100644 index c259d7a..0000000 --- a/scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.26.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -upkr -X linux-2.6.26/Documentation/dontdiff linux-2.6.26/drivers/Kconfig linux-2.6.26/drivers/Kconfig ---- linux-2.6.26/drivers/Kconfig 2008-07-14 01:51:29.000000000 +0400 -+++ linux-2.6.26/drivers/Kconfig 2008-07-24 14:14:46.000000000 +0400 -@@ -24,6 +24,8 @@ source "drivers/ide/Kconfig" - - source "drivers/scsi/Kconfig" - -+source "drivers/scst/Kconfig" -+ - source "drivers/ata/Kconfig" - - source "drivers/md/Kconfig" diff --git a/scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.27.patch b/scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.27.patch deleted file mode 100644 index a4349cd..0000000 --- a/scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.27.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -upkr -X linux-2.6.27/Documentation/dontdiff linux-2.6.27/drivers/Kconfig linux-2.6.27/drivers/Kconfig ---- linux-2.6.27/drivers/Kconfig 2008-07-14 01:51:29.000000000 +0400 -+++ linux-2.6.27/drivers/Kconfig 2008-07-24 14:14:46.000000000 +0400 -@@ -24,6 +24,8 @@ source "drivers/ide/Kconfig" - - source "drivers/scsi/Kconfig" - -+source "drivers/scst/Kconfig" -+ - source "drivers/ata/Kconfig" - - source "drivers/md/Kconfig" diff --git a/scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.28.patch b/scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.28.patch deleted file mode 100644 index b817c63..0000000 --- a/scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.28.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -upkr -X linux-2.6.28/Documentation/dontdiff linux-2.6.28/drivers/Kconfig linux-2.6.28/drivers/Kconfig ---- linux-2.6.28/drivers/Kconfig 2008-07-14 01:51:29.000000000 +0400 -+++ linux-2.6.28/drivers/Kconfig 2008-07-24 14:14:46.000000000 +0400 -@@ -24,6 +24,8 @@ source "drivers/ide/Kconfig" - - source "drivers/scsi/Kconfig" - -+source "drivers/scst/Kconfig" -+ - source "drivers/ata/Kconfig" - - source "drivers/md/Kconfig" diff --git a/scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.29.patch b/scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.29.patch deleted file mode 100644 index 81fc97e..0000000 --- a/scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.29.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -upkr -X linux-2.6.29/Documentation/dontdiff linux-2.6.29/drivers/Kconfig linux-2.6.29/drivers/Kconfig ---- linux-2.6.29/drivers/Kconfig 2008-07-14 01:51:29.000000000 +0400 -+++ linux-2.6.29/drivers/Kconfig 2008-07-24 14:14:46.000000000 +0400 -@@ -24,6 +24,8 @@ source "drivers/ide/Kconfig" - - source "drivers/scsi/Kconfig" - -+source "drivers/scst/Kconfig" -+ - source "drivers/ata/Kconfig" - - source "drivers/md/Kconfig" diff --git a/scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.30.patch b/scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.30.patch deleted file mode 100644 index b6419e2..0000000 --- a/scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.30.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -upkr -X linux-2.6.30/Documentation/dontdiff linux-2.6.30/drivers/Kconfig linux-2.6.30/drivers/Kconfig ---- linux-2.6.30/drivers/Kconfig 2008-07-14 01:51:29.000000000 +0400 -+++ linux-2.6.30/drivers/Kconfig 2008-07-24 14:14:46.000000000 +0400 -@@ -24,6 +24,8 @@ source "drivers/ide/Kconfig" - - source "drivers/scsi/Kconfig" - -+source "drivers/scst/Kconfig" -+ - source "drivers/ata/Kconfig" - - source "drivers/md/Kconfig" diff --git a/scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.31.patch b/scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.31.patch deleted file mode 100644 index b0348e2..0000000 --- a/scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.31.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -upkr -X linux-2.6.31/Documentation/dontdiff linux-2.6.31/drivers/Kconfig linux-2.6.31/drivers/Kconfig ---- linux-2.6.31/drivers/Kconfig 2008-07-14 01:51:29.000000000 +0400 -+++ linux-2.6.31/drivers/Kconfig 2008-07-24 14:14:46.000000000 +0400 -@@ -24,6 +24,8 @@ source "drivers/ide/Kconfig" - - source "drivers/scsi/Kconfig" - -+source "drivers/scst/Kconfig" -+ - source "drivers/ata/Kconfig" - - source "drivers/md/Kconfig" diff --git a/scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.32.patch b/scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.32.patch deleted file mode 100644 index efe1eac..0000000 --- a/scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.32.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -upkr -X linux-2.6.32/Documentation/dontdiff linux-2.6.32/drivers/Kconfig linux-2.6.32/drivers/Kconfig ---- linux-2.6.32/drivers/Kconfig 2008-07-14 01:51:29.000000000 +0400 -+++ linux-2.6.32/drivers/Kconfig 2008-07-24 14:14:46.000000000 +0400 -@@ -24,6 +24,8 @@ source "drivers/ide/Kconfig" - - source "drivers/scsi/Kconfig" - -+source "drivers/scst/Kconfig" -+ - source "drivers/ata/Kconfig" - - source "drivers/md/Kconfig" diff --git a/scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.33.patch b/scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.33.patch deleted file mode 100644 index ea96885..0000000 --- a/scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.33.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -upkr -X linux-2.6.33/Documentation/dontdiff linux-2.6.33/drivers/Kconfig linux-2.6.33/drivers/Kconfig ---- linux-2.6.33/drivers/Kconfig 2008-07-14 01:51:29.000000000 +0400 -+++ linux-2.6.33/drivers/Kconfig 2008-07-24 14:14:46.000000000 +0400 -@@ -24,6 +24,8 @@ source "drivers/ide/Kconfig" - - source "drivers/scsi/Kconfig" - -+source "drivers/scst/Kconfig" -+ - source "drivers/ata/Kconfig" - - source "drivers/md/Kconfig" diff --git a/scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.34.patch b/scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.34.patch deleted file mode 100644 index 2cb16ac..0000000 --- a/scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.34.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -upkr -X linux-2.6.34/Documentation/dontdiff linux-2.6.34/drivers/Kconfig linux-2.6.34/drivers/Kconfig ---- linux-2.6.34/drivers/Kconfig 2008-07-14 01:51:29.000000000 +0400 -+++ linux-2.6.34/drivers/Kconfig 2008-07-24 14:14:46.000000000 +0400 -@@ -22,6 +22,8 @@ source "drivers/ide/Kconfig" - - source "drivers/scsi/Kconfig" - -+source "drivers/scst/Kconfig" -+ - source "drivers/ata/Kconfig" - - source "drivers/md/Kconfig" diff --git a/scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.35.patch b/scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.35.patch deleted file mode 100644 index 774ec23..0000000 --- a/scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.35.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -upkr -X linux-2.6.35/Documentation/dontdiff linux-2.6.35/drivers/Kconfig linux-2.6.35/drivers/Kconfig ---- linux-2.6.35/drivers/Kconfig 2008-07-14 01:51:29.000000000 +0400 -+++ linux-2.6.35/drivers/Kconfig 2008-07-24 14:14:46.000000000 +0400 -@@ -22,6 +22,8 @@ source "drivers/ide/Kconfig" - - source "drivers/scsi/Kconfig" - -+source "drivers/scst/Kconfig" -+ - source "drivers/ata/Kconfig" - - source "drivers/md/Kconfig" diff --git a/scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.36.patch b/scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.36.patch deleted file mode 100644 index 080648e..0000000 --- a/scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.36.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -upkr -X linux-2.6.36/Documentation/dontdiff linux-2.6.36/drivers/Kconfig linux-2.6.36/drivers/Kconfig ---- linux-2.6.36/drivers/Kconfig 2008-07-14 01:51:29.000000000 +0400 -+++ linux-2.6.36/drivers/Kconfig 2008-07-24 14:14:46.000000000 +0400 -@@ -22,6 +22,8 @@ source "drivers/ide/Kconfig" - - source "drivers/scsi/Kconfig" - -+source "drivers/scst/Kconfig" -+ - source "drivers/ata/Kconfig" - - source "drivers/md/Kconfig" diff --git a/scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.7.patch b/scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.7.patch deleted file mode 100644 index 79d02cf..0000000 --- a/scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.7.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- Kconfig 2004-08-18 13:14:50.328907320 +0400 -+++ Kconfig.scsi 2004-08-13 18:01:13.000000000 +0400 -@@ -1261,6 +1261,8 @@ config SCSI_QLOGICPTI - - source "drivers/scsi/qla2xxx/Kconfig" - -+source "drivers/scsi/scsi_tgt/Kconfig" -+ - config SCSI_SEAGATE - tristate "Seagate ST-02 and Future Domain TMC-8xx SCSI support" - depends on X86 && ISA && SCSI && BROKEN diff --git a/scst/kernel/in-tree/Makefile.dev_handlers-2.6.23 b/scst/kernel/in-tree/Makefile.dev_handlers-2.6.23 deleted file mode 100644 index 8c2c62c..0000000 --- a/scst/kernel/in-tree/Makefile.dev_handlers-2.6.23 +++ /dev/null @@ -1,11 +0,0 @@ -ccflags-y += -Iinclude/scst -Wno-unused-parameter - -obj-$(CONFIG_SCST_DISK) += scst_disk.o -obj-$(CONFIG_SCST_TAPE) += scst_tape.o -obj-$(CONFIG_SCST_CDROM) += scst_cdrom.o -obj-$(CONFIG_SCST_MODISK) += scst_modisk.o -obj-$(CONFIG_SCST_CHANGER) += scst_changer.o -obj-$(CONFIG_SCST_RAID) += scst_raid.o -obj-$(CONFIG_SCST_PROCESSOR) += scst_processor.o -obj-$(CONFIG_SCST_VDISK) += scst_vdisk.o -obj-$(CONFIG_SCST_USER) += scst_user.o diff --git a/scst/kernel/in-tree/Makefile.dev_handlers-2.6.24 b/scst/kernel/in-tree/Makefile.dev_handlers-2.6.24 deleted file mode 100644 index 8c2c62c..0000000 --- a/scst/kernel/in-tree/Makefile.dev_handlers-2.6.24 +++ /dev/null @@ -1,11 +0,0 @@ -ccflags-y += -Iinclude/scst -Wno-unused-parameter - -obj-$(CONFIG_SCST_DISK) += scst_disk.o -obj-$(CONFIG_SCST_TAPE) += scst_tape.o -obj-$(CONFIG_SCST_CDROM) += scst_cdrom.o -obj-$(CONFIG_SCST_MODISK) += scst_modisk.o -obj-$(CONFIG_SCST_CHANGER) += scst_changer.o -obj-$(CONFIG_SCST_RAID) += scst_raid.o -obj-$(CONFIG_SCST_PROCESSOR) += scst_processor.o -obj-$(CONFIG_SCST_VDISK) += scst_vdisk.o -obj-$(CONFIG_SCST_USER) += scst_user.o diff --git a/scst/kernel/in-tree/Makefile.dev_handlers-2.6.25 b/scst/kernel/in-tree/Makefile.dev_handlers-2.6.25 deleted file mode 100644 index 8c2c62c..0000000 --- a/scst/kernel/in-tree/Makefile.dev_handlers-2.6.25 +++ /dev/null @@ -1,11 +0,0 @@ -ccflags-y += -Iinclude/scst -Wno-unused-parameter - -obj-$(CONFIG_SCST_DISK) += scst_disk.o -obj-$(CONFIG_SCST_TAPE) += scst_tape.o -obj-$(CONFIG_SCST_CDROM) += scst_cdrom.o -obj-$(CONFIG_SCST_MODISK) += scst_modisk.o -obj-$(CONFIG_SCST_CHANGER) += scst_changer.o -obj-$(CONFIG_SCST_RAID) += scst_raid.o -obj-$(CONFIG_SCST_PROCESSOR) += scst_processor.o -obj-$(CONFIG_SCST_VDISK) += scst_vdisk.o -obj-$(CONFIG_SCST_USER) += scst_user.o diff --git a/scst/kernel/in-tree/Makefile.dev_handlers-2.6.26 b/scst/kernel/in-tree/Makefile.dev_handlers-2.6.26 deleted file mode 100644 index 8c2c62c..0000000 --- a/scst/kernel/in-tree/Makefile.dev_handlers-2.6.26 +++ /dev/null @@ -1,11 +0,0 @@ -ccflags-y += -Iinclude/scst -Wno-unused-parameter - -obj-$(CONFIG_SCST_DISK) += scst_disk.o -obj-$(CONFIG_SCST_TAPE) += scst_tape.o -obj-$(CONFIG_SCST_CDROM) += scst_cdrom.o -obj-$(CONFIG_SCST_MODISK) += scst_modisk.o -obj-$(CONFIG_SCST_CHANGER) += scst_changer.o -obj-$(CONFIG_SCST_RAID) += scst_raid.o -obj-$(CONFIG_SCST_PROCESSOR) += scst_processor.o -obj-$(CONFIG_SCST_VDISK) += scst_vdisk.o -obj-$(CONFIG_SCST_USER) += scst_user.o diff --git a/scst/kernel/in-tree/Makefile.dev_handlers-2.6.27 b/scst/kernel/in-tree/Makefile.dev_handlers-2.6.27 deleted file mode 100644 index 8c2c62c..0000000 --- a/scst/kernel/in-tree/Makefile.dev_handlers-2.6.27 +++ /dev/null @@ -1,11 +0,0 @@ -ccflags-y += -Iinclude/scst -Wno-unused-parameter - -obj-$(CONFIG_SCST_DISK) += scst_disk.o -obj-$(CONFIG_SCST_TAPE) += scst_tape.o -obj-$(CONFIG_SCST_CDROM) += scst_cdrom.o -obj-$(CONFIG_SCST_MODISK) += scst_modisk.o -obj-$(CONFIG_SCST_CHANGER) += scst_changer.o -obj-$(CONFIG_SCST_RAID) += scst_raid.o -obj-$(CONFIG_SCST_PROCESSOR) += scst_processor.o -obj-$(CONFIG_SCST_VDISK) += scst_vdisk.o -obj-$(CONFIG_SCST_USER) += scst_user.o diff --git a/scst/kernel/in-tree/Makefile.dev_handlers-2.6.28 b/scst/kernel/in-tree/Makefile.dev_handlers-2.6.28 deleted file mode 100644 index 8c2c62c..0000000 --- a/scst/kernel/in-tree/Makefile.dev_handlers-2.6.28 +++ /dev/null @@ -1,11 +0,0 @@ -ccflags-y += -Iinclude/scst -Wno-unused-parameter - -obj-$(CONFIG_SCST_DISK) += scst_disk.o -obj-$(CONFIG_SCST_TAPE) += scst_tape.o -obj-$(CONFIG_SCST_CDROM) += scst_cdrom.o -obj-$(CONFIG_SCST_MODISK) += scst_modisk.o -obj-$(CONFIG_SCST_CHANGER) += scst_changer.o -obj-$(CONFIG_SCST_RAID) += scst_raid.o -obj-$(CONFIG_SCST_PROCESSOR) += scst_processor.o -obj-$(CONFIG_SCST_VDISK) += scst_vdisk.o -obj-$(CONFIG_SCST_USER) += scst_user.o diff --git a/scst/kernel/in-tree/Makefile.dev_handlers-2.6.29 b/scst/kernel/in-tree/Makefile.dev_handlers-2.6.29 deleted file mode 100644 index 8c2c62c..0000000 --- a/scst/kernel/in-tree/Makefile.dev_handlers-2.6.29 +++ /dev/null @@ -1,11 +0,0 @@ -ccflags-y += -Iinclude/scst -Wno-unused-parameter - -obj-$(CONFIG_SCST_DISK) += scst_disk.o -obj-$(CONFIG_SCST_TAPE) += scst_tape.o -obj-$(CONFIG_SCST_CDROM) += scst_cdrom.o -obj-$(CONFIG_SCST_MODISK) += scst_modisk.o -obj-$(CONFIG_SCST_CHANGER) += scst_changer.o -obj-$(CONFIG_SCST_RAID) += scst_raid.o -obj-$(CONFIG_SCST_PROCESSOR) += scst_processor.o -obj-$(CONFIG_SCST_VDISK) += scst_vdisk.o -obj-$(CONFIG_SCST_USER) += scst_user.o diff --git a/scst/kernel/in-tree/Makefile.dev_handlers-2.6.30 b/scst/kernel/in-tree/Makefile.dev_handlers-2.6.30 deleted file mode 100644 index 8c2c62c..0000000 --- a/scst/kernel/in-tree/Makefile.dev_handlers-2.6.30 +++ /dev/null @@ -1,11 +0,0 @@ -ccflags-y += -Iinclude/scst -Wno-unused-parameter - -obj-$(CONFIG_SCST_DISK) += scst_disk.o -obj-$(CONFIG_SCST_TAPE) += scst_tape.o -obj-$(CONFIG_SCST_CDROM) += scst_cdrom.o -obj-$(CONFIG_SCST_MODISK) += scst_modisk.o -obj-$(CONFIG_SCST_CHANGER) += scst_changer.o -obj-$(CONFIG_SCST_RAID) += scst_raid.o -obj-$(CONFIG_SCST_PROCESSOR) += scst_processor.o -obj-$(CONFIG_SCST_VDISK) += scst_vdisk.o -obj-$(CONFIG_SCST_USER) += scst_user.o diff --git a/scst/kernel/in-tree/Makefile.dev_handlers-2.6.31 b/scst/kernel/in-tree/Makefile.dev_handlers-2.6.31 deleted file mode 100644 index 8c2c62c..0000000 --- a/scst/kernel/in-tree/Makefile.dev_handlers-2.6.31 +++ /dev/null @@ -1,11 +0,0 @@ -ccflags-y += -Iinclude/scst -Wno-unused-parameter - -obj-$(CONFIG_SCST_DISK) += scst_disk.o -obj-$(CONFIG_SCST_TAPE) += scst_tape.o -obj-$(CONFIG_SCST_CDROM) += scst_cdrom.o -obj-$(CONFIG_SCST_MODISK) += scst_modisk.o -obj-$(CONFIG_SCST_CHANGER) += scst_changer.o -obj-$(CONFIG_SCST_RAID) += scst_raid.o -obj-$(CONFIG_SCST_PROCESSOR) += scst_processor.o -obj-$(CONFIG_SCST_VDISK) += scst_vdisk.o -obj-$(CONFIG_SCST_USER) += scst_user.o diff --git a/scst/kernel/in-tree/Makefile.dev_handlers-2.6.32 b/scst/kernel/in-tree/Makefile.dev_handlers-2.6.32 deleted file mode 100644 index 8c2c62c..0000000 --- a/scst/kernel/in-tree/Makefile.dev_handlers-2.6.32 +++ /dev/null @@ -1,11 +0,0 @@ -ccflags-y += -Iinclude/scst -Wno-unused-parameter - -obj-$(CONFIG_SCST_DISK) += scst_disk.o -obj-$(CONFIG_SCST_TAPE) += scst_tape.o -obj-$(CONFIG_SCST_CDROM) += scst_cdrom.o -obj-$(CONFIG_SCST_MODISK) += scst_modisk.o -obj-$(CONFIG_SCST_CHANGER) += scst_changer.o -obj-$(CONFIG_SCST_RAID) += scst_raid.o -obj-$(CONFIG_SCST_PROCESSOR) += scst_processor.o -obj-$(CONFIG_SCST_VDISK) += scst_vdisk.o -obj-$(CONFIG_SCST_USER) += scst_user.o diff --git a/scst/kernel/in-tree/Makefile.dev_handlers-2.6.33 b/scst/kernel/in-tree/Makefile.dev_handlers-2.6.33 deleted file mode 100644 index 8c2c62c..0000000 --- a/scst/kernel/in-tree/Makefile.dev_handlers-2.6.33 +++ /dev/null @@ -1,11 +0,0 @@ -ccflags-y += -Iinclude/scst -Wno-unused-parameter - -obj-$(CONFIG_SCST_DISK) += scst_disk.o -obj-$(CONFIG_SCST_TAPE) += scst_tape.o -obj-$(CONFIG_SCST_CDROM) += scst_cdrom.o -obj-$(CONFIG_SCST_MODISK) += scst_modisk.o -obj-$(CONFIG_SCST_CHANGER) += scst_changer.o -obj-$(CONFIG_SCST_RAID) += scst_raid.o -obj-$(CONFIG_SCST_PROCESSOR) += scst_processor.o -obj-$(CONFIG_SCST_VDISK) += scst_vdisk.o -obj-$(CONFIG_SCST_USER) += scst_user.o diff --git a/scst/kernel/in-tree/Makefile.dev_handlers-2.6.34 b/scst/kernel/in-tree/Makefile.dev_handlers-2.6.34 deleted file mode 100644 index 8c2c62c..0000000 --- a/scst/kernel/in-tree/Makefile.dev_handlers-2.6.34 +++ /dev/null @@ -1,11 +0,0 @@ -ccflags-y += -Iinclude/scst -Wno-unused-parameter - -obj-$(CONFIG_SCST_DISK) += scst_disk.o -obj-$(CONFIG_SCST_TAPE) += scst_tape.o -obj-$(CONFIG_SCST_CDROM) += scst_cdrom.o -obj-$(CONFIG_SCST_MODISK) += scst_modisk.o -obj-$(CONFIG_SCST_CHANGER) += scst_changer.o -obj-$(CONFIG_SCST_RAID) += scst_raid.o -obj-$(CONFIG_SCST_PROCESSOR) += scst_processor.o -obj-$(CONFIG_SCST_VDISK) += scst_vdisk.o -obj-$(CONFIG_SCST_USER) += scst_user.o diff --git a/scst/kernel/in-tree/Makefile.drivers.Linux-2.6.15.patch b/scst/kernel/in-tree/Makefile.drivers.Linux-2.6.15.patch deleted file mode 100644 index ac3027f..0000000 --- a/scst/kernel/in-tree/Makefile.drivers.Linux-2.6.15.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- Makefile.orig 2006-12-11 14:29:39.000000000 -0700 -+++ Makefile 2006-12-11 14:29:52.000000000 -0700 -@@ -81,6 +81,7 @@ - obj-$(CONFIG_SCSI_QLOGIC_FC) += qlogicfc.o - obj-$(CONFIG_SCSI_QLOGIC_1280) += qla1280.o - obj-$(CONFIG_SCSI_QLA2XXX) += qla2xxx/ -+obj-$(CONFIG_SCST) += scsi_tgt/ - obj-$(CONFIG_SCSI_LPFC) += lpfc/ - obj-$(CONFIG_SCSI_PAS16) += pas16.o - obj-$(CONFIG_SCSI_SEAGATE) += seagate.o diff --git a/scst/kernel/in-tree/Makefile.drivers.Linux-2.6.18.patch b/scst/kernel/in-tree/Makefile.drivers.Linux-2.6.18.patch deleted file mode 100644 index 12015a9..0000000 --- a/scst/kernel/in-tree/Makefile.drivers.Linux-2.6.18.patch +++ /dev/null @@ -1,11 +0,0 @@ -diff -uprN ../orig/linux-2.6.24/drivers/Makefile linux-2.6.24/drivers/Makefile ---- ../orig/linux-2.6.24/drivers/Makefile 2008-01-24 23:58:37.000000000 +0100 -+++ linux-2.6.24/drivers/Makefile 2008-05-13 13:06:34.000000000 +0200 -@@ -34,6 +34,7 @@ - obj-$(CONFIG_IDE) += ide/ - obj-$(CONFIG_FC4) += fc4/ - obj-$(CONFIG_SCSI) += scsi/ -+obj-$(CONFIG_SCST) += scst/ - obj-$(CONFIG_FUSION) += message/ - obj-$(CONFIG_IEEE1394) += ieee1394/ - obj-y += cdrom/ diff --git a/scst/kernel/in-tree/Makefile.drivers.Linux-2.6.23.patch b/scst/kernel/in-tree/Makefile.drivers.Linux-2.6.23.patch deleted file mode 100644 index 4d89fd8..0000000 --- a/scst/kernel/in-tree/Makefile.drivers.Linux-2.6.23.patch +++ /dev/null @@ -1,11 +0,0 @@ -diff -uprN ../orig/linux-2.6.23/drivers/Makefile linux-2.6.23/drivers/Makefile ---- ../orig/linux-2.6.23/drivers/Makefile 2008-01-24 23:58:37.000000000 +0100 -+++ linux-2.6.23/drivers/Makefile 2008-05-13 13:06:34.000000000 +0200 -@@ -35,6 +35,7 @@ - obj-y += macintosh/ - obj-$(CONFIG_IDE) += ide/ - obj-$(CONFIG_SCSI) += scsi/ -+obj-$(CONFIG_SCST) += scst/ - obj-$(CONFIG_ATA) += ata/ - obj-$(CONFIG_FUSION) += message/ - obj-$(CONFIG_FIREWIRE) += firewire/ diff --git a/scst/kernel/in-tree/Makefile.drivers.Linux-2.6.24.patch b/scst/kernel/in-tree/Makefile.drivers.Linux-2.6.24.patch deleted file mode 100644 index e4daf75..0000000 --- a/scst/kernel/in-tree/Makefile.drivers.Linux-2.6.24.patch +++ /dev/null @@ -1,11 +0,0 @@ -diff -uprN ../orig/linux-2.6.24/drivers/Makefile linux-2.6.24/drivers/Makefile ---- ../orig/linux-2.6.24/drivers/Makefile 2008-01-24 23:58:37.000000000 +0100 -+++ linux-2.6.24/drivers/Makefile 2008-05-13 13:06:34.000000000 +0200 -@@ -35,6 +35,7 @@ - obj-y += macintosh/ - obj-$(CONFIG_IDE) += ide/ - obj-$(CONFIG_SCSI) += scsi/ -+obj-$(CONFIG_SCST) += scst/ - obj-$(CONFIG_ATA) += ata/ - obj-$(CONFIG_FUSION) += message/ - obj-$(CONFIG_FIREWIRE) += firewire/ diff --git a/scst/kernel/in-tree/Makefile.drivers.Linux-2.6.25.patch b/scst/kernel/in-tree/Makefile.drivers.Linux-2.6.25.patch deleted file mode 100644 index d5fc9a7..0000000 --- a/scst/kernel/in-tree/Makefile.drivers.Linux-2.6.25.patch +++ /dev/null @@ -1,11 +0,0 @@ -diff -uprN ../orig/linux-2.6.24/drivers/Makefile linux-2.6.24/drivers/Makefile ---- ../orig/linux-2.6.24/drivers/Makefile 2008-01-24 23:58:37.000000000 +0100 -+++ linux-2.6.24/drivers/Makefile 2008-05-13 13:06:34.000000000 +0200 -@@ -36,6 +36,7 @@ - obj-y += macintosh/ - obj-$(CONFIG_IDE) += ide/ - obj-$(CONFIG_SCSI) += scsi/ -+obj-$(CONFIG_SCST) += scst/ - obj-$(CONFIG_ATA) += ata/ - obj-$(CONFIG_FUSION) += message/ - obj-$(CONFIG_FIREWIRE) += firewire/ diff --git a/scst/kernel/in-tree/Makefile.drivers.Linux-2.6.26.patch b/scst/kernel/in-tree/Makefile.drivers.Linux-2.6.26.patch deleted file mode 100644 index 1f26ba3..0000000 --- a/scst/kernel/in-tree/Makefile.drivers.Linux-2.6.26.patch +++ /dev/null @@ -1,11 +0,0 @@ -diff -upkr -X linux-2.6.26/Documentation/dontdiff linux-2.6.26/drivers/Makefile linux-2.6.26/drivers/Makefile ---- linux-2.6.26/drivers/Makefile 2008-07-14 01:51:29.000000000 +0400 -+++ linux-2.6.26/drivers/Makefile 2008-07-24 14:15:29.000000000 +0400 -@@ -36,6 +36,7 @@ obj-$(CONFIG_ATM) += atm/ - obj-y += macintosh/ - obj-$(CONFIG_IDE) += ide/ - obj-$(CONFIG_SCSI) += scsi/ -+obj-$(CONFIG_SCST) += scst/ - obj-$(CONFIG_ATA) += ata/ - obj-$(CONFIG_FUSION) += message/ - obj-$(CONFIG_FIREWIRE) += firewire/ diff --git a/scst/kernel/in-tree/Makefile.drivers.Linux-2.6.27.patch b/scst/kernel/in-tree/Makefile.drivers.Linux-2.6.27.patch deleted file mode 100644 index da3e450..0000000 --- a/scst/kernel/in-tree/Makefile.drivers.Linux-2.6.27.patch +++ /dev/null @@ -1,11 +0,0 @@ -diff -upkr -X linux-2.6.27/Documentation/dontdiff linux-2.6.27/drivers/Makefile linux-2.6.27/drivers/Makefile ---- linux-2.6.27/drivers/Makefile 2008-07-14 01:51:29.000000000 +0400 -+++ linux-2.6.27/drivers/Makefile 2008-07-24 14:15:29.000000000 +0400 -@@ -39,6 +39,7 @@ obj-$(CONFIG_ATM) += atm/ - obj-y += macintosh/ - obj-$(CONFIG_IDE) += ide/ - obj-$(CONFIG_SCSI) += scsi/ -+obj-$(CONFIG_SCST) += scst/ - obj-$(CONFIG_ATA) += ata/ - obj-$(CONFIG_FUSION) += message/ - obj-$(CONFIG_FIREWIRE) += firewire/ diff --git a/scst/kernel/in-tree/Makefile.drivers.Linux-2.6.28.patch b/scst/kernel/in-tree/Makefile.drivers.Linux-2.6.28.patch deleted file mode 100644 index 000ee24..0000000 --- a/scst/kernel/in-tree/Makefile.drivers.Linux-2.6.28.patch +++ /dev/null @@ -1,11 +0,0 @@ -diff -upkr -X linux-2.6.28/Documentation/dontdiff linux-2.6.28/drivers/Makefile linux-2.6.28/drivers/Makefile ---- linux-2.6.28/drivers/Makefile 2008-07-14 01:51:29.000000000 +0400 -+++ linux-2.6.28/drivers/Makefile 2008-07-24 14:15:29.000000000 +0400 -@@ -39,6 +39,7 @@ obj-$(CONFIG_ATM) += atm/ - obj-y += macintosh/ - obj-$(CONFIG_IDE) += ide/ - obj-$(CONFIG_SCSI) += scsi/ -+obj-$(CONFIG_SCST) += scst/ - obj-$(CONFIG_ATA) += ata/ - obj-$(CONFIG_FUSION) += message/ - obj-$(CONFIG_FIREWIRE) += firewire/ diff --git a/scst/kernel/in-tree/Makefile.drivers.Linux-2.6.29.patch b/scst/kernel/in-tree/Makefile.drivers.Linux-2.6.29.patch deleted file mode 100644 index eb2defe..0000000 --- a/scst/kernel/in-tree/Makefile.drivers.Linux-2.6.29.patch +++ /dev/null @@ -1,11 +0,0 @@ -diff -upkr -X linux-2.6.29/Documentation/dontdiff linux-2.6.29/drivers/Makefile linux-2.6.29/drivers/Makefile ---- linux-2.6.29/drivers/Makefile 2008-07-14 01:51:29.000000000 +0400 -+++ linux-2.6.29/drivers/Makefile 2008-07-24 14:15:29.000000000 +0400 -@@ -42,6 +42,7 @@ obj-$(CONFIG_ATM) += atm/ - obj-y += macintosh/ - obj-$(CONFIG_IDE) += ide/ - obj-$(CONFIG_SCSI) += scsi/ -+obj-$(CONFIG_SCST) += scst/ - obj-$(CONFIG_ATA) += ata/ - obj-$(CONFIG_FUSION) += message/ - obj-$(CONFIG_FIREWIRE) += firewire/ diff --git a/scst/kernel/in-tree/Makefile.drivers.Linux-2.6.30.patch b/scst/kernel/in-tree/Makefile.drivers.Linux-2.6.30.patch deleted file mode 100644 index b26ddd2..0000000 --- a/scst/kernel/in-tree/Makefile.drivers.Linux-2.6.30.patch +++ /dev/null @@ -1,11 +0,0 @@ -diff -upkr -X linux-2.6.30/Documentation/dontdiff linux-2.6.30/drivers/Makefile linux-2.6.30/drivers/Makefile ---- linux-2.6.30/drivers/Makefile 2008-07-14 01:51:29.000000000 +0400 -+++ linux-2.6.30/drivers/Makefile 2008-07-24 14:15:29.000000000 +0400 -@@ -41,6 +41,7 @@ obj-$(CONFIG_ATM) += atm/ - obj-y += macintosh/ - obj-$(CONFIG_IDE) += ide/ - obj-$(CONFIG_SCSI) += scsi/ -+obj-$(CONFIG_SCST) += scst/ - obj-$(CONFIG_ATA) += ata/ - obj-y += net/ - obj-$(CONFIG_ATM) += atm/ diff --git a/scst/kernel/in-tree/Makefile.drivers.Linux-2.6.31.patch b/scst/kernel/in-tree/Makefile.drivers.Linux-2.6.31.patch deleted file mode 100644 index 09da54d..0000000 --- a/scst/kernel/in-tree/Makefile.drivers.Linux-2.6.31.patch +++ /dev/null @@ -1,11 +0,0 @@ -diff -upkr -X linux-2.6.31/Documentation/dontdiff linux-2.6.31/drivers/Makefile linux-2.6.31/drivers/Makefile ---- linux-2.6.31/drivers/Makefile 2008-07-14 01:51:29.000000000 +0400 -+++ linux-2.6.31/drivers/Makefile 2008-07-24 14:15:29.000000000 +0400 -@@ -41,6 +41,7 @@ obj-$(CONFIG_ATM) += atm/ - obj-y += macintosh/ - obj-$(CONFIG_IDE) += ide/ - obj-$(CONFIG_SCSI) += scsi/ -+obj-$(CONFIG_SCST) += scst/ - obj-$(CONFIG_ATA) += ata/ - obj-y += net/ - obj-$(CONFIG_ATM) += atm/ diff --git a/scst/kernel/in-tree/Makefile.drivers.Linux-2.6.32.patch b/scst/kernel/in-tree/Makefile.drivers.Linux-2.6.32.patch deleted file mode 100644 index 29f7ac2..0000000 --- a/scst/kernel/in-tree/Makefile.drivers.Linux-2.6.32.patch +++ /dev/null @@ -1,11 +0,0 @@ -diff -upkr -X linux-2.6.32/Documentation/dontdiff linux-2.6.32/drivers/Makefile linux-2.6.32/drivers/Makefile ---- linux-2.6.32/drivers/Makefile 2008-07-14 01:51:29.000000000 +0400 -+++ linux-2.6.32/drivers/Makefile 2008-07-24 14:15:29.000000000 +0400 -@@ -41,6 +41,7 @@ obj-$(CONFIG_ATM) += atm/ - obj-y += macintosh/ - obj-$(CONFIG_IDE) += ide/ - obj-$(CONFIG_SCSI) += scsi/ -+obj-$(CONFIG_SCST) += scst/ - obj-$(CONFIG_ATA) += ata/ - obj-y += net/ - obj-$(CONFIG_ATM) += atm/ diff --git a/scst/kernel/in-tree/Makefile.drivers.Linux-2.6.33.patch b/scst/kernel/in-tree/Makefile.drivers.Linux-2.6.33.patch deleted file mode 100644 index 1b37f4a..0000000 --- a/scst/kernel/in-tree/Makefile.drivers.Linux-2.6.33.patch +++ /dev/null @@ -1,11 +0,0 @@ -diff -upkr -X linux-2.6.33/Documentation/dontdiff linux-2.6.33/drivers/Makefile linux-2.6.33/drivers/Makefile ---- linux-2.6.33/drivers/Makefile 2008-07-14 01:51:29.000000000 +0400 -+++ linux-2.6.33/drivers/Makefile 2008-07-24 14:15:29.000000000 +0400 -@@ -41,6 +41,7 @@ obj-$(CONFIG_ATM) += atm/ - obj-y += macintosh/ - obj-$(CONFIG_IDE) += ide/ - obj-$(CONFIG_SCSI) += scsi/ -+obj-$(CONFIG_SCST) += scst/ - obj-$(CONFIG_ATA) += ata/ - obj-y += net/ - obj-$(CONFIG_ATM) += atm/ diff --git a/scst/kernel/in-tree/Makefile.drivers.Linux-2.6.34.patch b/scst/kernel/in-tree/Makefile.drivers.Linux-2.6.34.patch deleted file mode 100644 index 060a735..0000000 --- a/scst/kernel/in-tree/Makefile.drivers.Linux-2.6.34.patch +++ /dev/null @@ -1,11 +0,0 @@ -diff -upkr -X linux-2.6.34/Documentation/dontdiff linux-2.6.34/drivers/Makefile linux-2.6.34/drivers/Makefile ---- linux-2.6.34/drivers/Makefile 2008-07-14 01:51:29.000000000 +0400 -+++ linux-2.6.34/drivers/Makefile 2008-07-24 14:15:29.000000000 +0400 -@@ -43,6 +43,7 @@ obj-$(CONFIG_ATM) += atm/ - obj-y += macintosh/ - obj-$(CONFIG_IDE) += ide/ - obj-$(CONFIG_SCSI) += scsi/ -+obj-$(CONFIG_SCST) += scst/ - obj-$(CONFIG_ATA) += ata/ - obj-y += net/ - obj-$(CONFIG_ATM) += atm/ diff --git a/scst/kernel/in-tree/Makefile.drivers.Linux-2.6.35.patch b/scst/kernel/in-tree/Makefile.drivers.Linux-2.6.35.patch deleted file mode 100644 index f063f7e..0000000 --- a/scst/kernel/in-tree/Makefile.drivers.Linux-2.6.35.patch +++ /dev/null @@ -1,8 +0,0 @@ -diff -upkr -X linux-2.6.35/Documentation/dontdiff linux-2.6.35/drivers/Makefile linux-2.6.35/drivers/Makefile ---- linux-2.6.35/drivers/Makefile.orig 2010-10-16 15:40:04.000000000 +0200 -+++ linux-2.6.35/drivers/Makefile 2010-10-16 15:40:20.000000000 +0200 -@@ -113,3 +113,4 @@ obj-$(CONFIG_VLYNQ) += vlynq/ - obj-$(CONFIG_STAGING) += staging/ - obj-y += platform/ - obj-y += ieee802154/ -+obj-$(CONFIG_SCST) += scst/ diff --git a/scst/kernel/in-tree/Makefile.drivers.Linux-2.6.36.patch b/scst/kernel/in-tree/Makefile.drivers.Linux-2.6.36.patch deleted file mode 100644 index c0e5b6a..0000000 --- a/scst/kernel/in-tree/Makefile.drivers.Linux-2.6.36.patch +++ /dev/null @@ -1,8 +0,0 @@ -diff -upkr -X linux-2.6.36/Documentation/dontdiff linux-2.6.36/drivers/Makefile linux-2.6.36/drivers/Makefile ---- linux-2.6.36/drivers/Makefile.orig 2010-10-16 15:40:04.000000000 +0200 -+++ linux-2.6.36/drivers/Makefile 2010-10-16 15:40:20.000000000 +0200 -@@ -113,3 +113,4 @@ obj-$(CONFIG_VLYNQ) += vlynq/ - obj-$(CONFIG_STAGING) += staging/ - obj-y += platform/ - obj-y += ieee802154/ -+obj-$(CONFIG_SCST) += scst/ diff --git a/scst/kernel/in-tree/Makefile.drivers.Linux-2.6.37.patch b/scst/kernel/in-tree/Makefile.drivers.Linux-2.6.37.patch deleted file mode 100644 index b416623..0000000 --- a/scst/kernel/in-tree/Makefile.drivers.Linux-2.6.37.patch +++ /dev/null @@ -1,9 +0,0 @@ -diff --git a/drivers/Makefile b/drivers/Makefile -index f3ebb30..a9b3c06 100644 ---- a/drivers/Makefile -+++ b/drivers/Makefile -@@ -115,3 +115,4 @@ obj-$(CONFIG_VLYNQ) += vlynq/ - obj-$(CONFIG_STAGING) += staging/ - obj-y += platform/ - obj-y += ieee802154/ -+obj-$(CONFIG_SCST) += scst/ diff --git a/scst/kernel/in-tree/Makefile.drivers.Linux-2.6.38.patch b/scst/kernel/in-tree/Makefile.drivers.Linux-2.6.38.patch deleted file mode 100644 index c51f861..0000000 --- a/scst/kernel/in-tree/Makefile.drivers.Linux-2.6.38.patch +++ /dev/null @@ -1,11 +0,0 @@ -diff --git a/drivers/Makefile b/drivers/Makefile -index b423bb1..f780114 100644 ---- a/drivers/Makefile -+++ b/drivers/Makefile -@@ -115,5 +115,6 @@ obj-$(CONFIG_VLYNQ) += vlynq/ - obj-$(CONFIG_STAGING) += staging/ - obj-y += platform/ - obj-y += ieee802154/ -+obj-$(CONFIG_SCST) += scst/ - #common clk code - obj-y += clk/ diff --git a/scst/kernel/in-tree/Makefile.drivers.Linux-2.6.39.patch b/scst/kernel/in-tree/Makefile.drivers.Linux-2.6.39.patch deleted file mode 100644 index c51f861..0000000 --- a/scst/kernel/in-tree/Makefile.drivers.Linux-2.6.39.patch +++ /dev/null @@ -1,11 +0,0 @@ -diff --git a/drivers/Makefile b/drivers/Makefile -index b423bb1..f780114 100644 ---- a/drivers/Makefile -+++ b/drivers/Makefile -@@ -115,5 +115,6 @@ obj-$(CONFIG_VLYNQ) += vlynq/ - obj-$(CONFIG_STAGING) += staging/ - obj-y += platform/ - obj-y += ieee802154/ -+obj-$(CONFIG_SCST) += scst/ - #common clk code - obj-y += clk/ diff --git a/scst/kernel/in-tree/Makefile.drivers.Linux-2.6.7.patch b/scst/kernel/in-tree/Makefile.drivers.Linux-2.6.7.patch deleted file mode 100644 index b9b7192..0000000 --- a/scst/kernel/in-tree/Makefile.drivers.Linux-2.6.7.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- Makefile 2004-08-18 13:20:55.434402848 +0400 -+++ Makefile.scsi 2004-08-13 18:01:13.000000000 +0400 -@@ -81,6 +81,7 @@ obj-$(CONFIG_SCSI_QLOGIC_ISP) += qlogici - obj-$(CONFIG_SCSI_QLOGIC_FC) += qlogicfc.o - obj-$(CONFIG_SCSI_QLOGIC_1280) += qla1280.o - obj-$(CONFIG_SCSI_QLA2XXX) += qla2xxx/ -+obj-$(CONFIG_SCST) += scsi_tgt/ - obj-$(CONFIG_SCSI_PAS16) += pas16.o - obj-$(CONFIG_SCSI_SEAGATE) += seagate.o - obj-$(CONFIG_SCSI_FD_8xx) += seagate.o diff --git a/scst/kernel/in-tree/Makefile.drivers.Linux-3.0.patch b/scst/kernel/in-tree/Makefile.drivers.Linux-3.0.patch deleted file mode 100644 index c51f861..0000000 --- a/scst/kernel/in-tree/Makefile.drivers.Linux-3.0.patch +++ /dev/null @@ -1,11 +0,0 @@ -diff --git a/drivers/Makefile b/drivers/Makefile -index b423bb1..f780114 100644 ---- a/drivers/Makefile -+++ b/drivers/Makefile -@@ -115,5 +115,6 @@ obj-$(CONFIG_VLYNQ) += vlynq/ - obj-$(CONFIG_STAGING) += staging/ - obj-y += platform/ - obj-y += ieee802154/ -+obj-$(CONFIG_SCST) += scst/ - #common clk code - obj-y += clk/ diff --git a/scst/kernel/in-tree/Makefile.drivers.Linux-3.1.patch b/scst/kernel/in-tree/Makefile.drivers.Linux-3.1.patch deleted file mode 100644 index c51f861..0000000 --- a/scst/kernel/in-tree/Makefile.drivers.Linux-3.1.patch +++ /dev/null @@ -1,11 +0,0 @@ -diff --git a/drivers/Makefile b/drivers/Makefile -index b423bb1..f780114 100644 ---- a/drivers/Makefile -+++ b/drivers/Makefile -@@ -115,5 +115,6 @@ obj-$(CONFIG_VLYNQ) += vlynq/ - obj-$(CONFIG_STAGING) += staging/ - obj-y += platform/ - obj-y += ieee802154/ -+obj-$(CONFIG_SCST) += scst/ - #common clk code - obj-y += clk/ diff --git a/scst/kernel/in-tree/Makefile.drivers.Linux-3.2.patch b/scst/kernel/in-tree/Makefile.drivers.Linux-3.2.patch deleted file mode 100644 index c51f861..0000000 --- a/scst/kernel/in-tree/Makefile.drivers.Linux-3.2.patch +++ /dev/null @@ -1,11 +0,0 @@ -diff --git a/drivers/Makefile b/drivers/Makefile -index b423bb1..f780114 100644 ---- a/drivers/Makefile -+++ b/drivers/Makefile -@@ -115,5 +115,6 @@ obj-$(CONFIG_VLYNQ) += vlynq/ - obj-$(CONFIG_STAGING) += staging/ - obj-y += platform/ - obj-y += ieee802154/ -+obj-$(CONFIG_SCST) += scst/ - #common clk code - obj-y += clk/ diff --git a/scst/kernel/in-tree/Makefile.drivers.Linux-3.3.patch b/scst/kernel/in-tree/Makefile.drivers.Linux-3.3.patch deleted file mode 100644 index 479746f..0000000 --- a/scst/kernel/in-tree/Makefile.drivers.Linux-3.3.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/drivers/Makefile b/drivers/Makefile -index c07be02..615d036 100644 ---- a/drivers/Makefile -+++ b/drivers/Makefile -@@ -120,6 +120,7 @@ obj-$(CONFIG_VLYNQ) += vlynq/ - obj-$(CONFIG_STAGING) += staging/ - obj-y += platform/ - obj-y += ieee802154/ -+obj-$(CONFIG_SCST) += scst/ - #common clk code - obj-y += clk/ - diff --git a/scst/kernel/in-tree/Makefile.drivers.Linux-3.4.patch b/scst/kernel/in-tree/Makefile.drivers.Linux-3.4.patch deleted file mode 100644 index 479746f..0000000 --- a/scst/kernel/in-tree/Makefile.drivers.Linux-3.4.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/drivers/Makefile b/drivers/Makefile -index c07be02..615d036 100644 ---- a/drivers/Makefile -+++ b/drivers/Makefile -@@ -120,6 +120,7 @@ obj-$(CONFIG_VLYNQ) += vlynq/ - obj-$(CONFIG_STAGING) += staging/ - obj-y += platform/ - obj-y += ieee802154/ -+obj-$(CONFIG_SCST) += scst/ - #common clk code - obj-y += clk/ - diff --git a/scst/kernel/in-tree/Makefile.drivers.Linux-3.5.patch b/scst/kernel/in-tree/Makefile.drivers.Linux-3.5.patch deleted file mode 100644 index 479746f..0000000 --- a/scst/kernel/in-tree/Makefile.drivers.Linux-3.5.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/drivers/Makefile b/drivers/Makefile -index c07be02..615d036 100644 ---- a/drivers/Makefile -+++ b/drivers/Makefile -@@ -120,6 +120,7 @@ obj-$(CONFIG_VLYNQ) += vlynq/ - obj-$(CONFIG_STAGING) += staging/ - obj-y += platform/ - obj-y += ieee802154/ -+obj-$(CONFIG_SCST) += scst/ - #common clk code - obj-y += clk/ - diff --git a/scst/kernel/in-tree/Makefile.drivers.Linux-3.6.patch b/scst/kernel/in-tree/Makefile.drivers.Linux-3.6.patch deleted file mode 100644 index 479746f..0000000 --- a/scst/kernel/in-tree/Makefile.drivers.Linux-3.6.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/drivers/Makefile b/drivers/Makefile -index c07be02..615d036 100644 ---- a/drivers/Makefile -+++ b/drivers/Makefile -@@ -120,6 +120,7 @@ obj-$(CONFIG_VLYNQ) += vlynq/ - obj-$(CONFIG_STAGING) += staging/ - obj-y += platform/ - obj-y += ieee802154/ -+obj-$(CONFIG_SCST) += scst/ - #common clk code - obj-y += clk/ - diff --git a/scst/kernel/in-tree/Makefile.scst-2.6.23 b/scst/kernel/in-tree/Makefile.scst-2.6.23 deleted file mode 100644 index 86b1c88..0000000 --- a/scst/kernel/in-tree/Makefile.scst-2.6.23 +++ /dev/null @@ -1,16 +0,0 @@ -ccflags-y += -Wno-unused-parameter - -scst-y += scst_copy_mgr.o -scst-y += scst_debug.o -scst-y += scst_dlm.o -scst-y += scst_event.o -scst-y += scst_lib.o -scst-y += scst_main.o -scst-y += scst_mem.o -scst-y += scst_no_dlm.o -scst-y += scst_pres.o -scst-y += scst_sysfs.o -scst-y += scst_targ.o -scst-y += scst_tg.o - -obj-$(CONFIG_SCST) += scst.o dev_handlers/ iscsi-scst/ srpt/ scst_local/ diff --git a/scst/kernel/in-tree/Makefile.scst-2.6.24 b/scst/kernel/in-tree/Makefile.scst-2.6.24 deleted file mode 100644 index 86b1c88..0000000 --- a/scst/kernel/in-tree/Makefile.scst-2.6.24 +++ /dev/null @@ -1,16 +0,0 @@ -ccflags-y += -Wno-unused-parameter - -scst-y += scst_copy_mgr.o -scst-y += scst_debug.o -scst-y += scst_dlm.o -scst-y += scst_event.o -scst-y += scst_lib.o -scst-y += scst_main.o -scst-y += scst_mem.o -scst-y += scst_no_dlm.o -scst-y += scst_pres.o -scst-y += scst_sysfs.o -scst-y += scst_targ.o -scst-y += scst_tg.o - -obj-$(CONFIG_SCST) += scst.o dev_handlers/ iscsi-scst/ srpt/ scst_local/ diff --git a/scst/kernel/in-tree/Makefile.scst-2.6.25 b/scst/kernel/in-tree/Makefile.scst-2.6.25 deleted file mode 100644 index 86b1c88..0000000 --- a/scst/kernel/in-tree/Makefile.scst-2.6.25 +++ /dev/null @@ -1,16 +0,0 @@ -ccflags-y += -Wno-unused-parameter - -scst-y += scst_copy_mgr.o -scst-y += scst_debug.o -scst-y += scst_dlm.o -scst-y += scst_event.o -scst-y += scst_lib.o -scst-y += scst_main.o -scst-y += scst_mem.o -scst-y += scst_no_dlm.o -scst-y += scst_pres.o -scst-y += scst_sysfs.o -scst-y += scst_targ.o -scst-y += scst_tg.o - -obj-$(CONFIG_SCST) += scst.o dev_handlers/ iscsi-scst/ srpt/ scst_local/ diff --git a/scst/kernel/in-tree/Makefile.scst-2.6.26 b/scst/kernel/in-tree/Makefile.scst-2.6.26 deleted file mode 100644 index 86b1c88..0000000 --- a/scst/kernel/in-tree/Makefile.scst-2.6.26 +++ /dev/null @@ -1,16 +0,0 @@ -ccflags-y += -Wno-unused-parameter - -scst-y += scst_copy_mgr.o -scst-y += scst_debug.o -scst-y += scst_dlm.o -scst-y += scst_event.o -scst-y += scst_lib.o -scst-y += scst_main.o -scst-y += scst_mem.o -scst-y += scst_no_dlm.o -scst-y += scst_pres.o -scst-y += scst_sysfs.o -scst-y += scst_targ.o -scst-y += scst_tg.o - -obj-$(CONFIG_SCST) += scst.o dev_handlers/ iscsi-scst/ srpt/ scst_local/ diff --git a/scst/kernel/in-tree/Makefile.scst-2.6.27 b/scst/kernel/in-tree/Makefile.scst-2.6.27 deleted file mode 100644 index 86b1c88..0000000 --- a/scst/kernel/in-tree/Makefile.scst-2.6.27 +++ /dev/null @@ -1,16 +0,0 @@ -ccflags-y += -Wno-unused-parameter - -scst-y += scst_copy_mgr.o -scst-y += scst_debug.o -scst-y += scst_dlm.o -scst-y += scst_event.o -scst-y += scst_lib.o -scst-y += scst_main.o -scst-y += scst_mem.o -scst-y += scst_no_dlm.o -scst-y += scst_pres.o -scst-y += scst_sysfs.o -scst-y += scst_targ.o -scst-y += scst_tg.o - -obj-$(CONFIG_SCST) += scst.o dev_handlers/ iscsi-scst/ srpt/ scst_local/ diff --git a/scst/kernel/in-tree/Makefile.scst-2.6.28 b/scst/kernel/in-tree/Makefile.scst-2.6.28 deleted file mode 100644 index 86b1c88..0000000 --- a/scst/kernel/in-tree/Makefile.scst-2.6.28 +++ /dev/null @@ -1,16 +0,0 @@ -ccflags-y += -Wno-unused-parameter - -scst-y += scst_copy_mgr.o -scst-y += scst_debug.o -scst-y += scst_dlm.o -scst-y += scst_event.o -scst-y += scst_lib.o -scst-y += scst_main.o -scst-y += scst_mem.o -scst-y += scst_no_dlm.o -scst-y += scst_pres.o -scst-y += scst_sysfs.o -scst-y += scst_targ.o -scst-y += scst_tg.o - -obj-$(CONFIG_SCST) += scst.o dev_handlers/ iscsi-scst/ srpt/ scst_local/ diff --git a/scst/kernel/in-tree/Makefile.scst-2.6.29 b/scst/kernel/in-tree/Makefile.scst-2.6.29 deleted file mode 100644 index 86b1c88..0000000 --- a/scst/kernel/in-tree/Makefile.scst-2.6.29 +++ /dev/null @@ -1,16 +0,0 @@ -ccflags-y += -Wno-unused-parameter - -scst-y += scst_copy_mgr.o -scst-y += scst_debug.o -scst-y += scst_dlm.o -scst-y += scst_event.o -scst-y += scst_lib.o -scst-y += scst_main.o -scst-y += scst_mem.o -scst-y += scst_no_dlm.o -scst-y += scst_pres.o -scst-y += scst_sysfs.o -scst-y += scst_targ.o -scst-y += scst_tg.o - -obj-$(CONFIG_SCST) += scst.o dev_handlers/ iscsi-scst/ srpt/ scst_local/ diff --git a/scst/kernel/in-tree/Makefile.scst-2.6.30 b/scst/kernel/in-tree/Makefile.scst-2.6.30 deleted file mode 100644 index 86b1c88..0000000 --- a/scst/kernel/in-tree/Makefile.scst-2.6.30 +++ /dev/null @@ -1,16 +0,0 @@ -ccflags-y += -Wno-unused-parameter - -scst-y += scst_copy_mgr.o -scst-y += scst_debug.o -scst-y += scst_dlm.o -scst-y += scst_event.o -scst-y += scst_lib.o -scst-y += scst_main.o -scst-y += scst_mem.o -scst-y += scst_no_dlm.o -scst-y += scst_pres.o -scst-y += scst_sysfs.o -scst-y += scst_targ.o -scst-y += scst_tg.o - -obj-$(CONFIG_SCST) += scst.o dev_handlers/ iscsi-scst/ srpt/ scst_local/ diff --git a/scst/kernel/in-tree/Makefile.scst-2.6.31 b/scst/kernel/in-tree/Makefile.scst-2.6.31 deleted file mode 100644 index 86b1c88..0000000 --- a/scst/kernel/in-tree/Makefile.scst-2.6.31 +++ /dev/null @@ -1,16 +0,0 @@ -ccflags-y += -Wno-unused-parameter - -scst-y += scst_copy_mgr.o -scst-y += scst_debug.o -scst-y += scst_dlm.o -scst-y += scst_event.o -scst-y += scst_lib.o -scst-y += scst_main.o -scst-y += scst_mem.o -scst-y += scst_no_dlm.o -scst-y += scst_pres.o -scst-y += scst_sysfs.o -scst-y += scst_targ.o -scst-y += scst_tg.o - -obj-$(CONFIG_SCST) += scst.o dev_handlers/ iscsi-scst/ srpt/ scst_local/ diff --git a/scst/kernel/in-tree/Makefile.scst-2.6.32 b/scst/kernel/in-tree/Makefile.scst-2.6.32 deleted file mode 100644 index 86b1c88..0000000 --- a/scst/kernel/in-tree/Makefile.scst-2.6.32 +++ /dev/null @@ -1,16 +0,0 @@ -ccflags-y += -Wno-unused-parameter - -scst-y += scst_copy_mgr.o -scst-y += scst_debug.o -scst-y += scst_dlm.o -scst-y += scst_event.o -scst-y += scst_lib.o -scst-y += scst_main.o -scst-y += scst_mem.o -scst-y += scst_no_dlm.o -scst-y += scst_pres.o -scst-y += scst_sysfs.o -scst-y += scst_targ.o -scst-y += scst_tg.o - -obj-$(CONFIG_SCST) += scst.o dev_handlers/ iscsi-scst/ srpt/ scst_local/ |
From: Gleb C. <lna...@ya...> - 2025-09-30 09:13:49
|
Commit: 8180623 GitHub URL: https://github.com/SCST-project/scst/commit/81806233109247ba6a60926740fe04454124c39b Author: Gleb Chesnokov Date: 2025-09-30T12:13:22+03:00 Log Message: ----------- nightly build: Update kernel versions Another kernel versions update Modified Paths: -------------- .github/workflows/run_regression_tests.yaml | 29 ++++++++------- nightly/conf/nightly.conf | 29 ++++++++------- 2 files changed, 30 insertions(+), 28 deletions(-) =================================================================== diff --git a/.github/workflows/run_regression_tests.yaml b/.github/workflows/run_regression_tests.yaml index 5a7cfbf..2bf37f2 100644 --- a/.github/workflows/run_regression_tests.yaml +++ b/.github/workflows/run_regression_tests.yaml @@ -16,35 +16,36 @@ jobs: fail-fast: false matrix: version: [ - '6.16', - '6.15.9', + '6.17', + '6.16.9', + '6.15.11', '6.14.11', '6.13.12', - '6.12.41', + '6.12.49', '6.11.11', '6.10.14', '6.9.12', '6.8.12', '6.7.12', - '6.6.101', - '6.1.146', - '5.15.189', - '5.10.240', - '5.4.296', + '6.6.108', + '6.1.154', + '5.15.193', + '5.10.244', + '5.4.299', '4.19.325', '4.14.336', '4.9.337', '3.18.140', '3.10.108', - '6.12.0-55.22.1.el10_0^AlmaLinux^10.0', - '5.14.0-570.30.1.el9_6^AlmaLinux^9.6', + '6.12.0-55.34.1.el10_0^AlmaLinux^10.0', + '5.14.0-570.46.1.el9_6^AlmaLinux^9.6', '5.14.0-503.40.1.el9_5^AlmaLinux^9.5', '5.14.0-427.42.1.el9_4^AlmaLinux^9.4', '5.14.0-362.24.1.el9_3^AlmaLinux^9.3', '5.14.0-284.30.1.el9_2^AlmaLinux^9.2', '5.14.0-162.23.1.el9_1^AlmaLinux^9.1', '5.14.0-70.30.1.el9_0^AlmaLinux^9.0', - '4.18.0-553.53.1.el8_10^AlmaLinux^8.10', + '4.18.0-553.76.1.el8_10^AlmaLinux^8.10', '4.18.0-513.24.1.el8_9^AlmaLinux^8.9', '4.18.0-477.13.1.el8_8^AlmaLinux^8.8', '4.18.0-425.19.2.el8_7^AlmaLinux^8.7', @@ -54,9 +55,9 @@ jobs: '4.18.0-240.22.1.el8_3^AlmaLinux^8.3', '3.10.0-1160.118.1.el7^CentOS^7.9.2009', '3.10.0-862.14.4.el7^CentOS^7.5.1804', - '6.12.0-101.33.4.3.el10uek^UEK^10', - '5.15.0-310.184.5.3.el9uek^UEK^9', - '5.4.17-2136.345.5.3.el8uek^UEK^8', + '6.12.0-103.40.4.3.el10uek^UEK^10', + '5.15.0-312.187.5.3.el9uek^UEK^9', + '5.4.17-2136.347.6.3.el8uek^UEK^8', '4.14.35-2047.543.3.1.el7uek^UEK^7', '4.1.12-124.93.1.el7uek^UEK^7', '4.1.12-124.48.6.el6uek^UEK^6' diff --git a/nightly/conf/nightly.conf b/nightly/conf/nightly.conf index ee93949..fb64e81 100644 --- a/nightly/conf/nightly.conf +++ b/nightly/conf/nightly.conf @@ -3,39 +3,40 @@ ABT_DETAILS="x86_64" ABT_JOBS=5 ABT_KERNELS=" \ -6.16 \ -6.15.9-nc \ +6.17 \ +6.16.9-nc \ +6.15.11-nc \ 6.14.11-nc \ 6.13.12-nc \ -6.12.41-nc \ +6.12.49-nc \ 6.11.11-nc \ 6.10.14-nc \ 6.9.12-nc \ 6.8.12-nc \ 6.7.12-nc \ -6.6.101-nc \ +6.6.108-nc \ 6.5.13-nc \ 6.4.16-nc \ 6.3.13-nc \ 6.2.16-nc \ -6.1.146-nc \ +6.1.154-nc \ 6.0.19-nc \ 5.19.17-nc \ 5.18.19-nc \ 5.17.15-nc \ 5.16.20-nc \ -5.15.189-nc \ +5.15.193-nc \ 5.14.21-nc \ 5.13.19-nc \ 5.12.19-nc \ 5.11.22-nc \ -5.10.240-nc \ +5.10.244-nc \ 5.9.16-nc \ 5.8.18-nc \ 5.7.19-nc \ 5.6.19-nc \ 5.5.19-nc \ -5.4.296-nc \ +5.4.299-nc \ 5.3.18-nc \ 5.2.21-nc \ 5.1.21-nc \ @@ -71,15 +72,15 @@ ABT_KERNELS=" \ 3.12.74-nc \ 3.11.10-nc \ 3.10.108-nc \ -6.12.0-55.22.1.el10_0^AlmaLinux^10.0-nc \ -5.14.0-570.30.1.el9_6^AlmaLinux^9.6-nc \ +6.12.0-55.34.1.el10_0^AlmaLinux^10.0-nc \ +5.14.0-570.46.1.el9_6^AlmaLinux^9.6-nc \ 5.14.0-503.40.1.el9_5^AlmaLinux^9.5-nc \ 5.14.0-427.42.1.el9_4^AlmaLinux^9.4-nc \ 5.14.0-362.24.1.el9_3^AlmaLinux^9.3-nc \ 5.14.0-284.30.1.el9_2^AlmaLinux^9.2-nc \ 5.14.0-162.23.1.el9_1^AlmaLinux^9.1-nc \ 5.14.0-70.30.1.el9_0^AlmaLinux^9.0-nc \ -4.18.0-553.53.1.el8_10^AlmaLinux^8.10-nc \ +4.18.0-553.76.1.el8_10^AlmaLinux^8.10-nc \ 4.18.0-513.24.1.el8_9^AlmaLinux^8.9-nc \ 4.18.0-477.13.1.el8_8^AlmaLinux^8.8-nc \ 4.18.0-425.19.2.el8_7^AlmaLinux^8.7-nc \ @@ -95,9 +96,9 @@ ABT_KERNELS=" \ 3.10.0-1062.18.1.el7^CentOS^7.7.1908-nc \ 3.10.0-957.27.2.el7^CentOS^7.6.1810-nc \ 3.10.0-862.14.4.el7^CentOS^7.5.1804-nc \ -6.12.0-101.33.4.3.el10uek^UEK^10-nc \ -5.15.0-310.184.5.3.el9uek^UEK^9-nc \ -5.4.17-2136.345.5.3.el8uek^UEK^8-nc \ +6.12.0-103.40.4.3.el10uek^UEK^10-nc \ +5.15.0-312.187.5.3.el9uek^UEK^9-nc \ +5.4.17-2136.347.6.3.el8uek^UEK^8-nc \ 4.14.35-2047.543.3.1.el7uek^UEK^7-nc \ 4.1.12-124.93.1.el7uek^UEK^7-nc \ 4.1.12-124.48.6.el6uek^UEK^6-nc \ |
From: Gleb C. <lna...@ya...> - 2025-09-23 10:26:48
|
Commit: 420b064 GitHub URL: https://github.com/SCST-project/scst/commit/420b06472b3944be85ecb2f498c203d0f2b1d222 Author: Gleb Chesnokov Date: 2025-09-23T13:24:49+03:00 Log Message: ----------- scst_event: Fix multiple checkpatch warnings This patch does not change any functionality. Modified Paths: -------------- scst/src/scst_event.c | 313 +++++++-------- 1 file changed, 139 insertions(+), 174 deletions(-) =================================================================== diff --git a/scst/src/scst_event.c b/scst/src/scst_event.c index a36c667..857155d 100644 --- a/scst/src/scst_event.c +++ b/scst/src/scst_event.c @@ -38,8 +38,8 @@ static struct class *scst_event_sysfs_class; static int scst_event_major; #define SCST_MAX_EVENTS 2048 -#define SCST_MAX_PAYLOAD (3*1024) -#define SCST_DEFAULT_EVENT_TIMEOUT (60*HZ) +#define SCST_MAX_PAYLOAD (3 * 1024) +#define SCST_DEFAULT_EVENT_TIMEOUT (60 * HZ) struct scst_event_priv { struct list_head privs_list_entry; @@ -69,15 +69,13 @@ static LIST_HEAD(scst_event_privs_list); * - issuer_name "*" - any issuer name * - payload_len 0 - any payload */ -static bool scst_event_cmp(const struct scst_event *e1_wild, - const struct scst_event *e2) +static bool scst_event_cmp(const struct scst_event *e1_wild, const struct scst_event *e2) { int res = false; TRACE_ENTRY(); - if ((e1_wild->event_code != e2->event_code) && - (e1_wild->event_code != 0)) + if (e1_wild->event_code != e2->event_code && e1_wild->event_code != 0) goto out; if ((strcmp(e1_wild->issuer_name, e2->issuer_name) != 0) && @@ -87,7 +85,7 @@ static bool scst_event_cmp(const struct scst_event *e1_wild, if (e1_wild->payload_len == 0) goto out_true; - if ((e1_wild->payload_len != e2->payload_len) || + if (e1_wild->payload_len != e2->payload_len || (memcmp(e1_wild->payload, e2->payload, e1_wild->payload_len) != 0)) goto out; @@ -101,14 +99,14 @@ out: static void scst_event_timeout_fn(struct work_struct *work) { - struct scst_event_entry *event_entry = container_of(work, - struct scst_event_entry, event_timeout_work.work); + struct scst_event_entry *event_entry = container_of(work, struct scst_event_entry, + event_timeout_work.work); TRACE_ENTRY(); TRACE_MGMT_DBG("Timeout of event %d (issuer %s, id %u, entry %p)", - event_entry->event.event_code, event_entry->event.issuer_name, - event_entry->event.event_id, event_entry); + event_entry->event.event_code, event_entry->event.issuer_name, + event_entry->event.event_id, event_entry); mutex_lock(&scst_event_mutex); @@ -132,11 +130,10 @@ static void scst_event_timeout_fn(struct work_struct *work) out: TRACE_EXIT(); - return; } static int scst_clone_event(const struct scst_event_entry *orig_entry, - struct scst_event_entry **new_event_entry) + struct scst_event_entry **new_event_entry) { int res = 0; const struct scst_event *event = &orig_entry->event; @@ -146,10 +143,9 @@ static int scst_clone_event(const struct scst_event_entry *orig_entry, TRACE_ENTRY(); event_entry = kzalloc(event_entry_len, GFP_KERNEL); - if (event_entry == NULL) { - PRINT_ERROR("Unable to clone event entry (size %d, event %d, " - "issuer %s", event_entry_len, event->event_code, - event->issuer_name); + if (!event_entry) { + PRINT_ERROR("Unable to clone event entry (size %d, event %d, issuer %s", + event_entry_len, event->event_code, event->issuer_name); res = -ENOMEM; goto out; } @@ -158,7 +154,7 @@ static int scst_clone_event(const struct scst_event_entry *orig_entry, memcpy(&event_entry->event, event, sizeof(*event) + event->payload_len); - WARN_ON(orig_entry->event_notify_fn != NULL); + WARN_ON(orig_entry->event_notify_fn); *new_event_entry = event_entry; @@ -181,55 +177,54 @@ static void __scst_event_queue(struct scst_event_entry *event_entry) mutex_lock(&scst_event_mutex); list_for_each_entry(priv, &scst_event_privs_list, privs_list_entry) { - list_for_each_entry(allowed_entry, &priv->allowed_events_list, - events_list_entry) { + list_for_each_entry(allowed_entry, &priv->allowed_events_list, events_list_entry) { if (scst_event_cmp(&allowed_entry->event, event)) { struct scst_event_entry *new_event_entry; if (priv->queued_events_cnt >= SCST_MAX_EVENTS) { - PRINT_ERROR("Too many queued events %d, " - "event %d, issuer %s is lost.", - priv->queued_events_cnt, - event->event_code, - event->issuer_name); + PRINT_ERROR("Too many queued events %d, event %d, issuer %s is lost.", + priv->queued_events_cnt, event->event_code, + event->issuer_name); rc = -EMFILE; break; } - if (!queued) + if (!queued) { new_event_entry = event_entry; - else if (event_entry->event_notify_fn == NULL) { + } else if (!event_entry->event_notify_fn) { rc = scst_clone_event(event_entry, &new_event_entry); if (rc != 0) goto done; } else { - PRINT_WARNING("Event %d can be queued only once, " - "dublicated receiver pid %d will miss it!", - event->event_code, priv->owner_pid); + PRINT_WARNING("Event %d can be queued only once, dublicated receiver pid %d will miss it!", + event->event_code, priv->owner_pid); break; } INIT_DELAYED_WORK(&new_event_entry->event_timeout_work, scst_event_timeout_fn); - if (new_event_entry->event_notify_fn != NULL) { - new_event_entry->event.event_id = atomic_inc_return(&base_event_id); + if (new_event_entry->event_notify_fn) { + new_event_entry->event.event_id = + atomic_inc_return(&base_event_id); if (new_event_entry->event_timeout == 0) - new_event_entry->event_timeout = SCST_DEFAULT_EVENT_TIMEOUT; + new_event_entry->event_timeout = + SCST_DEFAULT_EVENT_TIMEOUT; - queue_delayed_work(scst_event_wq, &new_event_entry->event_timeout_work, + queue_delayed_work(scst_event_wq, + &new_event_entry->event_timeout_work, new_event_entry->event_timeout); } list_add_tail(&new_event_entry->events_list_entry, - &priv->queued_events_list); + &priv->queued_events_list); priv->queued_events_cnt++; new_event_entry->pqueued_events_cnt = &priv->queued_events_cnt; queued = true; - TRACE_DBG("event %d queued (issuer %s, id %u, " - "entry %p)", new_event_entry->event.event_code, - new_event_entry->event.issuer_name, - new_event_entry->event.event_id, new_event_entry); + TRACE_DBG("event %d queued (issuer %s, id %u, entry %p)", + new_event_entry->event.event_code, + new_event_entry->event.issuer_name, + new_event_entry->event.event_id, new_event_entry); wake_up_all(&priv->queued_events_waitQ); break; @@ -240,13 +235,13 @@ done: mutex_unlock(&scst_event_mutex); if (!queued) { - if (event_entry->event_notify_fn != NULL) { + if (event_entry->event_notify_fn) { if (rc == 0) rc = -ENOENT; TRACE_DBG("Calling notify_fn of event_entry %p (rc %d)", - event_entry, rc); + event_entry, rc); event_entry->event_notify_fn(&event_entry->event, - event_entry->notify_fn_priv, rc); + event_entry->notify_fn_priv, rc); } TRACE_MEM("Freeing orphan event entry %p", event_entry); @@ -254,25 +249,22 @@ done: } TRACE_EXIT(); - return; } static void scst_event_queue_work_fn(struct work_struct *work) { - struct scst_event_entry *e = container_of(work, - struct scst_event_entry, scst_event_queue_work); + struct scst_event_entry *e = container_of(work, struct scst_event_entry, + scst_event_queue_work); TRACE_ENTRY(); __scst_event_queue(e); TRACE_EXIT(); - return; } /* Can be called on IRQ with any lock held */ -void scst_event_queue(uint32_t event_code, const char *issuer_name, - struct scst_event_entry *e) +void scst_event_queue(uint32_t event_code, const char *issuer_name, struct scst_event_entry *e) { TRACE_ENTRY(); @@ -286,7 +278,6 @@ void scst_event_queue(uint32_t event_code, const char *issuer_name, queue_work(scst_event_wq, &e->scst_event_queue_work); TRACE_EXIT(); - return; } EXPORT_SYMBOL_GPL(scst_event_queue); @@ -302,17 +293,16 @@ int scst_event_queue_lun_not_found(const struct scst_cmd *cmd) event_entry_len = sizeof(*event_entry) + sizeof(*payload); event_entry = kzalloc(event_entry_len, GFP_ATOMIC); - if (event_entry == NULL) { - PRINT_ERROR("Unable to allocate event (size %d). LUN not found " - "event is lost (LUN %lld, initiator %s, target %s)!", - event_entry_len, (unsigned long long)cmd->lun, - cmd->sess->initiator_name, cmd->tgt->tgt_name); + if (!event_entry) { + PRINT_ERROR("Unable to allocate event (size %d). LUN not found event is lost (LUN %lld, initiator %s, target %s)!", + event_entry_len, (unsigned long long)cmd->lun, + cmd->sess->initiator_name, cmd->tgt->tgt_name); res = -ENOMEM; goto out; } - TRACE_MEM("event_entry %p (len %d) allocated", event_entry, - event_entry_len); + TRACE_MEM("event_entry %p (len %d) allocated", + event_entry, event_entry_len); event = &event_entry->event; @@ -325,16 +315,14 @@ int scst_event_queue_lun_not_found(const struct scst_cmd *cmd) strscpy(payload->target_name, cmd->tgt->tgt_name, sizeof(payload->target_name)); - scst_event_queue(SCST_EVENT_LUN_NOT_FOUND, - SCST_EVENT_SCST_CORE_ISSUER, event_entry); + scst_event_queue(SCST_EVENT_LUN_NOT_FOUND, SCST_EVENT_SCST_CORE_ISSUER, event_entry); out: TRACE_EXIT_RES(res); return res; } -int scst_event_queue_negative_luns_inquiry(const struct scst_tgt *tgt, - const char *initiator_name) +int scst_event_queue_negative_luns_inquiry(const struct scst_tgt *tgt, const char *initiator_name) { int res = 0, event_entry_len; struct scst_event_entry *event_entry; @@ -345,16 +333,15 @@ int scst_event_queue_negative_luns_inquiry(const struct scst_tgt *tgt, event_entry_len = sizeof(*event_entry) + sizeof(*payload); event_entry = kzalloc(event_entry_len, GFP_ATOMIC); - if (event_entry == NULL) { - PRINT_ERROR("Unable to allocate event (size %d). NEGATIVE LUNS " - "INQUIRY event is lost (initiator %s, target %s)!", - event_entry_len, initiator_name, tgt->tgt_name); + if (!event_entry) { + PRINT_ERROR("Unable to allocate event (size %d). NEGATIVE LUNS INQUIRY event is lost (initiator %s, target %s)!", + event_entry_len, initiator_name, tgt->tgt_name); res = -ENOMEM; goto out; } - TRACE_MEM("event_entry %p (len %d) allocated", event_entry, - event_entry_len); + TRACE_MEM("event_entry %p (len %d) allocated", + event_entry, event_entry_len); event = &event_entry->event; @@ -366,8 +353,8 @@ int scst_event_queue_negative_luns_inquiry(const struct scst_tgt *tgt, strscpy(payload->target_name, tgt->tgt_name, sizeof(payload->target_name)); - scst_event_queue(SCST_EVENT_NEGATIVE_LUNS_INQUIRY, - SCST_EVENT_SCST_CORE_ISSUER, event_entry); + scst_event_queue(SCST_EVENT_NEGATIVE_LUNS_INQUIRY, SCST_EVENT_SCST_CORE_ISSUER, + event_entry); out: TRACE_EXIT_RES(res); @@ -386,16 +373,15 @@ int scst_event_queue_ext_blocking_done(struct scst_device *dev, void *data, int event_entry_len = sizeof(*event_entry) + sizeof(*payload) + len; event_entry = kzalloc(event_entry_len, GFP_ATOMIC); - if (event_entry == NULL) { - PRINT_CRIT_ERROR("Unable to allocate event. Ext blocking " - "done event is lost (device %s, size %zd)!", dev->virt_name, - sizeof(*event_entry) + sizeof(*payload) + len); + if (!event_entry) { + PRINT_CRIT_ERROR("Unable to allocate event. Ext blocking done event is lost (device %s, size %zd)!", + dev->virt_name, sizeof(*event_entry) + sizeof(*payload) + len); res = -ENOMEM; goto out; } - TRACE_MEM("event_entry %p (len %d) allocated", event_entry, - event_entry_len); + TRACE_MEM("event_entry %p (len %d) allocated", + event_entry, event_entry_len); event = &event_entry->event; @@ -406,8 +392,7 @@ int scst_event_queue_ext_blocking_done(struct scst_device *dev, void *data, int if (len > 0) memcpy(payload->data, data, len); - scst_event_queue(SCST_EVENT_EXT_BLOCKING_DONE, - SCST_EVENT_SCST_CORE_ISSUER, event_entry); + scst_event_queue(SCST_EVENT_EXT_BLOCKING_DONE, SCST_EVENT_SCST_CORE_ISSUER, event_entry); res = 0; out: @@ -427,15 +412,15 @@ int scst_event_queue_tm_fn_received(struct scst_mgmt_cmd *mcmd) event_entry_len = sizeof(*event_entry) + sizeof(*payload); event_entry = kzalloc(event_entry_len, GFP_KERNEL); - if (event_entry == NULL) { - PRINT_CRIT_ERROR("Unable to allocate event (size %d). External " - "TM fn received event is lost!", event_entry_len); + if (!event_entry) { + PRINT_CRIT_ERROR("Unable to allocate event (size %d). External TM fn received event is lost!", + event_entry_len); res = -ENOMEM; goto out; } - TRACE_MEM("event_entry %p (len %d) allocated", event_entry, - event_entry_len); + TRACE_MEM("event_entry %p (len %d) allocated", + event_entry, event_entry_len); event = &event_entry->event; @@ -444,7 +429,7 @@ int scst_event_queue_tm_fn_received(struct scst_mgmt_cmd *mcmd) payload->fn = mcmd->fn; payload->lun = mcmd->lun; - if (mcmd->mcmd_tgt_dev != NULL) + if (mcmd->mcmd_tgt_dev) strscpy(payload->device_name, mcmd->mcmd_tgt_dev->dev->virt_name, sizeof(payload->device_name)); strscpy(payload->initiator_name, mcmd->sess->initiator_name, @@ -453,15 +438,14 @@ int scst_event_queue_tm_fn_received(struct scst_mgmt_cmd *mcmd) sizeof(payload->target_name)); strscpy(payload->session_sysfs_name, mcmd->sess->sess_name, sizeof(payload->session_sysfs_name)); - if (mcmd->cmd_to_abort != NULL) { + if (mcmd->cmd_to_abort) { payload->cmd_to_abort_tag = mcmd->cmd_to_abort->tag; memcpy(payload->cdb, mcmd->cmd_to_abort->cdb, min_t(u32, mcmd->cmd_to_abort->cdb_len, sizeof(payload->cdb))); } - scst_event_queue(SCST_EVENT_TM_FN_RECEIVED, - SCST_EVENT_SCST_CORE_ISSUER, event_entry); + scst_event_queue(SCST_EVENT_TM_FN_RECEIVED, SCST_EVENT_SCST_CORE_ISSUER, event_entry); out: TRACE_EXIT_RES(res); @@ -480,16 +464,15 @@ int scst_event_queue_reg_vdev(const char *dev_name) event_entry_len = sizeof(*event_entry) + sizeof(*payload); event_entry = kzalloc(event_entry_len, GFP_ATOMIC); - if (event_entry == NULL) { - PRINT_ERROR("Unable to allocate event (size %d). Virtual " - "device registration event is lost (device name %s)!", - event_entry_len, dev_name); + if (!event_entry) { + PRINT_ERROR("Unable to allocate event (size %d). Virtual device registration event is lost (device name %s)!", + event_entry_len, dev_name); res = -ENOMEM; goto out; } - TRACE_MEM("event_entry %p (len %d) allocated", event_entry, - event_entry_len); + TRACE_MEM("event_entry %p (len %d) allocated", + event_entry, event_entry_len); event = &event_entry->event; @@ -499,8 +482,7 @@ int scst_event_queue_reg_vdev(const char *dev_name) strscpy(payload->device_name, dev_name, sizeof(payload->device_name)); - scst_event_queue(SCST_EVENT_REG_VIRT_DEV, - SCST_EVENT_SCST_CORE_ISSUER, event_entry); + scst_event_queue(SCST_EVENT_REG_VIRT_DEV, SCST_EVENT_SCST_CORE_ISSUER, event_entry); out: TRACE_EXIT_RES(res); @@ -515,7 +497,7 @@ static void scst_release_event_entry(struct scst_event_entry *e) TRACE_DBG("Deleting event entry %p", e); list_del(&e->events_list_entry); - if (e->event_notify_fn != NULL) { + if (e->event_notify_fn) { mutex_unlock(&scst_event_mutex); cancel_delayed_work_sync(&e->event_timeout_work); @@ -530,7 +512,6 @@ static void scst_release_event_entry(struct scst_event_entry *e) kfree(e); TRACE_EXIT(); - return; } static int scst_event_release(struct inode *inode, struct file *file) @@ -543,7 +524,7 @@ static int scst_event_release(struct inode *inode, struct file *file) mutex_lock(&scst_event_mutex); priv = file->private_data; - if (priv == NULL) { + if (!priv) { mutex_unlock(&scst_event_mutex); goto out; } @@ -558,8 +539,7 @@ static int scst_event_release(struct inode *inode, struct file *file) priv->going_to_exit = 1; wake_up_all(&priv->queued_events_waitQ); - list_for_each_entry_safe(e, et, &priv->allowed_events_list, - events_list_entry) { + list_for_each_entry_safe(e, et, &priv->allowed_events_list, events_list_entry) { TRACE_MEM("Deleting allowed event entry %p", e); list_del(&e->events_list_entry); kfree(e); @@ -567,13 +547,11 @@ static int scst_event_release(struct inode *inode, struct file *file) mutex_lock(&scst_event_mutex); /* to sync with timeout_work */ while (!list_empty(&priv->queued_events_list)) { - e = list_entry(priv->queued_events_list.next, - typeof(*e), events_list_entry); + e = list_entry(priv->queued_events_list.next, typeof(*e), events_list_entry); scst_release_event_entry(e); } while (!list_empty(&priv->processing_events_list)) { - e = list_entry(priv->processing_events_list.next, - typeof(*e), events_list_entry); + e = list_entry(priv->processing_events_list.next, typeof(*e), events_list_entry); scst_release_event_entry(e); } mutex_unlock(&scst_event_mutex); @@ -594,7 +572,7 @@ out: * plain event, because this entry can then be queued in some list. */ static int scst_event_get_event_from_user(struct scst_event_user __user *arg, - struct scst_event_entry **out_event_entry) + struct scst_event_entry **out_event_entry) { int res, rc; int event_entry_len, event_len; @@ -611,8 +589,8 @@ static int scst_event_get_event_from_user(struct scst_event_user __user *arg, } if (payload_len > SCST_MAX_PAYLOAD) { - PRINT_ERROR("Payload len %d is too big (max %d)", payload_len, - SCST_MAX_PAYLOAD); + PRINT_ERROR("Payload len %d is too big (max %d)", + payload_len, SCST_MAX_PAYLOAD); res = -EINVAL; goto out; } @@ -622,9 +600,9 @@ static int scst_event_get_event_from_user(struct scst_event_user __user *arg, event_entry_len = sizeof(*event_entry) + payload_len; event_entry = kzalloc(event_entry_len, GFP_KERNEL); - if (event_entry == NULL) { + if (!event_entry) { PRINT_ERROR("Unable to allocate event entry (size %d)", - event_entry_len); + event_entry_len); res = -ENOMEM; goto out; } @@ -644,7 +622,7 @@ static int scst_event_get_event_from_user(struct scst_event_user __user *arg, /* payload_len has been recopied, so recheck it. */ if (event->payload_len != payload_len) { PRINT_ERROR("Payload len %d changed while being read: %d", - event->payload_len, payload_len); + event->payload_len, payload_len); res = -EINVAL; goto out_free; } @@ -652,7 +630,7 @@ static int scst_event_get_event_from_user(struct scst_event_user __user *arg, event->issuer_name[sizeof(event->issuer_name) - 1] = '\0'; TRACE_DBG("user event: event_code %d, issuer_name %s", - event->event_code, event->issuer_name); + event->event_code, event->issuer_name); *out_event_entry = event_entry; @@ -680,9 +658,8 @@ static int scst_event_allow_event(struct scst_event_priv *priv, void __user *arg list_for_each_entry(e, &priv->allowed_events_list, events_list_entry) { if (scst_event_cmp(&event_entry->event, &e->event)) { - PRINT_WARNING("Allowed event (event_code %d, " - "issuer_name %s) already exists", - e->event.event_code, e->event.issuer_name); + PRINT_WARNING("Allowed event (event_code %d, issuer_name %s) already exists", + e->event.event_code, e->event.issuer_name); res = -EEXIST; goto out_free; } @@ -690,13 +667,12 @@ static int scst_event_allow_event(struct scst_event_priv *priv, void __user *arg if (priv->allowed_events_cnt >= SCST_MAX_EVENTS) { PRINT_ERROR("Too many allowed events %d", - priv->allowed_events_cnt); + priv->allowed_events_cnt); res = -EMFILE; goto out_free; } - list_add_tail(&event_entry->events_list_entry, - &priv->allowed_events_list); + list_add_tail(&event_entry->events_list_entry, &priv->allowed_events_list); priv->allowed_events_cnt++; res = 0; @@ -711,8 +687,7 @@ out_free: } /* scst_event_mutex supposed to be held */ -static int scst_event_disallow_event(struct scst_event_priv *priv, - void __user *arg) +static int scst_event_disallow_event(struct scst_event_priv *priv, void __user *arg) { int res; struct scst_event_entry *event_entry, *e, *et; @@ -725,12 +700,10 @@ static int scst_event_disallow_event(struct scst_event_priv *priv, goto out; /* For wildcard events we might delete several events */ - list_for_each_entry_safe(e, et, &priv->allowed_events_list, - events_list_entry) { + list_for_each_entry_safe(e, et, &priv->allowed_events_list, events_list_entry) { if (scst_event_cmp(&event_entry->event, &e->event)) { - PRINT_INFO("Deleting allowed event (event_code %d, " - "issuer_name %s)", e->event.event_code, - e->event.issuer_name); + PRINT_INFO("Deleting allowed event (event_code %d, issuer_name %s)", + e->event.event_code, e->event.issuer_name); TRACE_MEM("Deleting event entry %p", e); list_del(&e->events_list_entry); kfree(e); @@ -739,12 +712,12 @@ static int scst_event_disallow_event(struct scst_event_priv *priv, } } if (!found) { - PRINT_WARNING("Allowed event (event_code %d, issuer_name %s) " - "not found", event_entry->event.event_code, - event_entry->event.issuer_name); + PRINT_WARNING("Allowed event (event_code %d, issuer_name %s) not found", + event_entry->event.event_code, event_entry->event.issuer_name); res = -ENOENT; - } else + } else { res = 0; + } TRACE_MEM("Deleting event entry %p", e); kfree(event_entry); @@ -755,8 +728,7 @@ out: } /* scst_event_mutex supposed to be held. Might drop it, then get back. */ -static int scst_event_user_next_event(struct scst_event_priv *priv, - void __user *arg) +static int scst_event_user_next_event(struct scst_event_priv *priv, void __user *arg) { int res, rc; int32_t max_event_size, needed_size; @@ -775,13 +747,14 @@ static int scst_event_user_next_event(struct scst_event_priv *priv, while (list_empty(&priv->queued_events_list)) { mutex_unlock(&scst_event_mutex); wait_event_interruptible(priv->queued_events_waitQ, - (!list_empty(&priv->queued_events_list) || priv->going_to_exit || - !priv->blocking || signal_pending(current))); + (!list_empty(&priv->queued_events_list) || + priv->going_to_exit || !priv->blocking || + signal_pending(current))); mutex_lock(&scst_event_mutex); if (priv->going_to_exit || signal_pending(current)) { res = -EINTR; TRACE_DBG("Signal pending or going_to_exit (%d), returning", - priv->going_to_exit); + priv->going_to_exit); goto out; } else if (list_empty(&priv->queued_events_list) && !priv->blocking) { res = -EAGAIN; @@ -792,14 +765,14 @@ static int scst_event_user_next_event(struct scst_event_priv *priv, EXTRACHECKS_BUG_ON(list_empty(&priv->queued_events_list)); - event_entry = list_entry(priv->queued_events_list.next, - struct scst_event_entry, events_list_entry); + event_entry = list_entry(priv->queued_events_list.next, struct scst_event_entry, + events_list_entry); needed_size = sizeof(event_entry->event) + event_entry->event.payload_len; if (needed_size > max_event_size) { - TRACE_DBG("Too big event (size %d, max size %d)", needed_size, - max_event_size); + TRACE_DBG("Too big event (size %d, max size %d)", + needed_size, max_event_size); res = put_user(needed_size, (int32_t __user *)arg); if (res == 0) res = -ENOSPC; @@ -815,9 +788,8 @@ static int scst_event_user_next_event(struct scst_event_priv *priv, if (event_entry->event_notify_fn) { TRACE_DBG("Moving event entry %p to processing events list", - event_entry); - list_move_tail(&event_entry->events_list_entry, - &priv->processing_events_list); + event_entry); + list_move_tail(&event_entry->events_list_entry, &priv->processing_events_list); } else { TRACE_MEM("Deleting event entry %p", event_entry); list_del(&event_entry->events_list_entry); @@ -834,8 +806,7 @@ out: } /* scst_event_mutex supposed to be held. Might drop it, then get back. */ -static int scst_event_user_notify_done(struct scst_event_priv *priv, - void __user *arg) +static int scst_event_user_notify_done(struct scst_event_priv *priv, void __user *arg) { int res, rc; struct scst_event_notify_done n; @@ -871,7 +842,7 @@ static int scst_event_user_notify_done(struct scst_event_priv *priv, cancel_delayed_work_sync(&e->event_timeout_work); - if (e->event_notify_fn != NULL) { + if (e->event_notify_fn) { TRACE_DBG("Calling notify_fn of event_entry %p", e); e->event_notify_fn(&e->event, e->notify_fn_priv, n.status); } @@ -895,7 +866,7 @@ static int scst_event_create_priv(struct file *file) TRACE_ENTRY(); - EXTRACHECKS_BUG_ON(file->private_data != NULL); + EXTRACHECKS_BUG_ON(file->private_data); if (!try_module_get(THIS_MODULE)) { PRINT_ERROR("Fail to get module"); @@ -904,9 +875,9 @@ static int scst_event_create_priv(struct file *file) } priv = kzalloc(sizeof(*priv), GFP_KERNEL); - if (priv == NULL) { + if (!priv) { PRINT_ERROR("Unable to allocate priv (size %zd)", - sizeof(*priv)); + sizeof(*priv)); res = -ENOMEM; goto out_put; } @@ -919,10 +890,11 @@ static int scst_event_create_priv(struct file *file) INIT_LIST_HEAD(&priv->queued_events_list); INIT_LIST_HEAD(&priv->processing_events_list); if (file->f_flags & O_NONBLOCK) { - TRACE_DBG("%s", "Non-blocking operations"); + TRACE_DBG("Non-blocking operations"); priv->blocking = 0; - } else + } else { priv->blocking = 1; + } list_add_tail(&priv->privs_list_entry, &scst_event_privs_list); @@ -939,8 +911,7 @@ out_put: goto out; } -static long scst_event_ioctl(struct file *file, unsigned int cmd, - unsigned long arg) +static long scst_event_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { long res; struct scst_event_priv *priv; @@ -950,7 +921,7 @@ static long scst_event_ioctl(struct file *file, unsigned int cmd, mutex_lock(&scst_event_mutex); priv = file->private_data; - if (unlikely(priv == NULL)) { + if (unlikely(!priv)) { /* This is the first time we are here */ res = scst_event_create_priv(file); if (res != 0) @@ -969,22 +940,22 @@ static long scst_event_ioctl(struct file *file, unsigned int cmd, switch (cmd) { case SCST_EVENT_ALLOW_EVENT: - TRACE_DBG("%s", "ALLOW_EVENT"); + TRACE_DBG("ALLOW_EVENT"); res = scst_event_allow_event(priv, (void __user *)arg); break; case SCST_EVENT_DISALLOW_EVENT: - TRACE_DBG("%s", "DISALLOW_EVENT"); + TRACE_DBG("DISALLOW_EVENT"); res = scst_event_disallow_event(priv, (void __user *)arg); break; case SCST_EVENT_GET_NEXT_EVENT: - TRACE_DBG("%s", "GET_NEXT_EVENT"); + TRACE_DBG("GET_NEXT_EVENT"); res = scst_event_user_next_event(priv, (void __user *)arg); break; case SCST_EVENT_NOTIFY_DONE: - TRACE_DBG("%s", "NOTIFY_DONE"); + TRACE_DBG("NOTIFY_DONE"); res = scst_event_user_notify_done(priv, (void __user *)arg); break; @@ -1011,7 +982,7 @@ static __poll_t scst_event_poll(struct file *file, poll_table *wait) mutex_lock(&scst_event_mutex); priv = file->private_data; - if (unlikely(priv == NULL)) { + if (unlikely(!priv)) { PRINT_ERROR("At least one allowed event must be set"); res = EPOLLNVAL; goto out_unlock; @@ -1047,21 +1018,18 @@ out_unlock: #endif #ifdef CONFIG_EVENTS_WAIT_TEST -static void scst_event_test_notify_fn(struct scst_event *event, - void *priv, int status) +static void scst_event_test_notify_fn(struct scst_event *event, void *priv, int status) { TRACE_ENTRY(); - PRINT_INFO("Notification for event %u (id %d) received with status %d " - "(priv %p)", event->event_code, event->event_id, status, - priv); + PRINT_INFO("Notification for event %u (id %d) received with status %d (priv %p)", + event->event_code, event->event_id, status, priv); TRACE_EXIT(); - return; } -static ssize_t event_wait_test_store(struct kobject *kobj, - struct kobj_attribute *attr, const char *buf, size_t count) +static ssize_t event_wait_test_store(struct kobject *kobj, struct kobj_attribute *attr, + const char *buf, size_t count) { int res = 0, event_entry_len; struct scst_event_entry *event_entry; @@ -1070,18 +1038,18 @@ static ssize_t event_wait_test_store(struct kobject *kobj, event_entry_len = sizeof(*event_entry); event_entry = kzalloc(event_entry_len, GFP_KERNEL); - if (event_entry == NULL) { - PRINT_ERROR("Unable to allocate event (size %d). Test " - "event is lost!", event_entry_len); + if (!event_entry) { + PRINT_ERROR("Unable to allocate event (size %d). Test event is lost!", + event_entry_len); res = -ENOMEM; goto out; } - TRACE_MEM("event_entry %p (len %d) allocated", event_entry, - event_entry_len); + TRACE_MEM("event_entry %p (len %d) allocated", + event_entry, event_entry_len); event_entry->event_notify_fn = scst_event_test_notify_fn; - event_entry->event_timeout = 10*HZ; + event_entry->event_timeout = 10 * HZ; scst_event_queue(0x12345, SCST_EVENT_SCST_CORE_ISSUER, event_entry); @@ -1094,7 +1062,7 @@ out: } static struct kobj_attribute event_wait_test_attr = - __ATTR(event_wait_test, S_IWUSR, NULL, event_wait_test_store); + __ATTR(event_wait_test, 0200, NULL, event_wait_test_store); #endif /* #ifdef CONFIG_EVENTS_WAIT_TEST */ @@ -1141,10 +1109,8 @@ int scst_event_init(void) goto out_class; } - dev = device_create(scst_event_sysfs_class, NULL, - MKDEV(scst_event_major, 0), - NULL, - SCST_EVENT_NAME); + dev = device_create(scst_event_sysfs_class, NULL, MKDEV(scst_event_major, 0), NULL, + SCST_EVENT_NAME); if (IS_ERR(dev)) { res = PTR_ERR(dev); goto out_chrdev; @@ -1187,5 +1153,4 @@ void scst_event_exit(void) destroy_workqueue(scst_event_wq); TRACE_EXIT(); - return; } |
From: Gleb C. <lna...@ya...> - 2025-09-23 09:49:30
|
Commit: c38b254 GitHub URL: https://github.com/SCST-project/scst/commit/c38b254c7a33c4654ef3fb1e062ce05c30cca876 Author: Gleb Chesnokov Date: 2025-09-23T12:49:00+03:00 Log Message: ----------- scst_mem: Fix multiple checkpatch warnings This patch does not change any functionality. Modified Paths: -------------- scst/src/scst_mem.c | 497 +++++++-------- 1 file changed, 219 insertions(+), 278 deletions(-) =================================================================== diff --git a/scst/src/scst_mem.c b/scst/src/scst_mem.c index 537b90c..a97ef84 100644 --- a/scst/src/scst_mem.c +++ b/scst/src/scst_mem.c @@ -116,7 +116,7 @@ void scst_sgv_pool_use_norm(struct scst_tgt_dev *tgt_dev) void scst_sgv_pool_use_norm_clust(struct scst_tgt_dev *tgt_dev) { - TRACE_MEM("%s", "Use clustering"); + TRACE_MEM("Use clustering"); tgt_dev->tgt_dev_gfp_mask = __GFP_NOWARN; if (!scst_force_global_sgv_pool) tgt_dev->pools = sgv_norm_clust_pool_per_cpu; @@ -127,7 +127,7 @@ void scst_sgv_pool_use_norm_clust(struct scst_tgt_dev *tgt_dev) void scst_sgv_pool_use_dma(struct scst_tgt_dev *tgt_dev) { - TRACE_MEM("%s", "Use ISA DMA memory"); + TRACE_MEM("Use ISA DMA memory"); tgt_dev->tgt_dev_gfp_mask = __GFP_NOWARN | GFP_DMA; if (!scst_force_global_sgv_pool) tgt_dev->pools = sgv_dma_pool_per_cpu; @@ -148,8 +148,7 @@ static void sgv_dtor_and_free(struct sgv_pool_obj *obj) obj->sg_count, obj->allocator_priv); } if (obj->sg_entries != obj->sg_entries_data) { - if (obj->trans_tbl != - (struct trans_tbl_ent *)obj->sg_entries_data) { + if (obj->trans_tbl != (struct trans_tbl_ent *)obj->sg_entries_data) { /* kfree() handles NULL parameter */ kfree(obj->trans_tbl); obj->trans_tbl = NULL; @@ -158,7 +157,6 @@ static void sgv_dtor_and_free(struct sgv_pool_obj *obj) } kmem_cache_free(pool->caches[obj->cache_num], obj); - return; } /* Must be called under sgv_pool_lock held */ @@ -175,7 +173,7 @@ static void __sgv_purge_from_cache(struct sgv_pool_obj *obj) struct sgv_pool *pool = obj->owner_pool; TRACE_MEM("Purging sgv obj %p from pool %p (new cached_entries %d)", - obj, pool, pool->cached_entries-1); + obj, pool, pool->cached_entries - 1); list_del(&obj->sorted_recycling_list_entry); list_del(&obj->recycling_list_entry); @@ -186,19 +184,16 @@ static void __sgv_purge_from_cache(struct sgv_pool_obj *obj) #ifndef CONFIG_SCST_NO_TOTAL_MEM_CHECKS atomic_sub(pages, &sgv_pages_total); #endif - - return; } /* Must be called under sgv_pool_lock held */ static bool sgv_purge_from_cache(struct sgv_pool_obj *obj, int min_interval, - unsigned long cur_time) + unsigned long cur_time) { EXTRACHECKS_BUG_ON(min_interval < 0); - TRACE_MEM("Checking if sgv obj %p should be purged (cur time %ld, " - "obj time %ld, time to purge %ld)", obj, cur_time, - obj->time_stamp, obj->time_stamp + min_interval); + TRACE_MEM("Checking if sgv obj %p should be purged (cur time %ld, obj time %ld, time to purge %ld)", + obj, cur_time, obj->time_stamp, obj->time_stamp + min_interval); if (time_after_eq(cur_time, (obj->time_stamp + min_interval))) { __sgv_purge_from_cache(obj); @@ -208,15 +203,15 @@ static bool sgv_purge_from_cache(struct sgv_pool_obj *obj, int min_interval, } /* No locks */ -static int sgv_shrink_pool(struct sgv_pool *pool, int nr, int min_interval, - unsigned long cur_time, int *out_freed) +static int sgv_shrink_pool(struct sgv_pool *pool, int nr, int min_interval, unsigned long cur_time, + int *out_freed) { int freed = 0; TRACE_ENTRY(); TRACE_MEM("Trying to shrink pool %p (nr %d, min_interval %d)", - pool, nr, min_interval); + pool, nr, min_interval); if (pool->purge_interval < 0) { TRACE_MEM("Not shrinkable pool %p, skipping", pool); @@ -231,9 +226,9 @@ static int sgv_shrink_pool(struct sgv_pool *pool, int nr, int min_interval, #else (atomic_read(&sgv_pages_total) > sgv_lo_wmk)) { #endif - struct sgv_pool_obj *obj = list_first_entry( - &pool->sorted_recycling_list, - struct sgv_pool_obj, sorted_recycling_list_entry); + struct sgv_pool_obj *obj = list_first_entry(&pool->sorted_recycling_list, + struct sgv_pool_obj, + sorted_recycling_list_entry); if (sgv_purge_from_cache(obj, min_interval, cur_time)) { int pages = obj->pages; @@ -241,19 +236,20 @@ static int sgv_shrink_pool(struct sgv_pool *pool, int nr, int min_interval, freed += pages; nr -= pages; - TRACE_MEM("%d pages purged from pool %p (nr left %d, " - "total freed %d)", pages, pool, nr, freed); + TRACE_MEM("%d pages purged from pool %p (nr left %d, total freed %d)", + pages, pool, nr, freed); spin_unlock_bh(&pool->sgv_pool_lock); sgv_dtor_and_free(obj); spin_lock_bh(&pool->sgv_pool_lock); - } else + } else { break; + } - if ((nr <= 0) || (freed >= MAX_PAGES_PER_POOL)) { + if (nr <= 0 || freed >= MAX_PAGES_PER_POOL) { if (freed >= MAX_PAGES_PER_POOL) - TRACE_MEM("%d pages purged from pool %p, " - "leaving", freed, pool); + TRACE_MEM("%d pages purged from pool %p, leaving", + freed, pool); break; } } @@ -276,8 +272,8 @@ static int __sgv_shrink(int nr, int min_interval, int *out_freed) TRACE_ENTRY(); - TRACE_MEM("Trying to shrink %d pages from all sgv pools " - "(min_interval %d)", nr, min_interval); + TRACE_MEM("Trying to shrink %d pages from all sgv pools (min_interval %d)", + nr, min_interval); while (prev_nr > nr && nr > 0) { prev_nr = nr; @@ -321,14 +317,12 @@ static unsigned long __sgv_can_be_shrunk(void) } #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 12, 0) -static unsigned long sgv_can_be_shrunk(struct shrinker *shrinker, - struct shrink_control *sc) +static unsigned long sgv_can_be_shrunk(struct shrinker *shrinker, struct shrink_control *sc) { return __sgv_can_be_shrunk(); } -static unsigned long sgv_scan_shrink(struct shrinker *shrinker, - struct shrink_control *sc) +static unsigned long sgv_scan_shrink(struct shrinker *shrinker, struct shrink_control *sc) { int freed = 0; @@ -351,8 +345,9 @@ static int sgv_shrink(struct shrinker *shrinker, struct shrink_control *sc) if (nr > 0) { nr = __sgv_shrink(nr, SGV_MIN_SHRINK_INTERVAL, &freed); TRACE_MEM("Left %d", nr); - } else + } else { nr = __sgv_can_be_shrunk(); + } TRACE_EXIT_RES(nr); return nr; @@ -374,9 +369,9 @@ static void sgv_purge_work_fn(struct work_struct *work) pool->purge_work_scheduled = false; while (!list_empty(&pool->sorted_recycling_list)) { - struct sgv_pool_obj *obj = list_first_entry( - &pool->sorted_recycling_list, - struct sgv_pool_obj, sorted_recycling_list_entry); + struct sgv_pool_obj *obj = list_first_entry(&pool->sorted_recycling_list, + struct sgv_pool_obj, + sorted_recycling_list_entry); if (sgv_purge_from_cache(obj, pool->purge_interval, cur_time)) { spin_unlock_bh(&pool->sgv_pool_lock); @@ -388,11 +383,9 @@ static void sgv_purge_work_fn(struct work_struct *work) * too often. In the worst case we have shrinker * to reclaim buffers more quickly. */ - TRACE_MEM("Rescheduling purge work for pool %p (delay " - "%d HZ/%d sec)", pool, pool->purge_interval, - pool->purge_interval/HZ); - schedule_delayed_work(&pool->sgv_purge_work, - pool->purge_interval); + TRACE_MEM("Rescheduling purge work for pool %p (delay %d HZ/%d sec)", + pool, pool->purge_interval, pool->purge_interval / HZ); + schedule_delayed_work(&pool->sgv_purge_work, pool->purge_interval); pool->purge_work_scheduled = true; break; } @@ -403,7 +396,6 @@ static void sgv_purge_work_fn(struct work_struct *work) TRACE_MEM("Leaving purge work for pool %p", pool); TRACE_EXIT(); - return; } static int sgv_check_full_clustering(struct scatterlist *sg, int cur, int hint) @@ -419,7 +411,7 @@ static int sgv_check_full_clustering(struct scatterlist *sg, int cur, int hint) #if 0 TRACE_MEM("pfn_cur %ld, pfn_cur_next %ld, len_cur %d, full_page_cur %d", - pfn_cur, pfn_cur_next, len_cur, full_page_cur); + pfn_cur, pfn_cur_next, len_cur, full_page_cur); #endif /* check the hint first */ @@ -428,10 +420,10 @@ static int sgv_check_full_clustering(struct scatterlist *sg, int cur, int hint) pfn_next = pfn + (sg[i].length >> PAGE_SHIFT); full_page = (sg[i].length & (PAGE_SIZE - 1)) == 0; - if ((pfn == pfn_cur_next) && full_page_cur) + if (pfn == pfn_cur_next && full_page_cur) goto out_head; - if ((pfn_next == pfn_cur) && full_page) + if (pfn_next == pfn_cur && full_page) goto out_tail; } @@ -441,10 +433,10 @@ static int sgv_check_full_clustering(struct scatterlist *sg, int cur, int hint) pfn_next = pfn + (sg[i].length >> PAGE_SHIFT); full_page = (sg[i].length & (PAGE_SIZE - 1)) == 0; - if ((pfn == pfn_cur_next) && full_page_cur) + if (pfn == pfn_cur_next && full_page_cur) goto out_head; - if ((pfn_next == pfn_cur) && full_page) + if (pfn_next == pfn_cur && full_page) goto out_tail; } @@ -478,27 +470,26 @@ static int sgv_check_tail_clustering(struct scatterlist *sg, int cur, int hint) #ifdef SCST_HIGHMEM if (page >= highmem_start_page) { - TRACE_MEM("%s", "HIGHMEM page allocated, no clustering") + TRACE_MEM("HIGHMEM page allocated, no clustering") goto out; } #endif #if 0 TRACE_MEM("pfn_cur %ld, pfn_cur_next %ld, len_cur %d, full_page_cur %d", - pfn_cur, pfn_cur_next, len_cur, full_page_cur); + pfn_cur, pfn_cur_next, len_cur, full_page_cur); #endif if (cur == 0) goto out; prev = cur - 1; - pfn_prev = page_to_pfn(sg_page(&sg[prev])) + - (sg[prev].length >> PAGE_SHIFT); + pfn_prev = page_to_pfn(sg_page(&sg[prev])) + (sg[prev].length >> PAGE_SHIFT); full_page = (sg[prev].length & (PAGE_SIZE - 1)) == 0; - if ((pfn_prev == pfn_cur) && full_page) { + if (pfn_prev == pfn_cur && full_page) { TRACE_MEM("SG segment %d will be tail merged with segment %d", - cur, prev); + cur, prev); sg[prev].length += len_cur; sg_clear(&sg[cur]); res = prev; @@ -508,8 +499,7 @@ out: return res; } -static void sgv_free_sys_sg_entries(struct scatterlist *sg, int sg_count, - void *priv) +static void sgv_free_sys_sg_entries(struct scatterlist *sg, int sg_count, void *priv) { int i; @@ -521,13 +511,13 @@ static void sgv_free_sys_sg_entries(struct scatterlist *sg, int sg_count, int pages = PAGE_ALIGN(len) >> PAGE_SHIFT; TRACE_MEM("page %lx, len %d, pages %d", - (unsigned long)p, len, pages); + (unsigned long)p, len, pages); while (pages > 0) { int order = 0; TRACE_MEM("free_pages(): order %d, page %lx", - order, (unsigned long)p); + order, (unsigned long)p); __free_pages(p, order); @@ -537,24 +527,22 @@ static void sgv_free_sys_sg_entries(struct scatterlist *sg, int sg_count, } } -static struct page *sgv_alloc_sys_pages(struct scatterlist *sg, - gfp_t gfp_mask, void *priv) +static struct page *sgv_alloc_sys_pages(struct scatterlist *sg, gfp_t gfp_mask, void *priv) { struct page *page = alloc_pages(gfp_mask, 0); sg_set_page(sg, page, PAGE_SIZE, 0); TRACE_MEM("page=%p, sg=%p, priv=%p", page, sg, priv); - if (page == NULL) { - TRACE(TRACE_OUT_OF_MEM, "%s", "Allocation of " - "sg page failed"); - } + if (!page) + TRACE(TRACE_OUT_OF_MEM, "Allocation of sg page failed"); + return page; } -static int sgv_alloc_sg_entries(struct scatterlist *sg, int pages, - gfp_t gfp_mask, enum sgv_clustering_types clustering_type, - struct trans_tbl_ent *trans_tbl, - const struct sgv_pool_alloc_fns *alloc_fns, void *priv) +static int sgv_alloc_sg_entries(struct scatterlist *sg, int pages, gfp_t gfp_mask, + enum sgv_clustering_types clustering_type, + struct trans_tbl_ent *trans_tbl, + const struct sgv_pool_alloc_fns *alloc_fns, void *priv) { int sg_count = 0; int pg, i, j; @@ -570,16 +558,16 @@ static int sgv_alloc_sg_entries(struct scatterlist *sg, int pages, #endif for (pg = 0; pg < pages; pg++) { - void *rc; + void *ret; + #ifdef CONFIG_SCST_DEBUG_OOM if (((gfp_mask & __GFP_NOFAIL) != __GFP_NOFAIL) && ((scst_random() % 10000) == 55)) - rc = NULL; + ret = NULL; else #endif - rc = alloc_fns->alloc_pages_fn(&sg[sg_count], gfp_mask, - priv); - if (rc == NULL) + ret = alloc_fns->alloc_pages_fn(&sg[sg_count], gfp_mask, priv); + if (!ret) goto out_no_mem; /* @@ -598,20 +586,20 @@ static int sgv_alloc_sg_entries(struct scatterlist *sg, int pages, if (merged == -1) sg_count++; - TRACE_MEM("pg=%d, merged=%d, sg_count=%d", pg, merged, - sg_count); + TRACE_MEM("pg=%d, merged=%d, sg_count=%d", + pg, merged, sg_count); } - if ((clustering_type != sgv_no_clustering) && (trans_tbl != NULL)) { + if (clustering_type != sgv_no_clustering && trans_tbl) { pg = 0; for (i = 0; i < pages; i++) { int n = PAGE_ALIGN(sg[i].length) >> PAGE_SHIFT; trans_tbl[i].pg_count = pg; for (j = 0; j < n; j++) - trans_tbl[pg++].sg_num = i+1; - TRACE_MEM("i=%d, n=%d, pg_count=%d", i, n, - trans_tbl[i].pg_count); + trans_tbl[pg++].sg_num = i + 1; + TRACE_MEM("i=%d, n=%d, pg_count=%d", + i, n, trans_tbl[i].pg_count); } } @@ -625,8 +613,7 @@ out_no_mem: goto out; } -static int sgv_alloc_arrays(struct sgv_pool_obj *obj, - int pages_to_alloc, gfp_t gfp_mask) +static int sgv_alloc_arrays(struct sgv_pool_obj *obj, int pages_to_alloc, gfp_t gfp_mask) { int sz, tsz = 0; int res = 0; @@ -636,9 +623,9 @@ static int sgv_alloc_arrays(struct sgv_pool_obj *obj, sz = pages_to_alloc * sizeof(obj->sg_entries[0]); obj->sg_entries = kmalloc(sz, gfp_mask); - if (unlikely(obj->sg_entries == NULL)) { - TRACE(TRACE_OUT_OF_MEM, "Allocation of sgv_pool_obj " - "SG vector failed (size %d)", sz); + if (unlikely(!obj->sg_entries)) { + TRACE(TRACE_OUT_OF_MEM, + "Allocation of sgv_pool_obj SG vector failed (size %d)", sz); res = -ENOMEM; goto out; } @@ -647,8 +634,7 @@ static int sgv_alloc_arrays(struct sgv_pool_obj *obj, if (sgv_pool_clustered(obj->owner_pool)) { if (pages_to_alloc <= sgv_max_trans_pages) { - obj->trans_tbl = - (struct trans_tbl_ent *)obj->sg_entries_data; + obj->trans_tbl = (struct trans_tbl_ent *)obj->sg_entries_data; /* * No need to clear trans_tbl, if needed, it will be * fully rewritten in sgv_alloc_sg_entries() @@ -656,18 +642,17 @@ static int sgv_alloc_arrays(struct sgv_pool_obj *obj, } else { tsz = pages_to_alloc * sizeof(obj->trans_tbl[0]); obj->trans_tbl = kzalloc(tsz, gfp_mask); - if (unlikely(obj->trans_tbl == NULL)) { - TRACE(TRACE_OUT_OF_MEM, "Allocation of " - "trans_tbl failed (size %d)", tsz); + if (unlikely(!obj->trans_tbl)) { + TRACE(TRACE_OUT_OF_MEM, + "Allocation of trans_tbl failed (size %d)", tsz); res = -ENOMEM; goto out_free; } } } - TRACE_MEM("pages_to_alloc %d, sz %d, tsz %d, obj %p, sg_entries %p, " - "trans_tbl %p", pages_to_alloc, sz, tsz, obj, obj->sg_entries, - obj->trans_tbl); + TRACE_MEM("pages_to_alloc %d, sz %d, tsz %d, obj %p, sg_entries %p, trans_tbl %p", + pages_to_alloc, sz, tsz, obj, obj->sg_entries, obj->trans_tbl); out: TRACE_EXIT_RES(res); @@ -679,8 +664,8 @@ out_free: goto out; } -static struct sgv_pool_obj *sgv_get_obj(struct sgv_pool *pool, int cache_num, - int pages, gfp_t gfp_mask, bool get_new) +static struct sgv_pool_obj *sgv_get_obj(struct sgv_pool *pool, int cache_num, int pages, + gfp_t gfp_mask, bool get_new) { struct sgv_pool_obj *obj; @@ -693,7 +678,7 @@ static struct sgv_pool_obj *sgv_get_obj(struct sgv_pool *pool, int cache_num, if (likely(!list_empty(&pool->recycling_lists[cache_num]))) { obj = list_first_entry(&pool->recycling_lists[cache_num], - struct sgv_pool_obj, recycling_list_entry); + struct sgv_pool_obj, recycling_list_entry); list_del(&obj->sorted_recycling_list_entry); list_del(&obj->recycling_list_entry); @@ -710,11 +695,10 @@ get_new: spin_unlock_bh(&pool->sgv_pool_lock); - TRACE_MEM("New cached entries %d (pool %p)", pool->cached_entries, - pool); + TRACE_MEM("New cached entries %d (pool %p)", + pool->cached_entries, pool); - obj = kmem_cache_alloc(pool->caches[cache_num], - gfp_mask & ~(__GFP_HIGHMEM|GFP_DMA)); + obj = kmem_cache_alloc(pool->caches[cache_num], gfp_mask & ~(__GFP_HIGHMEM | GFP_DMA)); if (likely(obj)) { memset(obj, 0, sizeof(*obj)); obj->cache_num = cache_num; @@ -739,30 +723,30 @@ static void sgv_put_obj(struct sgv_pool_obj *obj) spin_lock_bh(&pool->sgv_pool_lock); - TRACE_MEM("sgv %p, cache num %d, pages %d, sg_count %d", obj, - obj->cache_num, pages, obj->sg_count); + TRACE_MEM("sgv %p, cache num %d, pages %d, sg_count %d", + obj, obj->cache_num, pages, obj->sg_count); if (sgv_pool_clustered(pool)) { /* Make objects with less entries more preferred */ __list_for_each(entry, list) { - struct sgv_pool_obj *tmp = list_entry(entry, - struct sgv_pool_obj, recycling_list_entry); + struct sgv_pool_obj *tmp = list_entry(entry, struct sgv_pool_obj, + recycling_list_entry); TRACE_MEM("tmp %p, cache num %d, pages %d, sg_count %d", - tmp, tmp->cache_num, tmp->pages, tmp->sg_count); + tmp, tmp->cache_num, tmp->pages, tmp->sg_count); if (obj->sg_count <= tmp->sg_count) break; } entry = entry->prev; - } else + } else { entry = list; + } TRACE_MEM("Adding in %p (list %p)", entry, list); list_add(&obj->recycling_list_entry, entry); - list_add_tail(&obj->sorted_recycling_list_entry, - &pool->sorted_recycling_list); + list_add_tail(&obj->sorted_recycling_list_entry, &pool->sorted_recycling_list); obj->time_stamp = jiffies; @@ -771,12 +755,10 @@ static void sgv_put_obj(struct sgv_pool_obj *obj) if (!pool->purge_work_scheduled) { TRACE_MEM("Scheduling purge work for pool %p", pool); pool->purge_work_scheduled = true; - schedule_delayed_work(&pool->sgv_purge_work, - pool->purge_interval); + schedule_delayed_work(&pool->sgv_purge_work, pool->purge_interval); } spin_unlock_bh(&pool->sgv_pool_lock); - return; } /* No locks */ @@ -796,13 +778,9 @@ static int sgv_hiwmk_check(int pages_to_alloc) pages = __sgv_shrink(pages, 0, &freed); if (pages > 0) { - TRACE(TRACE_OUT_OF_MEM, "Requested amount of " - "memory (%d pages) for being executed " - "commands together with the already " - "allocated memory exceeds the allowed " - "maximum %d. Should you increase " - "scst_max_cmd_mem?", pages_to_alloc, - sgv_hi_wmk); + TRACE(TRACE_OUT_OF_MEM, + "Requested amount of memory (%d pages) for being executed commands together with the already allocated memory exceeds the allowed maximum %d. Should you increase scst_max_cmd_mem?", + pages_to_alloc, sgv_hi_wmk); atomic_inc(&sgv_releases_on_hiwmk_failed); res = -ENOMEM; goto out_unlock; @@ -812,8 +790,8 @@ static int sgv_hiwmk_check(int pages_to_alloc) atomic_add(pages_to_alloc, &sgv_pages_total); out_unlock: - TRACE_MEM("pages_to_alloc %d, new total %d", pages_to_alloc, - atomic_read(&sgv_pages_total)); + TRACE_MEM("pages_to_alloc %d, new total %d", + pages_to_alloc, atomic_read(&sgv_pages_total)); #endif return res; } @@ -823,10 +801,9 @@ static void sgv_hiwmk_uncheck(int pages) { #ifndef CONFIG_SCST_NO_TOTAL_MEM_CHECKS atomic_sub(pages, &sgv_pages_total); - TRACE_MEM("pages %d, new total %d", pages, - atomic_read(&sgv_pages_total)); + TRACE_MEM("pages %d, new total %d", + pages, atomic_read(&sgv_pages_total)); #endif - return; } /* No locks */ @@ -837,18 +814,15 @@ static bool sgv_check_allowed_mem(struct scst_mem_lim *mem_lim, int pages) alloced = atomic_add_return(pages, &mem_lim->alloced_pages); if (unlikely(alloced > mem_lim->max_allowed_pages)) { - TRACE(TRACE_OUT_OF_MEM, "Requested amount of memory " - "(%d pages) for being executed commands on a device " - "together with the already allocated memory exceeds " - "the allowed maximum %d. Should you increase " - "scst_max_dev_cmd_mem?", pages, - mem_lim->max_allowed_pages); + TRACE(TRACE_OUT_OF_MEM, + "Requested amount of memory (%d pages) for being executed commands on a device together with the already allocated memory exceeds the allowed maximum %d. Should you increase scst_max_dev_cmd_mem?", + pages, mem_lim->max_allowed_pages); atomic_sub(pages, &mem_lim->alloced_pages); res = false; } - TRACE_MEM("mem_lim %p, pages %d, res %d, new alloced %d", mem_lim, - pages, res, atomic_read(&mem_lim->alloced_pages)); + TRACE_MEM("mem_lim %p, pages %d, res %d, new alloced %d", + mem_lim, pages, res, atomic_read(&mem_lim->alloced_pages)); return res; } @@ -858,9 +832,8 @@ static void sgv_uncheck_allowed_mem(struct scst_mem_lim *mem_lim, int pages) { atomic_sub(pages, &mem_lim->alloced_pages); - TRACE_MEM("mem_lim %p, pages %d, new alloced %d", mem_lim, - pages, atomic_read(&mem_lim->alloced_pages)); - return; + TRACE_MEM("mem_lim %p, pages %d, new alloced %d", + mem_lim, pages, atomic_read(&mem_lim->alloced_pages)); } /** @@ -878,9 +851,9 @@ static void sgv_uncheck_allowed_mem(struct scst_mem_lim *mem_lim, int pages) * Allocate an SG vector from the SGV pool and returns pointer to it or * NULL in case of any error. See the SGV pool documentation for more details. */ -struct scatterlist *sgv_pool_alloc(struct sgv_pool *pool, unsigned int size, - gfp_t gfp_mask, int flags, int *count, - struct sgv_pool_obj **sgv, struct scst_mem_lim *mem_lim, void *priv) +struct scatterlist *sgv_pool_alloc(struct sgv_pool *pool, unsigned int size, gfp_t gfp_mask, + int flags, int *count, struct sgv_pool_obj **sgv, + struct scst_mem_lim *mem_lim, void *priv) { struct sgv_pool_obj *obj; int cache_num, pages, cnt; @@ -907,11 +880,10 @@ struct scatterlist *sgv_pool_alloc(struct sgv_pool *pool, unsigned int size, pages_to_alloc = max(pool->single_alloc_pages, pages); } - TRACE_MEM("size=%d, pages=%d, pages_to_alloc=%d, cache num=%d, " - "flags=%x, no_cached=%d, *sgv=%p", size, pages, - pages_to_alloc, cache_num, flags, no_cached, *sgv); + TRACE_MEM("size=%d, pages=%d, pages_to_alloc=%d, cache num=%d, flags=%x, no_cached=%d, *sgv=%p", + size, pages, pages_to_alloc, cache_num, flags, no_cached, *sgv); - if (*sgv != NULL) { + if (*sgv) { obj = *sgv; TRACE_MEM("Supplied obj %p, cache num %d", obj, obj->cache_num); @@ -931,10 +903,10 @@ struct scatterlist *sgv_pool_alloc(struct sgv_pool *pool, unsigned int size, allowed_mem_checked = true; obj = sgv_get_obj(pool, cache_num, pages_to_alloc, gfp_mask, - flags & SGV_POOL_ALLOC_GET_NEW); - if (unlikely(obj == NULL)) { - TRACE(TRACE_OUT_OF_MEM, "Allocation of " - "sgv_pool_obj failed (size %d)", size); + flags & SGV_POOL_ALLOC_GET_NEW); + if (unlikely(!obj)) { + TRACE(TRACE_OUT_OF_MEM, + "Allocation of sgv_pool_obj failed (size %d)", size); goto out_fail; } @@ -962,8 +934,8 @@ struct scatterlist *sgv_pool_alloc(struct sgv_pool *pool, unsigned int size, sg_init_table(obj->sg_entries, pages_to_alloc); TRACE_MEM("sg_entries %p", obj->sg_entries); if (sgv_pool_clustered(pool)) { - obj->trans_tbl = (struct trans_tbl_ent *) - (obj->sg_entries + pages_to_alloc); + obj->trans_tbl = + (struct trans_tbl_ent *)(obj->sg_entries + pages_to_alloc); TRACE_MEM("trans_tbl %p", obj->trans_tbl); /* * No need to clear trans_tbl, if needed, it @@ -972,8 +944,7 @@ struct scatterlist *sgv_pool_alloc(struct sgv_pool *pool, unsigned int size, */ } } else { - if (unlikely(sgv_alloc_arrays(obj, pages_to_alloc, - gfp_mask) != 0)) + if (unlikely(sgv_alloc_arrays(obj, pages_to_alloc, gfp_mask) != 0)) goto out_fail_free; } @@ -1001,9 +972,9 @@ struct scatterlist *sgv_pool_alloc(struct sgv_pool *pool, unsigned int size, sz = sizeof(*obj) + pages * sizeof(obj->sg_entries[0]); obj = kmalloc(sz, gfp_mask); - if (unlikely(obj == NULL)) { - TRACE(TRACE_OUT_OF_MEM, "Allocation of " - "sgv_pool_obj failed (size %d)", size); + if (unlikely(!obj)) { + TRACE(TRACE_OUT_OF_MEM, + "Allocation of sgv_pool_obj failed (size %d)", size); goto out_fail; } memset(obj, 0, sizeof(*obj)); @@ -1024,32 +995,26 @@ struct scatterlist *sgv_pool_alloc(struct sgv_pool *pool, unsigned int size, TRACE_MEM("Big or no_cached obj %p (size %d)", obj, sz); } - obj->sg_count = sgv_alloc_sg_entries(obj->sg_entries, - pages_to_alloc, gfp_mask, pool->clustering_type, - obj->trans_tbl, &pool->alloc_fns, priv); + obj->sg_count = sgv_alloc_sg_entries(obj->sg_entries, pages_to_alloc, gfp_mask, + pool->clustering_type, obj->trans_tbl, + &pool->alloc_fns, priv); if (unlikely(obj->sg_count <= 0)) { obj->sg_count = 0; - if ((flags & SGV_POOL_RETURN_OBJ_ON_ALLOC_FAIL) && - (cache_num >= 0)) + if ((flags & SGV_POOL_RETURN_OBJ_ON_ALLOC_FAIL) && cache_num >= 0) goto out_return1; else goto out_fail_free_sg_entries; } if (cache_num >= 0) { - atomic_add(pages_to_alloc - obj->sg_count, - &pool->cache_acc[cache_num].merged); + atomic_add(pages_to_alloc - obj->sg_count, &pool->cache_acc[cache_num].merged); } else { if (no_cached) { - atomic_add(pages_to_alloc, - &pool->other_pages); - atomic_add(pages_to_alloc - obj->sg_count, - &pool->other_merged); + atomic_add(pages_to_alloc, &pool->other_pages); + atomic_add(pages_to_alloc - obj->sg_count, &pool->other_merged); } else { - atomic_add(pages_to_alloc, - &pool->big_pages); - atomic_add(pages_to_alloc - obj->sg_count, - &pool->big_merged); + atomic_add(pages_to_alloc, &pool->big_pages); + atomic_add(pages_to_alloc - obj->sg_count, &pool->big_merged); } } @@ -1059,10 +1024,10 @@ success: atomic_inc(&pool->cache_acc[cache_num].total_alloc); if (sgv_pool_clustered(pool)) - cnt = obj->trans_tbl[pages-1].sg_num; + cnt = obj->trans_tbl[pages - 1].sg_num; else cnt = pages; - sg = cnt-1; + sg = cnt - 1; obj->orig_sg = sg; obj->orig_length = obj->sg_entries[sg].length; if (sgv_pool_clustered(pool)) { @@ -1081,12 +1046,12 @@ success: res = obj->sg_entries; *sgv = obj; - obj->sg_entries[cnt-1].length -= PAGE_ALIGN(size) - size; - sg_mark_end(&obj->sg_entries[cnt-1]); + obj->sg_entries[cnt - 1].length -= PAGE_ALIGN(size) - size; + sg_mark_end(&obj->sg_entries[cnt - 1]); - TRACE_MEM("obj=%p, sg_entries %p (size=%d, pages=%d, sg_count=%d, " - "count=%d, last_len=%d)", obj, obj->sg_entries, size, pages, - obj->sg_count, *count, obj->sg_entries[obj->orig_sg].length); + TRACE_MEM("obj=%p, sg_entries %p (size=%d, pages=%d, sg_count=%d, count=%d, last_len=%d)", + obj, obj->sg_entries, size, pages, obj->sg_count, *count, + obj->sg_entries[obj->orig_sg].length); out: TRACE_EXIT_HRES(res); @@ -1107,8 +1072,7 @@ out_return2: out_fail_free_sg_entries: if (obj->sg_entries != obj->sg_entries_data) { - if (obj->trans_tbl != - (struct trans_tbl_ent *)obj->sg_entries_data) { + if (obj->trans_tbl != (struct trans_tbl_ent *)obj->sg_entries_data) { /* kfree() handles NULL parameter */ kfree(obj->trans_tbl); obj->trans_tbl = NULL; @@ -1124,14 +1088,15 @@ out_fail_free: spin_unlock_bh(&pool->sgv_pool_lock); kmem_cache_free(pool->caches[obj->cache_num], obj); - } else + } else { kfree(obj); + } out_fail: res = NULL; *count = 0; *sgv = NULL; - TRACE_MEM("%s", "Allocation failed"); + TRACE_MEM("Allocation failed"); out_uncheck: if (hiwmk_checked) @@ -1166,9 +1131,8 @@ void sgv_pool_free(struct sgv_pool_obj *obj, struct scst_mem_lim *mem_lim) { int pages = (obj->sg_count != 0) ? obj->pages : 0; - TRACE_MEM("Freeing obj %p, cache num %d, pages %d, sg_entries %p, " - "sg_count %d, allocator_priv %p", obj, obj->cache_num, pages, - obj->sg_entries, obj->sg_count, obj->allocator_priv); + TRACE_MEM("Freeing obj %p, cache num %d, pages %d, sg_entries %p, sg_count %d, allocator_priv %p", + obj, obj->cache_num, pages, obj->sg_entries, obj->sg_count, obj->allocator_priv); /* * Enable it if you are investigating a data corruption and want to make @@ -1193,10 +1157,8 @@ void sgv_pool_free(struct sgv_pool_obj *obj, struct scst_mem_lim *mem_lim) while (pages > 0) { if (page_count(p) != 1) { - PRINT_WARNING("Freeing page %p with " - "additional owners (_count %d). " - "Data corruption possible!", - p, page_count(p)); + PRINT_WARNING("Freeing page %p with additional owners (_count %d). Data corruption possible!", + p, page_count(p)); WARN_ON(1); } pages--; @@ -1211,14 +1173,13 @@ void sgv_pool_free(struct sgv_pool_obj *obj, struct scst_mem_lim *mem_lim) sg_unmark_end(&obj->sg_entries[obj->orig_sg]); sgv_put_obj(obj); } else { - obj->owner_pool->alloc_fns.free_pages_fn(obj->sg_entries, - obj->sg_count, obj->allocator_priv); + obj->owner_pool->alloc_fns.free_pages_fn(obj->sg_entries, obj->sg_count, + obj->allocator_priv); kfree(obj); sgv_hiwmk_uncheck(pages); } sgv_uncheck_allowed_mem(mem_lim, pages); - return; } EXPORT_SYMBOL_GPL(sgv_pool_free); @@ -1265,9 +1226,9 @@ struct scatterlist *scst_alloc_sg(int size, gfp_t gfp_mask, int *count) } res = kmalloc_array(pages, sizeof(*res), gfp_mask); - if (res == NULL) { - TRACE(TRACE_OUT_OF_MEM, "Unable to allocate sg for %d pages", - pages); + if (!res) { + TRACE(TRACE_OUT_OF_MEM, + "Unable to allocate sg for %d pages", pages); goto out_uncheck; } @@ -1278,12 +1239,12 @@ struct scatterlist *scst_alloc_sg(int size, gfp_t gfp_mask, int *count) * scst_free_sg() to figure out how many pages are in the SG vector. * So, let's always don't use clustering. */ - cnt = sgv_alloc_sg_entries(res, pages, gfp_mask, sgv_no_clustering, - NULL, &sys_alloc_fns, NULL); + cnt = sgv_alloc_sg_entries(res, pages, gfp_mask, sgv_no_clustering, NULL, &sys_alloc_fns, + NULL); if (cnt <= 0) goto out_free; - res[cnt-1].length -= PAGE_ALIGN(size) - size; + res[cnt - 1].length -= PAGE_ALIGN(size) - size; *count = cnt; @@ -1317,13 +1278,11 @@ void scst_free_sg(struct scatterlist *sg, int count) sgv_free_sys_sg_entries(sg, count, NULL); kfree(sg); - return; } EXPORT_SYMBOL_GPL(scst_free_sg); /* Must be called under sgv_pools_mutex */ -static void sgv_pool_init_cache(struct sgv_pool *pool, int cache_num, - bool per_cpu) +static void sgv_pool_init_cache(struct sgv_pool *pool, int cache_num, bool per_cpu) { int size; int pages; @@ -1339,18 +1298,17 @@ static void sgv_pool_init_cache(struct sgv_pool *pool, int cache_num, pages = pool->single_alloc_pages; if (pages <= sgv_max_local_pages) { - size = sizeof(*obj) + pages * - (sizeof(obj->sg_entries[0]) + - ((pool->clustering_type != sgv_no_clustering) ? - sizeof(obj->trans_tbl[0]) : 0)); + size = sizeof(*obj) + pages * (sizeof(obj->sg_entries[0]) + + ((pool->clustering_type != sgv_no_clustering) ? + sizeof(obj->trans_tbl[0]) : 0)); } else if (pages <= sgv_max_trans_pages) { /* * sg_entries is allocated outside object, * but trans_tbl is still embedded. */ size = sizeof(*obj) + pages * - (((pool->clustering_type != sgv_no_clustering) ? - sizeof(obj->trans_tbl[0]) : 0)); + ((pool->clustering_type != sgv_no_clustering) ? + sizeof(obj->trans_tbl[0]) : 0); } else { size = sizeof(*obj); /* both sgv and trans_tbl are kmalloc'ed() */ @@ -1358,20 +1316,17 @@ static void sgv_pool_init_cache(struct sgv_pool *pool, int cache_num, TRACE_MEM("pages=%d, size=%d (per cpu %d)", pages, size, per_cpu); - scnprintf(pool->cache_names[cache_num], - sizeof(pool->cache_names[cache_num]), - "%s-%uK", pool->name, (pages << PAGE_SHIFT) >> 10); - pool->caches[cache_num] = kmem_cache_create( - pool->cache_names[cache_num], size, - 0, per_cpu ? SCST_SLAB_FLAGS : - (SCST_SLAB_FLAGS|SLAB_HWCACHE_ALIGN), NULL); - return; + scnprintf(pool->cache_names[cache_num], sizeof(pool->cache_names[cache_num]), + "%s-%uK", pool->name, (pages << PAGE_SHIFT) >> 10); + pool->caches[cache_num] = kmem_cache_create(pool->cache_names[cache_num], size, 0, + per_cpu ? SCST_SLAB_FLAGS : + (SCST_SLAB_FLAGS | SLAB_HWCACHE_ALIGN), NULL); } /* Must be called under sgv_pools_mutex */ static int sgv_pool_init(struct sgv_pool *pool, const char *name, - enum sgv_clustering_types clustering_type, int single_alloc_pages, - int purge_interval, bool per_cpu) + enum sgv_clustering_types clustering_type, int single_alloc_pages, + int purge_interval, bool per_cpu) { int res = -ENOMEM; int i; @@ -1380,7 +1335,7 @@ static int sgv_pool_init(struct sgv_pool *pool, const char *name, if (single_alloc_pages < 0) { PRINT_ERROR("Wrong single_alloc_pages value %d", - single_alloc_pages); + single_alloc_pages); res = -EINVAL; goto out; } @@ -1402,8 +1357,9 @@ static int sgv_pool_init(struct sgv_pool *pool, const char *name, /* Let's pretend that it's always scheduled */ pool->purge_work_scheduled = 1; } - } else + } else { pool->purge_interval = SGV_DEFAULT_PURGE_INTERVAL; + } if (single_alloc_pages == 0) { pool->max_caches = SGV_POOL_ELEMENTS; pool->max_cached_pages = 1 << (SGV_POOL_ELEMENTS - 1); @@ -1414,20 +1370,18 @@ static int sgv_pool_init(struct sgv_pool *pool, const char *name, pool->alloc_fns.alloc_pages_fn = sgv_alloc_sys_pages; pool->alloc_fns.free_pages_fn = sgv_free_sys_sg_entries; - TRACE_MEM("name %s, sizeof(*obj)=%zd, clustering_type=%d, " - "single_alloc_pages=%d, max_caches=%d, max_cached_pages=%d", - name, sizeof(struct sgv_pool_obj), clustering_type, - single_alloc_pages, pool->max_caches, pool->max_cached_pages); + TRACE_MEM("name %s, sizeof(*obj)=%zd, clustering_type=%d, single_alloc_pages=%d, max_caches=%d, max_cached_pages=%d", + name, sizeof(struct sgv_pool_obj), clustering_type, single_alloc_pages, + pool->max_caches, pool->max_cached_pages); - strscpy(pool->name, name, sizeof(pool->name)-1); + strscpy(pool->name, name, sizeof(pool->name) - 1); pool->owner_mm = current->mm; for (i = 0; i < pool->max_caches; i++) { sgv_pool_init_cache(pool, i, per_cpu); - if (pool->caches[i] == NULL) { - PRINT_ERROR("Allocation of sgv_pool " - "cache %s(%d) failed", name, i); + if (!pool->caches[i]) { + PRINT_ERROR("Allocation of sgv_pool cache %s(%d) failed", name, i); goto out_free; } } @@ -1479,8 +1433,7 @@ static void sgv_evaluate_local_max_pages(void) sgv_max_trans_pages = space4sgv_ttbl / sizeof(struct trans_tbl_ent); TRACE_MEM("sgv_max_local_pages %d, sgv_max_trans_pages %d", - sgv_max_local_pages, sgv_max_trans_pages); - return; + sgv_max_local_pages, sgv_max_trans_pages); } /* @@ -1500,8 +1453,8 @@ void sgv_pool_flush(struct sgv_pool *pool) spin_lock_bh(&pool->sgv_pool_lock); while (!list_empty(&pool->recycling_lists[i])) { - obj = list_first_entry(&pool->recycling_lists[i], - struct sgv_pool_obj, recycling_list_entry); + obj = list_first_entry(&pool->recycling_lists[i], struct sgv_pool_obj, + recycling_list_entry); __sgv_purge_from_cache(obj); @@ -1516,7 +1469,6 @@ void sgv_pool_flush(struct sgv_pool *pool) } TRACE_EXIT(); - return; } EXPORT_SYMBOL_GPL(sgv_pool_flush); @@ -1552,7 +1504,6 @@ static void sgv_pool_destroy(struct sgv_pool *pool) out: TRACE_EXIT(); - return; } /** @@ -1566,12 +1517,11 @@ out: * See the SGV pool documentation for more details. */ void sgv_pool_set_allocator(struct sgv_pool *pool, - struct page *(*alloc_pages_fn)(struct scatterlist *, gfp_t, void *), - void (*free_pages_fn)(struct scatterlist *, int, void *)) + struct page *(*alloc_pages_fn)(struct scatterlist *, gfp_t, void *), + void (*free_pages_fn)(struct scatterlist *, int, void *)) { pool->alloc_fns.alloc_pages_fn = alloc_pages_fn; pool->alloc_fns.free_pages_fn = free_pages_fn; - return; } EXPORT_SYMBOL_GPL(sgv_pool_set_allocator); @@ -1601,19 +1551,17 @@ EXPORT_SYMBOL_GPL(sgv_pool_set_allocator); * Description: * Returns the resulting SGV pool or NULL in case of any error. */ -struct sgv_pool *sgv_pool_create_node(const char *name, - enum sgv_clustering_types clustering_type, - int single_alloc_pages, bool shared, int purge_interval, int nodeid) +struct sgv_pool *sgv_pool_create_node(const char *name, enum sgv_clustering_types clustering_type, + int single_alloc_pages, bool shared, int purge_interval, + int nodeid) { struct sgv_pool *pool, *tp; int rc; TRACE_ENTRY(); - TRACE_MEM("Creating pool %s (clustering_type %d, " - "single_alloc_pages %d, shared %d, purge_interval %d, " - "nodeid %d)", name, clustering_type, single_alloc_pages, - shared, purge_interval, nodeid); + TRACE_MEM("Creating pool %s (clustering_type %d, single_alloc_pages %d, shared %d, purge_interval %d, nodeid %d)", + name, clustering_type, single_alloc_pages, shared, purge_interval, nodeid); /* * __sgv_shrink() takes sgv_pools_mutex, so we have to play tricks to @@ -1621,9 +1569,9 @@ struct sgv_pool *sgv_pool_create_node(const char *name, */ pool = kmem_cache_alloc_node(sgv_pool_cachep, GFP_KERNEL, nodeid); - if (pool == NULL) { + if (!pool) { PRINT_ERROR("Allocation of sgv_pool failed (size %zd)", - sizeof(*pool)); + sizeof(*pool)); goto out; } memset(pool, 0, sizeof(*pool)); @@ -1634,9 +1582,8 @@ struct sgv_pool *sgv_pool_create_node(const char *name, if (strcmp(tp->name, name) == 0) { if (shared) { if (tp->owner_mm != current->mm) { - PRINT_ERROR("Attempt of a shared use " - "of SGV pool %s with " - "different MM", name); + PRINT_ERROR("Attempt of a shared use of SGV pool %s with different MM", + name); goto out_free; } sgv_pool_get(tp); @@ -1650,8 +1597,8 @@ struct sgv_pool *sgv_pool_create_node(const char *name, } tp = NULL; - rc = sgv_pool_init(pool, name, clustering_type, single_alloc_pages, - purge_interval, nodeid != NUMA_NO_NODE); + rc = sgv_pool_init(pool, name, clustering_type, single_alloc_pages, purge_interval, + nodeid != NUMA_NO_NODE); if (rc != 0) goto out_free; @@ -1659,7 +1606,7 @@ out_unlock: mutex_unlock(&sgv_pools_mutex); out: - TRACE_EXIT_RES(pool != NULL); + TRACE_EXIT_HRES(pool); return pool; out_free: @@ -1678,8 +1625,7 @@ void sgv_pool_get(struct sgv_pool *pool) { atomic_inc(&pool->sgv_pool_ref); TRACE_MEM("Incrementing sgv pool %p ref (new value %d)", - pool, atomic_read(&pool->sgv_pool_ref)); - return; + pool, atomic_read(&pool->sgv_pool_ref)); } EXPORT_SYMBOL_GPL(sgv_pool_get); @@ -1692,10 +1638,9 @@ EXPORT_SYMBOL_GPL(sgv_pool_get); void sgv_pool_put(struct sgv_pool *pool) { TRACE_MEM("Decrementing sgv pool %p ref (new value %d)", - pool, atomic_read(&pool->sgv_pool_ref)-1); + pool, atomic_read(&pool->sgv_pool_ref) - 1); if (atomic_dec_and_test(&pool->sgv_pool_ref)) sgv_pool_destroy(pool); - return; } EXPORT_SYMBOL_GPL(sgv_pool_put); @@ -1714,7 +1659,6 @@ void sgv_pool_del(struct sgv_pool *pool) sgv_pool_put(pool); TRACE_EXIT(); - return; } EXPORT_SYMBOL_GPL(sgv_pool_del); @@ -1760,8 +1704,8 @@ int __init scst_sgv_pools_init(unsigned long mem_hwmark, unsigned long mem_lwmar TRACE_ENTRY(); - sgv_pool_cachep = KMEM_CACHE(sgv_pool, SCST_SLAB_FLAGS|SLAB_HWCACHE_ALIGN); - if (sgv_pool_cachep == NULL) + sgv_pool_cachep = KMEM_CACHE(sgv_pool, SCST_SLAB_FLAGS | SLAB_HWCACHE_ALIGN); + if (!sgv_pool_cachep) goto out_err; sgv_hi_wmk = mem_hwmark; @@ -1770,17 +1714,15 @@ int __init scst_sgv_pools_init(unsigned long mem_hwmark, unsigned long mem_lwmar sgv_evaluate_local_max_pages(); sgv_norm_pool_main = sgv_pool_create("sgv", sgv_no_clustering, 0, false, 0); - if (sgv_norm_pool_main == NULL) + if (!sgv_norm_pool_main) goto out_free_pool; - sgv_norm_clust_pool_main = sgv_pool_create("sgv-clust", - sgv_full_clustering, 0, false, 0); - if (sgv_norm_clust_pool_main == NULL) + sgv_norm_clust_pool_main = sgv_pool_create("sgv-clust", sgv_full_clustering, 0, false, 0); + if (!sgv_norm_clust_pool_main) goto out_free_norm; - sgv_dma_pool_main = sgv_pool_create("sgv-dma", sgv_no_clustering, 0, - false, 0); - if (sgv_dma_pool_main == NULL) + sgv_dma_pool_main = sgv_pool_create("sgv-dma", sgv_no_clustering, 0, false, 0); + if (!sgv_dma_pool_main) goto out_free_clust; /* @@ -1803,9 +1745,9 @@ int __init scst_sgv_pools_init(unsigned long mem_hwmark, unsigned long mem_lwmar if (!cpu_online(i)) continue; scnprintf(name, sizeof(name), "sgv-%d", i); - sgv_norm_pool_per_cpu[i] = sgv_pool_create_node(name, - sgv_no_clustering, 0, false, 0, cpu_to_node(i)); - if (sgv_norm_pool_per_cpu[i] == NULL) + sgv_norm_pool_per_cpu[i] = sgv_pool_create_node(name, sgv_no_clustering, 0, false, + 0, cpu_to_node(i)); + if (!sgv_norm_pool_per_cpu[i]) goto out_free_per_cpu_norm; } @@ -1815,9 +1757,9 @@ int __init scst_sgv_pools_init(unsigned long mem_hwmark, unsigned long mem_lwmar if (!cpu_online(i)) continue; scnprintf(name, sizeof(name), "sgv-clust-%d", i); - sgv_norm_clust_pool_per_cpu[i] = sgv_pool_create_node(name, - sgv_full_clustering, 0, false, 0, cpu_to_node(i)); - if (sgv_norm_clust_pool_per_cpu[i] == NULL) + sgv_norm_clust_pool_per_cpu[i] = sgv_pool_create_node(name, sgv_full_clustering, 0, + false, 0, cpu_to_node(i)); + if (!sgv_norm_clust_pool_per_cpu[i]) goto out_free_per_cpu_clust; } @@ -1827,9 +1769,9 @@ int __init scst_sgv_pools_init(unsigned long mem_hwmark, unsigned long mem_lwmar if (!cpu_online(i)) continue; scnprintf(name, sizeof(name), "sgv-dma-%d", i); - sgv_dma_pool_per_cpu[i] = sgv_pool_create_node(name, - sgv_no_clustering, 0, false, 0, cpu_to_node(i)); - if (sgv_dma_pool_per_cpu[i] == NULL) + sgv_dma_pool_per_cpu[i] = sgv_pool_create_node(name, sgv_no_clustering, 0, false, + 0, cpu_to_node(i)); + if (!sgv_dma_pool_per_cpu[i]) goto out_free_per_cpu_dma; } @@ -1901,7 +1843,6 @@ void scst_sgv_pools_deinit(void) kmem_cache_destroy(sgv_pool_cachep); TRACE_EXIT(); - return; } static ssize_t sgv_sysfs_stat_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) @@ -1963,8 +1904,8 @@ static ssize_t sgv_sysfs_stat_show(struct kobject *kobj, struct kobj_attribute * return ret; } -static ssize_t sgv_sysfs_stat_reset(struct kobject *kobj, - struct kobj_attribute *attr, const char *buf, size_t count) +static ssize_t sgv_sysfs_stat_reset(struct kobject *kobj, struct kobj_attribute *attr, + const char *buf, size_t count) { struct sgv_pool *pool; int i; @@ -2026,8 +1967,8 @@ static ssize_t sgv_sysfs_global_stat_show(struct kobject *kobj, struct kobj_attr return ret; } -static ssize_t sgv_sysfs_global_stat_reset(struct kobject *kobj, - struct kobj_attribute *attr, const char *buf, size_t count) +static ssize_t sgv_sysfs_global_stat_reset(struct kobject *kobj, struct kobj_attribute *attr, + const char *buf, size_t count) { TRACE_ENTRY(); @@ -2037,20 +1978,20 @@ static ssize_t sgv_sysfs_global_stat_reset(struct kobject *kobj, atomic_set(&sgv_other_total_alloc, 0); #endif - PRINT_INFO("%s", "Global SGV pool statistics reset"); + PRINT_INFO("Global SGV pool statistics reset"); TRACE_EXIT_RES(count); return count; } static struct kobj_attribute sgv_stat_attr = - __ATTR(stats, S_IRUGO | S_IWUSR, sgv_sysfs_stat_show, - sgv_sysfs_stat_reset); + __ATTR(stats, 0644, sgv_sysfs_stat_show, sgv_sysfs_stat_reset); static struct attribute *sgv_pool_attrs[] = { &sgv_stat_attr.attr, NULL, }; + #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 2, 0) ATTRIBUTE_GROUPS(sgv_pool); #endif @@ -2062,11 +2003,10 @@ static void sgv_kobj_release(struct kobject *kobj) TRACE_ENTRY(); pool = container_of(kobj, struct sgv_pool, sgv_kobj); - if (pool->sgv_kobj_release_cmpl != NULL) + if (pool->sgv_kobj_release_cmpl) complete_all(pool->sgv_kobj_release_cmpl); TRACE_EXIT(); - return; } static struct kobj_type sgv_pool_ktype = { @@ -2114,13 +2054,14 @@ static void scst_sgv_sysfs_del(struct sgv_pool *pool) } static struct kobj_attribute sgv_global_stat_attr = - __ATTR(global_stats, S_IRUGO | S_IWUSR, sgv_sysfs_global_stat_show, - sgv_sysfs_global_stat_reset); + __ATTR(global_stats, 0644, + sgv_sysfs_global_stat_show, sgv_sysfs_global_stat_reset); static struct attribute *sgv_def_attrs[] = { &sgv_global_stat_attr.attr, NULL, }; + #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 2, 0) ATTRIBUTE_GROUPS(sgv_def); #endif |
From: Gleb C. <lna...@ya...> - 2025-09-23 08:43:58
|
Commit: 6e787cb GitHub URL: https://github.com/SCST-project/scst/commit/6e787cbefd8817a5a0bd441cb38cda9445d9eedf Author: Gleb Chesnokov Date: 2025-09-23T11:41:48+03:00 Log Message: ----------- scst_pres: Fix multiple checkpatch warnings This patch does not change any functionality. Modified Paths: -------------- scst/src/scst_pres.c | 884 ++++++--------- 1 file changed, 371 insertions(+), 513 deletions(-) =================================================================== diff --git a/scst/src/scst_pres.c b/scst/src/scst_pres.c index cfff018..a10be41 100644 --- a/scst/src/scst_pres.c +++ b/scst/src/scst_pres.c @@ -73,12 +73,11 @@ #endif #if defined(CONFIG_LOCKDEP) -#define scst_assert_pr_mutex_held(dev) \ - do { \ - if (dev->dev_list_entry.next && \ - !list_empty(&dev->dev_list_entry)) \ - lockdep_assert_held(&dev->dev_pr_mutex); \ - } while (0) +#define scst_assert_pr_mutex_held(dev) \ +do { \ + if ((dev)->dev_list_entry.next && !list_empty(&(dev)->dev_list_entry)) \ + lockdep_assert_held(&(dev)->dev_pr_mutex); \ +} while (0) #else static inline void scst_assert_pr_mutex_held(struct scst_device *dev) { @@ -87,7 +86,7 @@ static inline void scst_assert_pr_mutex_held(struct scst_device *dev) uint32_t scst_tid_size(const uint8_t *tid) { - sBUG_ON(tid == NULL); + sBUG_ON(!tid); if ((tid[0] & 0x0f) == SCSI_TRANSPORTID_PROTOCOLID_ISCSI) return get_unaligned_be16(&tid[2]) + 4; @@ -114,11 +113,11 @@ bool tid_equal(const uint8_t *tid_a, const uint8_t *tid_b) { int len; - if (tid_a == NULL || tid_b == NULL) + if (!tid_a || !tid_b) return false; if ((tid_a[0] & 0x0f) != (tid_b[0] & 0x0f)) { - TRACE_DBG("%s", "Different protocol IDs"); + TRACE_DBG("Different protocol IDs"); return false; } @@ -132,37 +131,41 @@ bool tid_equal(const uint8_t *tid_a, const uint8_t *tid_b) tid_a += 4; tid_b += 4; - if (tid_a_fmt == 0x00) + if (tid_a_fmt == 0x00) { tid_a_len = strnlen(tid_a, tid_a_max); - else if (tid_a_fmt == 0x40) { + } else if (tid_a_fmt == 0x40) { if (tid_a_fmt != tid_b_fmt) { uint8_t *p = strnchr(tid_a, tid_a_max, ','); - if (p == NULL) + if (!p) goto out_error; tid_a_len = p - tid_a; sBUG_ON(tid_a_len > tid_a_max); - } else + } else { tid_a_len = strnlen(tid_a, tid_a_max); - } else + } + } else { goto out_error; + } - if (tid_b_fmt == 0x00) + if (tid_b_fmt == 0x00) { tid_b_len = strnlen(tid_b, tid_b_max); - else if (tid_b_fmt == 0x40) { + } else if (tid_b_fmt == 0x40) { if (tid_a_fmt != tid_b_fmt) { uint8_t *p = strnchr(tid_b, tid_b_max, ','); - if (p == NULL) + if (!p) goto out_error; tid_b_len = p - tid_b; sBUG_ON(tid_b_len > tid_b_max); - } else + } else { tid_b_len = strnlen(tid_b, tid_b_max); - } else + } + } else { goto out_error; + } if (tid_a_len != tid_b_len) return false; @@ -181,13 +184,13 @@ bool tid_equal(const uint8_t *tid_a, const uint8_t *tid_b) return memcmp(tid_a, tid_b, len) == 0; out_error: - PRINT_ERROR("%s", "Invalid initiator port transport id"); + PRINT_ERROR("Invalid initiator port transport id"); return false; } /* Must be called under dev_pr_mutex */ -void scst_pr_set_holder(struct scst_device *dev, - struct scst_dev_registrant *holder, uint8_t scope, uint8_t type) +void scst_pr_set_holder(struct scst_device *dev, struct scst_dev_registrant *holder, uint8_t scope, + uint8_t type) { scst_assert_pr_mutex_held(dev); @@ -200,8 +203,7 @@ void scst_pr_set_holder(struct scst_device *dev, } /* Must be called under dev_pr_mutex */ -static bool scst_pr_is_holder(struct scst_device *dev, - struct scst_dev_registrant *reg) +static bool scst_pr_is_holder(struct scst_device *dev, struct scst_dev_registrant *reg) { bool res = false; @@ -213,9 +215,9 @@ static bool scst_pr_is_holder(struct scst_device *dev, goto out; if (dev->pr_type == TYPE_EXCLUSIVE_ACCESS_ALL_REG || - dev->pr_type == TYPE_WRITE_EXCLUSIVE_ALL_REG) { - res = (reg != NULL); - } else + dev->pr_type == TYPE_WRITE_EXCLUSIVE_ALL_REG) + res = reg; + else res = (dev->pr_holder == reg); out: @@ -234,55 +236,46 @@ void scst_pr_dump_prs(struct scst_device *dev, bool force) #if defined(CONFIG_SCST_DEBUG) if ((trace_flag & TRACE_PRES) == 0) #endif - goto out; + return; } PRINT_INFO("Persistent reservations for device %s:", dev->virt_name); - if (list_empty(&dev->dev_registrants_list)) - PRINT_INFO("%s", " No registrants"); - else { + if (list_empty(&dev->dev_registrants_list)) { + PRINT_INFO(" No registrants"); + } else { struct scst_dev_registrant *reg; int i = 0; - list_for_each_entry(reg, &dev->dev_registrants_list, - dev_registrants_list_entry) { - PRINT_INFO(" [%d] registrant %s/%d, key %016llx " - "(reg %p, tgt_dev %p)", i++, - debug_transport_id_to_initiator_name( - reg->transport_id), - reg->rel_tgt_id, be64_to_cpu(reg->key), reg, - reg->tgt_dev); + list_for_each_entry(reg, &dev->dev_registrants_list, dev_registrants_list_entry) { + PRINT_INFO(" [%d] registrant %s/%d, key %016llx (reg %p, tgt_dev %p)", + i++, debug_transport_id_to_initiator_name(reg->transport_id), + reg->rel_tgt_id, be64_to_cpu(reg->key), reg, reg->tgt_dev); } } if (dev->pr_is_set) { struct scst_dev_registrant *holder = dev->pr_holder; - if (holder != NULL) - PRINT_INFO("Reservation holder is %s/%d (key %016llx, " - "scope %x, type %x, reg %p, tgt_dev %p)", - debug_transport_id_to_initiator_name( - holder->transport_id), - holder->rel_tgt_id, be64_to_cpu(holder->key), - dev->pr_scope, dev->pr_type, holder, - holder->tgt_dev); + if (holder) + PRINT_INFO("Reservation holder is %s/%d (key %016llx, scope %x, type %x, reg %p, tgt_dev %p)", + debug_transport_id_to_initiator_name(holder->transport_id), + holder->rel_tgt_id, be64_to_cpu(holder->key), + dev->pr_scope, dev->pr_type, holder, holder->tgt_dev); else - PRINT_INFO("All registrants are reservation holders " - "(scope %x, type %x)", dev->pr_scope, - dev->pr_type); - } else - PRINT_INFO("%s", "Not reserved"); - -out: - return; + PRINT_INFO("All registrants are reservation holders (scope %x, type %x)", + dev->pr_scope, dev->pr_type); + } else { + PRINT_INFO("Not reserved"); + } } #endif /* defined(CONFIG_SCST_DEBUG) || defined(CONFIG_SCST_TRACING) */ /* dev_pr_mutex must be locked */ static void scst_pr_find_registrants_list_all(struct scst_device *dev, - struct scst_dev_registrant *exclude_reg, struct list_head *list) + struct scst_dev_registrant *exclude_reg, + struct list_head *list) { struct scst_dev_registrant *reg; @@ -290,27 +283,24 @@ static void scst_pr_find_registrants_list_all(struct scst_device *dev, scst_assert_pr_mutex_held(dev); - TRACE_PR("Finding all registered records for device '%s' " - "with exclude reg key %016llx", - dev->virt_name, be64_to_cpu(exclude_reg->key)); + TRACE_PR("Finding all registered records for device '%s' with exclude reg key %016llx", + dev->virt_name, be64_to_cpu(exclude_reg->key)); - list_for_each_entry(reg, &dev->dev_registrants_list, - dev_registrants_list_entry) { + list_for_each_entry(reg, &dev->dev_registrants_list, dev_registrants_list_entry) { if (reg == exclude_reg) continue; TRACE_PR("Adding registrant %s/%d (%p) to find list (key %016llx)", - debug_transport_id_to_initiator_name(reg->transport_id), - reg->rel_tgt_id, reg, be64_to_cpu(reg->key)); + debug_transport_id_to_initiator_name(reg->transport_id), + reg->rel_tgt_id, reg, be64_to_cpu(reg->key)); list_add_tail(®->aux_list_entry, list); } TRACE_EXIT(); - return; } /* dev_pr_mutex must be locked */ -static void scst_pr_find_registrants_list_key(struct scst_device *dev, - __be64 key, struct list_head *list) +static void scst_pr_find_registrants_list_key(struct scst_device *dev, __be64 key, + struct list_head *list) { struct scst_dev_registrant *reg; @@ -319,29 +309,23 @@ static void scst_pr_find_registrants_list_key(struct scst_device *dev, scst_assert_pr_mutex_held(dev); TRACE_PR("Finding registrants for device '%s' with key %016llx", - dev->virt_name, be64_to_cpu(key)); + dev->virt_name, be64_to_cpu(key)); - list_for_each_entry(reg, &dev->dev_registrants_list, - dev_registrants_list_entry) { + list_for_each_entry(reg, &dev->dev_registrants_list, dev_registrants_list_entry) { if (reg->key == key) { - TRACE_PR("Adding registrant %s/%d (%p) to the find " - "list (key %016llx)", - debug_transport_id_to_initiator_name( - reg->transport_id), - reg->rel_tgt_id, reg->tgt_dev, - be64_to_cpu(key)); + TRACE_PR("Adding registrant %s/%d (%p) to the find list (key %016llx)", + debug_transport_id_to_initiator_name(reg->transport_id), + reg->rel_tgt_id, reg->tgt_dev, be64_to_cpu(key)); list_add_tail(®->aux_list_entry, list); } } TRACE_EXIT(); - return; } /* dev_pr_mutex must be locked */ -struct scst_dev_registrant *scst_pr_find_reg( - struct scst_device *dev, const uint8_t *transport_id, - const uint16_t rel_tgt_id) +struct scst_dev_registrant *scst_pr_find_reg(struct scst_device *dev, const uint8_t *transport_id, + const uint16_t rel_tgt_id) { struct scst_dev_registrant *reg, *res = NULL; @@ -349,10 +333,8 @@ struct scst_dev_registrant *scst_pr_find_reg( scst_assert_pr_mutex_held(dev); - list_for_each_entry(reg, &dev->dev_registrants_list, - dev_registrants_list_entry) { - if ((reg->rel_tgt_id == rel_tgt_id) && - tid_equal(reg->transport_id, transport_id)) { + list_for_each_entry(reg, &dev->dev_registrants_list, dev_registrants_list_entry) { + if (reg->rel_tgt_id == rel_tgt_id && tid_equal(reg->transport_id, transport_id)) { res = reg; break; } @@ -378,7 +360,6 @@ static void scst_pr_clear_reservation(struct scst_device *dev) dev->pr_holder = NULL; TRACE_EXIT(); - return; } /* Must be called under dev_pr_mutex */ @@ -394,20 +375,20 @@ void scst_pr_clear_holder(struct scst_device *dev) dev->pr_type == TYPE_EXCLUSIVE_ACCESS_ALL_REG) { if (list_empty(&dev->dev_registrants_list)) scst_pr_clear_reservation(dev); - } else + } else { scst_pr_clear_reservation(dev); + } dev->pr_holder = NULL; TRACE_EXIT(); - return; } /* Must be called under dev_pr_mutex */ -struct scst_dev_registrant *scst_pr_add_registrant( - struct scst_device *dev, const uint8_t *transport_id, - const uint16_t rel_tgt_id, __be64 key, - bool dev_lock_locked) +struct scst_dev_registrant *scst_pr_add_registrant(struct scst_device *dev, + const uint8_t *transport_id, + const uint16_t rel_tgt_id, __be64 key, + bool dev_lock_locked) { struct scst_dev_registrant *reg; struct scst_tgt_dev *t; @@ -417,21 +398,20 @@ struct scst_dev_registrant *scst_pr_add_registrant( scst_assert_pr_mutex_held(dev); - sBUG_ON(dev == NULL); - sBUG_ON(transport_id == NULL); + sBUG_ON(!dev); + sBUG_ON(!transport_id); TRACE_PR("Registering %s/%d (dev %s)", - debug_transport_id_to_initiator_name(transport_id), - rel_tgt_id, dev->virt_name); + debug_transport_id_to_initiator_name(transport_id), rel_tgt_id, dev->virt_name); reg = scst_pr_find_reg(dev, transport_id, rel_tgt_id); - if (reg != NULL) { + if (reg) { /* * It might happen when a target driver would make >1 session * from the same initiator to the same target. */ - PRINT_ERROR("Registrant %p/%d (dev %s) already exists!", reg, - rel_tgt_id, dev->virt_name); + PRINT_ERROR("Registrant %p/%d (dev %s) already exists!", + reg, rel_tgt_id, dev->virt_name); PRINT_BUFFER("TransportID", transport_id, 24); WARN_ON(1); reg = NULL; @@ -439,18 +419,16 @@ struct scst_dev_registrant *scst_pr_add_registrant( } reg = kzalloc(sizeof(*reg), gfp_flags); - if (reg == NULL) { - PRINT_ERROR("%s", "Unable to allocate registration record"); + if (!reg) { + PRINT_ERROR("Unable to allocate registration record"); goto out; } dev->cl_ops->pr_init_reg(dev, reg); - reg->transport_id = kmemdup(transport_id, scst_tid_size(transport_id), - gfp_flags); - if (reg->transport_id == NULL) { - PRINT_ERROR("%s", "Unable to allocate initiator port " - "transport id"); + reg->transport_id = kmemdup(transport_id, scst_tid_size(transport_id), gfp_flags); + if (!reg->transport_id) { + PRINT_ERROR("Unable to allocate initiator port transport id"); goto out_free; } @@ -467,8 +445,7 @@ struct scst_dev_registrant *scst_pr_add_registrant( #endif list_for_each_entry(t, &dev->dev_tgt_dev_list, dev_tgt_dev_list_entry) { if (tid_equal(t->sess->transport_id, transport_id) && - (t->sess->tgt->rel_tgt_id == rel_tgt_id) && - (t->registrant == NULL)) { + t->sess->tgt->rel_tgt_id == rel_tgt_id && !t->registrant) { /* * We must assign here, because t can die * immediately after we release dev_lock. @@ -484,11 +461,10 @@ struct scst_dev_registrant *scst_pr_add_registrant( spin_unlock_bh(&dev->dev_lock); #endif - list_add_tail(®->dev_registrants_list_entry, - &dev->dev_registrants_list); + list_add_tail(®->dev_registrants_list_entry, &dev->dev_registrants_list); - TRACE_PR("Reg %p registered (dev %s, tgt_dev %p)", reg, - dev->virt_name, reg->tgt_dev); + TRACE_PR("Reg %p registered (dev %s, tgt_dev %p)", + reg, dev->virt_name, reg->tgt_dev); out: TRACE_EXIT_HRES(reg); @@ -501,17 +477,15 @@ out_free: } /* Must be called under dev_pr_mutex */ -void scst_pr_remove_registrant(struct scst_device *dev, - struct scst_dev_registrant *reg) +void scst_pr_remove_registrant(struct scst_device *dev, struct scst_dev_registrant *reg) { TRACE_ENTRY(); scst_assert_pr_mutex_held(dev); - TRACE_PR("Removing registrant %s/%d (reg %p, tgt_dev %p, key %016llx, " - "dev %s)", debug_transport_id_to_initiator_name(reg->transport_id), - reg->rel_tgt_id, reg, reg->tgt_dev, be64_to_cpu(reg->key), - dev->virt_name); + TRACE_PR("Removing registrant %s/%d (reg %p, tgt_dev %p, key %016llx, dev %s)", + debug_transport_id_to_initiator_name(reg->transport_id), reg->rel_tgt_id, + reg, reg->tgt_dev, be64_to_cpu(reg->key), dev->virt_name); list_del(®->dev_registrants_list_entry); @@ -527,7 +501,6 @@ void scst_pr_remove_registrant(struct scst_device *dev, kfree(reg); TRACE_EXIT(); - return; } static void scst_pr_remove_registrants(struct scst_device *dev) @@ -535,15 +508,13 @@ static void scst_pr_remove_registrants(struct scst_device *dev) struct scst_dev_registrant *reg, *tmp_reg; list_for_each_entry_safe(reg, tmp_reg, &dev->dev_registrants_list, - dev_registrants_list_entry) { + dev_registrants_list_entry) scst_pr_remove_registrant(dev, reg); - } } /* Must be called under dev_pr_mutex */ -void scst_pr_send_ua_reg(struct scst_device *dev, - struct scst_dev_registrant *reg, - int key, int asc, int ascq) +void scst_pr_send_ua_reg(struct scst_device *dev, struct scst_dev_registrant *reg, + int key, int asc, int ascq) { static uint8_t ua[SCST_STANDARD_SENSE_LEN]; @@ -553,10 +524,9 @@ void scst_pr_send_ua_reg(struct scst_device *dev, scst_set_sense(ua, sizeof(ua), dev->d_sense, key, asc, ascq); - TRACE_PR("Queueing UA [%x %x %x]: registrant %s/%d (%p), tgt_dev %p, " - "key %016llx", ua[2], ua[12], ua[13], - debug_transport_id_to_initiator_name(reg->transport_id), - reg->rel_tgt_id, reg, reg->tgt_dev, be64_to_cpu(reg->key)); + TRACE_PR("Queueing UA [%x %x %x]: registrant %s/%d (%p), tgt_dev %p, key %016llx", + ua[2], ua[12], ua[13], debug_transport_id_to_initiator_name(reg->transport_id), + reg->rel_tgt_id, reg, reg->tgt_dev, be64_to_cpu(reg->key)); if (reg->tgt_dev) scst_check_set_UA(reg->tgt_dev, ua, sizeof(ua), 0); @@ -564,13 +534,11 @@ void scst_pr_send_ua_reg(struct scst_device *dev, dev->cl_ops->pr_reg_queue_rem_ua(dev, reg, key, asc, ascq); TRACE_EXIT(); - return; } /* Must be called under dev_pr_mutex */ -static void scst_pr_send_ua_all(struct scst_device *dev, - struct scst_dev_registrant *exclude_reg, - int key, int asc, int ascq) +static void scst_pr_send_ua_all(struct scst_device *dev, struct scst_dev_registrant *exclude_reg, + int key, int asc, int ascq) { struct scst_dev_registrant *reg; @@ -578,19 +546,17 @@ static void scst_pr_send_ua_all(struct scst_device *dev, scst_assert_pr_mutex_held(dev); - list_for_each_entry(reg, &dev->dev_registrants_list, - dev_registrants_list_entry) { + list_for_each_entry(reg, &dev->dev_registrants_list, dev_registrants_list_entry) { if (reg != exclude_reg) scst_pr_send_ua_reg(dev, reg, key, asc, ascq); } TRACE_EXIT(); - return; } /* Must be called under dev_pr_mutex */ -static void scst_pr_abort_reg(struct scst_device *dev, - struct scst_cmd *pr_cmd, struct scst_dev_registrant *reg) +static void scst_pr_abort_reg(struct scst_device *dev, struct scst_cmd *pr_cmd, + struct scst_dev_registrant *reg) { struct scst_session *sess; __be64 packed_lun; @@ -600,44 +566,40 @@ static void scst_pr_abort_reg(struct scst_device *dev, scst_assert_pr_mutex_held(dev); - if (reg->tgt_dev == NULL) { + if (!reg->tgt_dev) { TRACE_PR("Registrant %s/%d (%p, key 0x%016llx) has no session", - debug_transport_id_to_initiator_name(reg->transport_id), - reg->rel_tgt_id, reg, be64_to_cpu(reg->key)); + debug_transport_id_to_initiator_name(reg->transport_id), + reg->rel_tgt_id, reg, be64_to_cpu(reg->key)); goto out; } sess = reg->tgt_dev->sess; - TRACE_PR("Aborting %d commands for %s/%d (reg %p, key 0x%016llx, " - "tgt_dev %p, sess %p)", - atomic_read(®->tgt_dev->tgt_dev_cmd_count), - debug_transport_id_to_initiator_name(reg->transport_id), - reg->rel_tgt_id, reg, be64_to_cpu(reg->key), reg->tgt_dev, - sess); + TRACE_PR("Aborting %d commands for %s/%d (reg %p, key 0x%016llx, tgt_dev %p, sess %p)", + atomic_read(®->tgt_dev->tgt_dev_cmd_count), + debug_transport_id_to_initiator_name(reg->transport_id), + reg->rel_tgt_id, reg, be64_to_cpu(reg->key), reg->tgt_dev, sess); packed_lun = scst_pack_lun(reg->tgt_dev->lun, sess->acg->addr_method); - rc = scst_rx_mgmt_fn_lun(sess, SCST_PR_ABORT_ALL, - &packed_lun, sizeof(packed_lun), SCST_NON_ATOMIC, - pr_cmd); + rc = scst_rx_mgmt_fn_lun(sess, SCST_PR_ABORT_ALL, &packed_lun, sizeof(packed_lun), + SCST_NON_ATOMIC, pr_cmd); if (rc != 0) { /* * There's nothing more we can do here... Hopefully, it would * never happen. */ PRINT_ERROR("SCST_PR_ABORT_ALL failed %d (sess %p)", - rc, sess); + rc, sess); goto out; } - if ((reg->tgt_dev != pr_cmd->tgt_dev) && !dev->tas) { + if (reg->tgt_dev != pr_cmd->tgt_dev && !dev->tas) { uint8_t sense_buffer[SCST_STANDARD_SENSE_LEN]; int sl; - sl = scst_set_sense(sense_buffer, sizeof(sense_buffer), - dev->d_sense, - SCST_LOAD_SENSE(scst_sense_cleared_by_another_ini_UA)); + sl = scst_set_sense(sense_buffer, sizeof(sense_buffer), dev->d_sense, + SCST_LOAD_SENSE(scst_sense_cleared_by_another_ini_UA)); /* * Potentially, setting UA here, when the aborted commands are * still running, can lead to a situation that one of them could @@ -654,13 +616,10 @@ static void scst_pr_abort_reg(struct scst_device *dev, out: TRACE_EXIT(); - return; } - /* Called under scst_mutex */ -static int scst_pr_do_load_device_file(struct scst_device *dev, - const char *file_name) +static int scst_pr_do_load_device_file(struct scst_device *dev, const char *file_name) { int res = 0, rc; struct file *file = NULL; @@ -693,24 +652,24 @@ static int scst_pr_do_load_device_file(struct scst_device *dev, } /* Let's limit the file size by some reasonable number */ - if ((file_size == 0) || (file_size >= 15*1024*1024)) { + if (file_size == 0 || (file_size >= 15 * 1024 * 1024)) { PRINT_ERROR("Invalid PR file size %d", (int)file_size); res = -EINVAL; goto out_close; } buf = vmalloc(file_size); - if (buf == NULL) { + if (!buf) { res = -ENOMEM; - PRINT_ERROR("%s", "Unable to allocate buffer"); + PRINT_ERROR("Unable to allocate buffer"); goto out_close; } pos = 0; rc = kernel_read(file, buf, file_size, &pos); if (rc != file_size) { - PRINT_ERROR("Unable to read file '%s' - error %d", file_name, - rc); + PRINT_ERROR("Unable to read file '%s' - error %d", + file_name, rc); res = rc; goto out_close; } @@ -734,8 +693,8 @@ static int scst_pr_do_load_device_file(struct scst_device *dev, sign = get_unaligned((uint64_t *)&buf[pos]); if (sign != SCST_PR_FILE_SIGN) { res = -EINVAL; - PRINT_ERROR("Invalid persistent file signature %016llx " - "(expected %016llx)", sign, SCST_PR_FILE_SIGN); + PRINT_ERROR("Invalid persistent file signature %016llx (expected %016llx)", + sign, SCST_PR_FILE_SIGN); goto out_close; } pos += sizeof(sign); @@ -743,8 +702,8 @@ static int scst_pr_do_load_device_file(struct scst_device *dev, version = get_unaligned((uint64_t *)&buf[pos]); if (version != SCST_PR_FILE_VERSION) { res = -EINVAL; - PRINT_ERROR("Invalid persistent file version %016llx " - "(expected %016llx)", version, SCST_PR_FILE_VERSION); + PRINT_ERROR("Invalid persistent file version %016llx (expected %016llx)", + version, SCST_PR_FILE_VERSION); goto out_close; } pos += sizeof(version); @@ -760,9 +719,8 @@ static int scst_pr_do_load_device_file(struct scst_device *dev, if (data_size > file_size) { res = -EINVAL; - PRINT_ERROR("Invalid file '%s' - size mismatch have " - "%lld expected %lld", file_name, file_size, - data_size); + PRINT_ERROR("Invalid file '%s' - size mismatch have %lld expected %lld", + file_name, file_size, data_size); goto out_close; } } @@ -798,7 +756,7 @@ static int scst_pr_do_load_device_file(struct scst_device *dev, pos += sizeof(rel_tgt_id); reg = scst_pr_add_registrant(dev, tid, rel_tgt_id, key, false); - if (reg == NULL) { + if (!reg) { res = -ENOMEM; goto out_close; } @@ -811,8 +769,7 @@ out_close: filp_close(file, NULL); out: - if (buf != NULL) - vfree(buf); + vfree(buf); TRACE_EXIT_RES(res); return res; @@ -826,7 +783,7 @@ static int scst_pr_load_device_file(struct scst_device *dev) scst_assert_pr_mutex_held(dev); - if (dev->pr_file_name == NULL || dev->pr_file_name1 == NULL) { + if (!dev->pr_file_name || !dev->pr_file_name1) { PRINT_ERROR("Invalid file paths for '%s'", dev->virt_name); res = -EINVAL; goto out; @@ -835,7 +792,7 @@ static int scst_pr_load_device_file(struct scst_device *dev) res = scst_pr_do_load_device_file(dev, dev->pr_file_name); if (res == 0) goto out_dump; - else if (res == -ENOMEM) + if (res == -ENOMEM) goto out; rc = res; @@ -867,7 +824,6 @@ static void scst_pr_remove_device_files(struct scst_device *dev) scst_remove_file(dev->pr_file_name1); TRACE_EXIT(); - return; } /* Must be called under dev_pr_mutex */ @@ -885,7 +841,7 @@ void scst_pr_sync_device_file(struct scst_device *dev) scst_assert_pr_mutex_held(dev); - if ((dev->pr_aptpl == 0) || list_empty(&dev->dev_registrants_list)) { + if (dev->pr_aptpl == 0 || list_empty(&dev->dev_registrants_list)) { scst_pr_remove_device_files(dev); goto out; } @@ -896,7 +852,7 @@ void scst_pr_sync_device_file(struct scst_device *dev) if (IS_ERR(file)) { res = PTR_ERR(file); PRINT_ERROR("Unable to (re)create PR file '%s' - error %d", - dev->pr_file_name, res); + dev->pr_file_name, res); goto out; } @@ -996,8 +952,8 @@ void scst_pr_sync_device_file(struct scst_device *dev) out: if (res != 0) { - PRINT_CRIT_ERROR("Unable to save persistent information " - "(device %s)", dev->virt_name); + PRINT_CRIT_ERROR("Unable to save persistent information (device %s)", + dev->virt_name); /* * It's safer to not return any error to the initiator and expect * operator's intervention to be able to save the PR's state next @@ -1023,12 +979,11 @@ write_error_close: scst_vfs_unlink_and_put(&path); else TRACE_PR("Unable to lookup '%s' - error %d", - dev->pr_file_name, rc); + dev->pr_file_name, rc); } goto out; } - /** * scst_pr_set_file_name - set name of file in which to save PR information * @dev: SCST device. @@ -1090,8 +1045,9 @@ int scst_pr_set_file_name(struct scst_device *dev, char **prev, *prev = dev->pr_file_name; dev->pr_file_name = pr_file_name; pr_file_name = NULL; - } else + } else { swap(dev->pr_file_name, pr_file_name); + } swap(dev->pr_file_name1, bkp); res = 0; @@ -1187,7 +1143,6 @@ void scst_pr_clear_dev(struct scst_device *dev) kfree(dev->pr_file_name1); TRACE_EXIT(); - return; } /* Called under scst_mutex */ @@ -1201,16 +1156,16 @@ int scst_pr_init_tgt_dev(struct scst_tgt_dev *tgt_dev) TRACE_ENTRY(); - if (tgt_dev->sess->transport_id == NULL) + if (!tgt_dev->sess->transport_id) goto out; scst_pr_write_lock(dev); reg = scst_pr_find_reg(dev, transport_id, rel_tgt_id); - if ((reg != NULL) && (reg->tgt_dev == NULL)) { + if (reg && !reg->tgt_dev) { TRACE_PR("Assigning reg %s/%d (%p) to tgt_dev %p (dev %s)", - debug_transport_id_to_initiator_name(transport_id), - rel_tgt_id, reg, tgt_dev, dev->virt_name); + debug_transport_id_to_initiator_name(transport_id), + rel_tgt_id, reg, tgt_dev, dev->virt_name); tgt_dev->registrant = reg; reg->tgt_dev = tgt_dev; } @@ -1239,17 +1194,14 @@ void scst_pr_clear_tgt_dev(struct scst_tgt_dev *tgt_dev) reg->tgt_dev = NULL; /* Just in case, actually. It should never happen. */ - list_for_each_entry(t, &dev->dev_tgt_dev_list, - dev_tgt_dev_list_entry) { + list_for_each_entry(t, &dev->dev_tgt_dev_list, dev_tgt_dev_list_entry) { if (t == tgt_dev) continue; - if ((t->sess->tgt->rel_tgt_id == reg->rel_tgt_id) && + if (t->sess->tgt->rel_tgt_id == reg->rel_tgt_id && tid_equal(t->sess->transport_id, reg->transport_id)) { - TRACE_PR("Reassigning reg %s/%d (%p) to tgt_dev " - "%p (being cleared tgt_dev %p)", - debug_transport_id_to_initiator_name( - reg->transport_id), - reg->rel_tgt_id, reg, t, tgt_dev); + TRACE_PR("Reassigning reg %s/%d (%p) to tgt_dev %p (being cleared tgt_dev %p)", + debug_transport_id_to_initiator_name(reg->transport_id), + reg->rel_tgt_id, reg, t, tgt_dev); t->registrant = reg; reg->tgt_dev = t; break; @@ -1260,13 +1212,12 @@ void scst_pr_clear_tgt_dev(struct scst_tgt_dev *tgt_dev) scst_pr_write_unlock(dev); TRACE_EXIT(); - return; } /* Called with dev_pr_mutex locked. Might also be called under scst_mutex2. */ -static int scst_pr_register_with_spec_i_pt(struct scst_cmd *cmd, - const uint16_t rel_tgt_id, uint8_t *buffer, int buffer_size, - struct list_head *rollback_list) +static int scst_pr_register_with_spec_i_pt(struct scst_cmd *cmd, const uint16_t rel_tgt_id, + uint8_t *buffer, int buffer_size, + struct list_head *rollback_list) { int res = 0; int offset; @@ -1281,10 +1232,9 @@ static int scst_pr_register_with_spec_i_pt(struct scst_cmd *cmd, ext_size = get_unaligned_be32(&buffer[24]); if ((ext_size + 28) > buffer_size) { - TRACE_PR("Invalid buffer size %d (max %d)", buffer_size, - ext_size + 28); - scst_set_cmd_error(cmd, - SCST_LOAD_SENSE(scst_sense_parameter_list_length_invalid)); + TRACE_PR("Invalid buffer size %d (max %d)", + buffer_size, ext_size + 28); + scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_parameter_list_length_invalid)); res = -EINVAL; goto out; } @@ -1296,7 +1246,7 @@ static int scst_pr_register_with_spec_i_pt(struct scst_cmd *cmd, if (offset + tid_size > ext_size) { TRACE_PR("Invalid transport_id size %d (max %d)", - tid_size, ext_size - offset); + tid_size, ext_size - offset); scst_set_invalid_field_in_parm_list(cmd, 24, 0); res = -EINVAL; goto out; @@ -1310,73 +1260,66 @@ static int scst_pr_register_with_spec_i_pt(struct scst_cmd *cmd, uint8_t *transport_id = &buffer[28 + offset]; struct scst_tgt_dev *t; - TRACE_PR("rel_tgt_id %d, transport_id %s", rel_tgt_id, - debug_transport_id_to_initiator_name(transport_id)); + TRACE_PR("rel_tgt_id %d, transport_id %s", + rel_tgt_id, debug_transport_id_to_initiator_name(transport_id)); if ((transport_id[0] & 0x0f) == SCSI_TRANSPORTID_PROTOCOLID_ISCSI && (transport_id[0] & 0xc0) == 0) { - TRACE_PR("Wildcard iSCSI TransportID %s", - &transport_id[4]); + TRACE_PR("Wildcard iSCSI TransportID %s", &transport_id[4]); /* * We can't use scst_mutex here because the caller * already holds dev_pr_mutex. */ spin_lock_bh(&dev->dev_lock); - list_for_each_entry(t, &dev->dev_tgt_dev_list, - dev_tgt_dev_list_entry) { + list_for_each_entry(t, &dev->dev_tgt_dev_list, dev_tgt_dev_list_entry) { /* * We must go over all matching tgt_devs and * register them on the requested rel_tgt_id */ - if (!tid_equal(t->sess->transport_id, - transport_id)) + if (!tid_equal(t->sess->transport_id, transport_id)) continue; - reg = scst_pr_find_reg(dev, - t->sess->transport_id, rel_tgt_id); - if (reg == NULL) { - reg = scst_pr_add_registrant(dev, - t->sess->transport_id, - rel_tgt_id, action_key, true); - if (reg == NULL) { + reg = scst_pr_find_reg(dev, t->sess->transport_id, rel_tgt_id); + if (!reg) { + reg = scst_pr_add_registrant(dev, t->sess->transport_id, + rel_tgt_id, action_key, true); + if (!reg) { spin_unlock_bh(&dev->dev_lock); scst_set_busy(cmd); res = -ENOMEM; goto out; } } else if (reg->key != action_key) { - TRACE_PR("Changing key of reg %p " - "(tgt_dev %p)", reg, t); + TRACE_PR("Changing key of reg %p (tgt_dev %p)", reg, t); reg->rollback_key = reg->key; reg->key = action_key; - } else + } else { continue; + } - list_add_tail(®->aux_list_entry, - rollback_list); + list_add_tail(®->aux_list_entry, rollback_list); } spin_unlock_bh(&dev->dev_lock); } else { reg = scst_pr_find_reg(dev, transport_id, rel_tgt_id); - if (reg != NULL) { + if (reg) { if (reg->key == action_key) goto next; TRACE_PR("Changing key of reg %p (tgt_dev %p)", - reg, reg->tgt_dev); + reg, reg->tgt_dev); reg->rollback_key = reg->key; reg->key = action_key; } else { - reg = scst_pr_add_registrant(dev, transport_id, - rel_tgt_id, action_key, false); - if (reg == NULL) { + reg = scst_pr_add_registrant(dev, transport_id, rel_tgt_id, + action_key, false); + if (!reg) { scst_set_busy(cmd); res = -ENOMEM; goto out; } } - list_add_tail(®->aux_list_entry, - rollback_list); + list_add_tail(®->aux_list_entry, rollback_list); } next: offset += scst_tid_size(transport_id); @@ -1386,8 +1329,7 @@ out: } /* Called with dev_pr_mutex locked, no IRQ */ -static void scst_pr_unregister(struct scst_device *dev, - struct scst_dev_registrant *reg) +static void scst_pr_unregister(struct scst_device *dev, struct scst_dev_registrant *reg) { bool is_holder; uint8_t pr_type; @@ -1409,18 +1351,16 @@ static void scst_pr_unregister(struct scst_device *dev, case TYPE_WRITE_EXCLUSIVE_REGONLY: case TYPE_EXCLUSIVE_ACCESS_REGONLY: scst_pr_send_ua_all(dev, NULL, - SCST_LOAD_SENSE(scst_sense_reservation_released)); + SCST_LOAD_SENSE(scst_sense_reservation_released)); break; } } TRACE_EXIT(); - return; } /* Called with dev_pr_mutex locked, no IRQ */ -static void scst_pr_unregister_all_tg_pt(struct scst_device *dev, - const uint8_t *transport_id) +static void scst_pr_unregister_all_tg_pt(struct scst_device *dev, const uint8_t *transport_id) { struct scst_tgt_template *tgtt; uint8_t proto_id = transport_id[0] & 0x0f; @@ -1438,7 +1378,7 @@ static void scst_pr_unregister_all_tg_pt(struct scst_device *dev, list_for_each_entry(tgtt, &scst_template_list, scst_template_list_entry) { struct scst_tgt *tgt; - if (tgtt->get_initiator_port_transport_id == NULL) + if (!tgtt->get_initiator_port_transport_id) continue; list_for_each_entry(tgt, &tgtt->tgt_list, tgt_list_entry) { @@ -1447,9 +1387,8 @@ static void scst_pr_unregister_all_tg_pt(struct scst_device *dev, if (tgtt->get_initiator_port_transport_id(tgt, NULL, NULL) != proto_id) continue; - reg = scst_pr_find_reg(dev, transport_id, - tgt->rel_tgt_id); - if (reg == NULL) + reg = scst_pr_find_reg(dev, transport_id, tgt->rel_tgt_id); + if (!reg) continue; scst_pr_unregister(dev, reg); @@ -1459,13 +1398,12 @@ static void scst_pr_unregister_all_tg_pt(struct scst_device *dev, mutex_unlock(&scst_mutex2); TRACE_EXIT(); - return; } /* Called with dev_pr_mutex locked. Might also be called under scst_mutex2. */ -static int scst_pr_register_on_tgt_id(struct scst_cmd *cmd, - const uint16_t rel_tgt_id, uint8_t *buffer, int buffer_size, - bool spec_i_pt, struct list_head *rollback_list) +static int scst_pr_register_on_tgt_id(struct scst_cmd *cmd, const uint16_t rel_tgt_id, + uint8_t *buffer, int buffer_size, bool spec_i_pt, + struct list_head *rollback_list) { int res; @@ -1476,23 +1414,23 @@ static int scst_pr_register_on_tgt_id(struct scst_cmd *cmd, TRACE_PR("rel_tgt_id %d, spec_i_pt %d", rel_tgt_id, spec_i_pt); if (spec_i_pt) { - res = scst_pr_register_with_spec_i_pt(cmd, rel_tgt_id, buffer, - buffer_size, rollback_list); + res = scst_pr_register_with_spec_i_pt(cmd, rel_tgt_id, buffer, buffer_size, + rollback_list); if (res != 0) goto out; } /* tgt_dev can be among TIDs for scst_pr_register_with_spec_i_pt() */ - if (scst_pr_find_reg(cmd->dev, cmd->sess->transport_id, rel_tgt_id) == NULL) { + if (!scst_pr_find_reg(cmd->dev, cmd->sess->transport_id, rel_tgt_id)) { __be64 action_key; struct scst_dev_registrant *reg; action_key = get_unaligned((__be64 *)&buffer[8]); - reg = scst_pr_add_registrant(cmd->dev, cmd->sess->transport_id, - rel_tgt_id, action_key, false); - if (reg == NULL) { + reg = scst_pr_add_registrant(cmd->dev, cmd->sess->transport_id, rel_tgt_id, + action_key, false); + if (!reg) { res = -ENOMEM; scst_set_busy(cmd); goto out; @@ -1509,8 +1447,8 @@ out: } /* Add registrants for remote ports. Called with dev_pr_mutex locked, no IRQ. */ -static int scst_register_remote_ports(struct scst_cmd *cmd, uint8_t *buffer, - int buffer_size, bool spec_i_pt, struct list_head *rollback_list) +static int scst_register_remote_ports(struct scst_cmd *cmd, uint8_t *buffer, int buffer_size, + bool spec_i_pt, struct list_head *rollback_list) { struct scst_dev_group *dg; struct scst_target_group *tg; @@ -1546,8 +1484,8 @@ out_unlock: } /* Register all target ports. Called with dev_pr_mutex locked, no IRQ. */ -static int scst_pr_register_all_tg_pt(struct scst_cmd *cmd, uint8_t *buffer, - int buffer_size, bool spec_i_pt, struct list_head *rollback_list) +static int scst_pr_register_all_tg_pt(struct scst_cmd *cmd, uint8_t *buffer, int buffer_size, + bool spec_i_pt, struct list_head *rollback_list) { int res = 0; struct scst_tgt_template *tgtt; @@ -1566,7 +1504,7 @@ static int scst_pr_register_all_tg_pt(struct scst_cmd *cmd, uint8_t *buffer, list_for_each_entry(tgtt, &scst_template_list, scst_template_list_entry) { struct scst_tgt *tgt; - if (tgtt->get_initiator_port_transport_id == NULL) + if (!tgtt->get_initiator_port_transport_id) continue; TRACE_PR("tgtt %s, spec_i_pt %d", tgtt->name, spec_i_pt); @@ -1577,14 +1515,14 @@ static int scst_pr_register_all_tg_pt(struct scst_cmd *cmd, uint8_t *buffer, if (tgt->rel_tgt_id == 0) continue; if (tgt->tgt_forward_dst) { - TRACE_PR("ALL_TG_PT: skipping forwarding " - "target %s", tgt->tgt_name); + TRACE_PR("ALL_TG_PT: skipping forwarding target %s", + tgt->tgt_name); continue; } - TRACE_PR("tgt %s, rel_tgt_id %d", tgt->tgt_name, - tgt->rel_tgt_id); - res = scst_pr_register_on_tgt_id(cmd, tgt->rel_tgt_id, - buffer, buffer_size, spec_i_pt, rollback_list); + TRACE_PR("tgt %s, rel_tgt_id %d", + tgt->tgt_name, tgt->rel_tgt_id); + res = scst_pr_register_on_tgt_id(cmd, tgt->rel_tgt_id, buffer, buffer_size, + spec_i_pt, rollback_list); if (res != 0) goto out_unlock; } @@ -1601,8 +1539,8 @@ out_unlock: } /* Called with dev_pr_mutex locked, no IRQ */ -static int __scst_pr_register(struct scst_cmd *cmd, uint8_t *buffer, - int buffer_size, bool spec_i_pt, bool all_tg_pt) +static int __scst_pr_register(struct scst_cmd *cmd, uint8_t *buffer, int buffer_size, + bool spec_i_pt, bool all_tg_pt) { int res; struct scst_dev_registrant *reg, *treg; @@ -1613,21 +1551,19 @@ static int __scst_pr_register(struct scst_cmd *cmd, uint8_t *buffer, scst_assert_pr_mutex_held(cmd->dev); if (all_tg_pt) { - res = scst_pr_register_all_tg_pt(cmd, buffer, buffer_size, - spec_i_pt, &rollback_list); + res = scst_pr_register_all_tg_pt(cmd, buffer, buffer_size, spec_i_pt, + &rollback_list); if (res != 0) goto out_rollback; } else { - res = scst_pr_register_on_tgt_id(cmd, - cmd->sess->tgt->rel_tgt_id, buffer, buffer_size, - spec_i_pt, &rollback_list); + res = scst_pr_register_on_tgt_id(cmd, cmd->sess->tgt->rel_tgt_id, buffer, + buffer_size, spec_i_pt, &rollback_list); if (res != 0) goto out_rollback; } - list_for_each_entry(reg, &rollback_list, aux_list_entry) { + list_for_each_entry(reg, &rollback_list, aux_list_entry) reg->rollback_key = 0; - } out: TRACE_EXIT_RES(res); @@ -1636,9 +1572,9 @@ out: out_rollback: list_for_each_entry_safe(reg, treg, &rollback_list, aux_list_entry) { list_del(®->aux_list_entry); - if (reg->rollback_key == 0) + if (reg->rollback_key == 0) { scst_pr_remove_registrant(cmd->dev, reg); - else { + } else { reg->key = reg->rollback_key; reg->rollback_key = 0; } @@ -1668,58 +1604,54 @@ void scst_pr_register(struct scst_cmd *cmd, uint8_t *buffer, int buffer_size) if (spec_i_pt == 0 && buffer_size != 24) { TRACE_PR("Invalid buffer size %d", buffer_size); - scst_set_cmd_error(cmd, - SCST_LOAD_SENSE(scst_sense_parameter_list_length_invalid)); + scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_parameter_list_length_invalid)); goto out; } - reg = tgt_dev->registrant; - TRACE_PR("Register: initiator %s/%d (%p), key %0llx, action_key %0llx " - "(tgt_dev %p)", - debug_transport_id_to_initiator_name(sess->transport_id), - sess->tgt->rel_tgt_id, reg, be64_to_cpu(key), - be64_to_cpu(action_key), tgt_dev); + TRACE_PR("Register: initiator %s/%d (%p), key %0llx, action_key %0llx (tgt_dev %p)", + debug_transport_id_to_initiator_name(sess->transport_id), + sess->tgt->rel_tgt_id, reg, be64_to_cpu(key), + be64_to_cpu(action_key), tgt_dev); - if (reg == NULL) { + if (!reg) { TRACE_PR("tgt_dev %p is not registered yet - registering", - tgt_dev); + tgt_dev); if (key) { - TRACE_PR("%s", "Key must be zero on new registration"); + TRACE_PR("Key must be zero on new registration"); scst_set_cmd_error_status(cmd, SAM_STAT_RESERVATION_CONFLICT); goto out; } if (action_key) { - int rc = __scst_pr_register(cmd, buffer, buffer_size, - spec_i_pt, all_tg_pt); + int rc = __scst_pr_register(cmd, buffer, buffer_size, spec_i_pt, + all_tg_pt); if (rc != 0) goto out; - } else - TRACE_PR("%s", "Doing nothing - action_key is zero"); + } else { + TRACE_PR("Doing nothing - action_key is zero"); + } } else { if (reg->key != key) { - TRACE_PR("tgt_dev %p already registered - reservation " - "key %0llx mismatch", tgt_dev, - be64_to_cpu(reg->key)); - scst_set_cmd_error_status(cmd, - SAM_STAT_RESERVATION_CONFLICT); + TRACE_PR("tgt_dev %p already registered - reservation key %0llx mismatch", + tgt_dev, be64_to_cpu(reg->key)); + scst_set_cmd_error_status(cmd, SAM_STAT_RESERVATION_CONFLICT); goto out; } if (spec_i_pt) { - TRACE_PR("%s", "spec_i_pt must be zero in this case"); + TRACE_PR("spec_i_pt must be zero in this case"); scst_set_invalid_field_in_parm_list(cmd, 20, - SCST_INVAL_FIELD_BIT_OFFS_VALID | 3); + SCST_INVAL_FIELD_BIT_OFFS_VALID | 3); goto out; } if (action_key == 0) { if (all_tg_pt) - scst_pr_unregister_all_tg_pt(dev, - sess->transport_id); + scst_pr_unregister_all_tg_pt(dev, sess->transport_id); else scst_pr_unregister(dev, reg); - } else + } else { reg->key = action_key; + } } dev->pr_generation++; @@ -1730,12 +1662,10 @@ void scst_pr_register(struct scst_cmd *cmd, uint8_t *buffer, int buffer_size) out: TRACE_EXIT(); - return; } /* Called with dev_pr_mutex locked, no IRQ */ -void scst_pr_register_and_ignore(struct scst_cmd *cmd, uint8_t *buffer, - int buffer_size) +void scst_pr_register_and_ignore(struct scst_cmd *cmd, uint8_t *buffer, int buffer_size) { int aptpl, all_tg_pt; __be64 action_key; @@ -1754,39 +1684,35 @@ void scst_pr_register_and_ignore(struct scst_cmd *cmd, uint8_t *buffer, if (buffer_size != 24) { TRACE_PR("Invalid buffer size %d", buffer_size); - scst_set_cmd_error(cmd, - SCST_LOAD_SENSE(scst_sense_parameter_list_length_invalid)); + scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_parameter_list_length_invalid)); goto out; } - reg = tgt_dev->registrant; - TRACE_PR("Register and ignore: initiator %s/%d (%p), action_key " - "%016llx (tgt_dev %p)", - debug_transport_id_to_initiator_name(sess->transport_id), - sess->tgt->rel_tgt_id, reg, be64_to_cpu(action_key), - tgt_dev); + TRACE_PR("Register and ignore: initiator %s/%d (%p), action_key %016llx (tgt_dev %p)", + debug_transport_id_to_initiator_name(sess->transport_id), + sess->tgt->rel_tgt_id, reg, be64_to_cpu(action_key), tgt_dev); - if (reg == NULL) { - TRACE_PR("Tgt_dev %p is not registered yet - trying to " - "register", tgt_dev); + if (!reg) { + TRACE_PR("Tgt_dev %p is not registered yet - trying to register", tgt_dev); if (action_key) { - int rc = __scst_pr_register(cmd, buffer, buffer_size, - false, all_tg_pt); + int rc = __scst_pr_register(cmd, buffer, buffer_size, false, all_tg_pt); + if (rc != 0) goto out; - } else - TRACE_PR("%s", "Doing nothing, action_key is zero"); + } else { + TRACE_PR("Doing nothing, action_key is zero"); + } } else { if (action_key == 0) { if (all_tg_pt) - scst_pr_unregister_all_tg_pt(dev, - sess->transport_id); + scst_pr_unregister_all_tg_pt(dev, sess->transport_id); else scst_pr_unregister(dev, reg); - } else + } else { reg->key = action_key; + } } dev->pr_generation++; @@ -1797,12 +1723,10 @@ void scst_pr_register_and_ignore(struct scst_cmd *cmd, uint8_t *buffer, out: TRACE_EXIT(); - return; } /* Called with dev_pr_mutex locked, no IRQ */ -void scst_pr_register_and_move(struct scst_cmd *cmd, uint8_t *buffer, - int buffer_size) +void scst_pr_register_and_move(struct scst_cmd *cmd, uint8_t *buffer, int buffer_size) { int aptpl; int unreg; @@ -1826,17 +1750,15 @@ void scst_pr_register_and_move(struct scst_cmd *cmd, uint8_t *buffer, unreg = (buffer[17] >> 1) & 0x01; tid_buffer_size = get_unaligned_be32(&buffer[20]); - if ((tid_buffer_size + 24) > buffer_size) { TRACE_PR("Invalid buffer size %d (%d)", - buffer_size, tid_buffer_size + 24); - scst_set_cmd_error(cmd, - SCST_LOAD_SENSE(scst_sense_invalid_field_in_parm_list)); + buffer_size, tid_buffer_size + 24); + scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_invalid_field_in_parm_list)); goto out; } if (tid_buffer_size < 24) { - TRACE_PR("%s", "Transport id buffer too small"); + TRACE_PR("Transport id buffer too small"); scst_set_invalid_field_in_parm_list(cmd, 20, 0); goto out; } @@ -1844,19 +1766,17 @@ void scst_pr_register_and_move(struct scst_cmd *cmd, uint8_t *buffer, reg = tgt_dev->registrant; /* We already checked reg is not NULL */ if (reg->key != key) { - TRACE_PR("Registrant's %s/%d (%p) key %016llx mismatch with " - "%016llx (tgt_dev %p)", - debug_transport_id_to_initiator_name(reg->transport_id), - reg->rel_tgt_id, reg, be64_to_cpu(reg->key), - be64_to_cpu(key), tgt_dev); + TRACE_PR("Registrant's %s/%d (%p) key %016llx mismatch with %016llx (tgt_dev %p)", + debug_transport_id_to_initiator_name(reg->transport_id), + reg->rel_tgt_id, reg, be64_to_cpu(reg->key), + be64_to_cpu(key), tgt_dev); scst_set_cmd_error_status(cmd, SAM_STAT_RESERVATION_CONFLICT); goto out; } if (!dev->pr_is_set) { - TRACE_PR("%s", "There must be a PR"); - scst_set_cmd_error(cmd, - SCST_LOAD_SENSE(scst_sense_invalid_field_in_cdb)); + TRACE_PR("There must be a PR"); + scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_invalid_field_in_cdb)); goto out; } @@ -1866,14 +1786,14 @@ void scst_pr_register_and_move(struct scst_cmd *cmd, uint8_t *buffer, */ if (!scst_pr_is_holder(dev, reg)) { TRACE_PR("Registrant %s/%d (%p) is not a holder (tgt_dev %p)", - debug_transport_id_to_initiator_name(reg->transport_id), - reg->rel_tgt_id, reg, tgt_dev); + debug_transport_id_to_initiator_name(reg->transport_id), + reg->rel_tgt_id, reg, tgt_dev); scst_set_cmd_error_status(cmd, SAM_STAT_RESERVATION_CONFLICT); goto out; } if (action_key == 0) { - TRACE_PR("%s", "Action key must be non-zero"); + TRACE_PR("Action key must be non-zero"); scst_set_invalid_field_in_cdb(cmd, 8, 0); goto out; } @@ -1884,39 +1804,37 @@ void scst_pr_register_and_move(struct scst_cmd *cmd, uint8_t *buffer, if ((scst_tid_size(transport_id_move) + 24) > buffer_size) { TRACE_PR("Invalid buffer size %d (%d)", - buffer_size, scst_tid_size(transport_id_move) + 24); - scst_set_cmd_error(cmd, - SCST_LOAD_SENSE(scst_sense_invalid_field_in_parm_list)); + buffer_size, scst_tid_size(transport_id_move) + 24); + scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_invalid_field_in_parm_list)); goto out; } if (!tid_secure(transport_id_move, buffer_size - 24)) { TRACE_PR("Transport ID length %d exceeds buffer size %d", scst_tid_size(transport_id_move), buffer_size - 24); - scst_set_cmd_error(cmd, - SCST_LOAD_SENSE(scst_sense_invalid_field_in_parm_list)); + scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_invalid_field_in_parm_list)); goto out; } if (dev->pr_type == TYPE_WRITE_EXCLUSIVE_ALL_REG || dev->pr_type == TYPE_EXCLUSIVE_ACCESS_ALL_REG) { - TRACE_PR("Unable to finish operation due to wrong reservation " - "type %02x", dev->pr_type); + TRACE_PR("Unable to finish operation due to wrong reservation type %02x", + dev->pr_type); scst_set_cmd_error_status(cmd, SAM_STAT_RESERVATION_CONFLICT); goto out; } if (tid_equal(transport_id, transport_id_move)) { - TRACE_PR("%s", "Equal transport id's"); + TRACE_PR("Equal transport id's"); scst_set_invalid_field_in_parm_list(cmd, 24, 0); goto out; } reg_move = scst_pr_find_reg(dev, transport_id_move, rel_tgt_id_move); - if (reg_move == NULL) { - reg_move = scst_pr_add_registrant(dev, transport_id_move, - rel_tgt_id_move, action_key, false); - if (reg_move == NULL) { + if (!reg_move) { + reg_move = scst_pr_add_registrant(dev, transport_id_move, rel_tgt_id_move, + action_key, false); + if (!reg_move) { scst_set_busy(cmd); goto out; } @@ -1925,13 +1843,11 @@ void scst_pr_register_and_move(struct scst_cmd *cmd, uint8_t *buffer, reg_move->key = action_key; } - TRACE_PR("Register and move: from initiator %s/%d (%p, tgt_dev %p) to " - "initiator %s/%d (%p, tgt_dev %p), key %016llx (unreg %d)", - debug_transport_id_to_initiator_name(reg->transport_id), - reg->rel_tgt_id, reg, reg->tgt_dev, - debug_transport_id_to_initiator_name(transport_id_move), - rel_tgt_id_move, reg_move, reg_move->tgt_dev, - be64_to_cpu(action_key), unreg); + TRACE_PR("Register and move: from initiator %s/%d (%p, tgt_dev %p) to initiator %s/%d (%p, tgt_dev %p), key %016llx (unreg %d)", + debug_transport_id_to_initiator_name(reg->transport_id), + reg->rel_tgt_id, reg, reg->tgt_dev, + debug_transport_id_to_initiator_name(transport_id_move), + rel_tgt_id_move, reg_move, reg_move->tgt_dev, be64_to_cpu(action_key), unreg); /* Move the holder */ scst_pr_set_holder(dev, reg_move, dev->pr_scope, dev->pr_type); @@ -1947,7 +1863,6 @@ void scst_pr_register_and_move(struct scst_cmd *cmd, uint8_t *buffer, out: TRACE_EXIT(); - return; } /* Called with dev_pr_mutex locked, no IRQ */ @@ -1969,65 +1884,56 @@ void scst_pr_reserve(struct scst_cmd *cmd, uint8_t *buffer, int buffer_size) if (buffer_size != 24) { TRACE_PR("Invalid buffer size %d", buffer_size); - scst_set_cmd_error(cmd, - SCST_LOAD_SENSE(scst_sense_parameter_list_length_invalid)); + scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_parameter_list_length_invalid)); goto out; } if (!scst_pr_type_valid(type)) { TRACE_PR("Invalid reservation type %d", type); - scst_set_invalid_field_in_cdb(cmd, 2, - SCST_INVAL_FIELD_BIT_OFFS_VALID | 0); + scst_set_invalid_field_in_cdb(cmd, 2, SCST_INVAL_FIELD_BIT_OFFS_VALID | 0); goto out; } if (scope != SCOPE_LU) { TRACE_PR("Invalid reservation scope %d", scope); - scst_set_invalid_field_in_cdb(cmd, 2, - SCST_INVAL_FIELD_BIT_OFFS_VALID | 4); + scst_set_invalid_field_in_cdb(cmd, 2, SCST_INVAL_FIELD_BIT_OFFS_VALID | 4); goto out; } reg = tgt_dev->registrant; - TRACE_PR("Reserve: initiator %s/%d (%p), key %016llx, scope %d, " - "type %d (tgt_dev %p)", - debug_transport_id_to_initiator_name(cmd->sess->transport_id), - cmd->sess->tgt->rel_tgt_id, reg, be64_to_cpu(key), scope, - type, tgt_dev); + TRACE_PR("Reserve: initiator %s/%d (%p), key %016llx, scope %d, type %d (tgt_dev %p)", + debug_transport_id_to_initiator_name(cmd->sess->transport_id), + cmd->sess->tgt->rel_tgt_id, reg, be64_to_cpu(key), scope, type, tgt_dev); /* We already checked reg is not NULL */ if (reg->key != key) { TRACE_PR("Registrant's %p key %016llx mismatch with %016llx", - reg, be64_to_cpu(reg->key), be64_to_cpu(key)); + reg, be64_to_cpu(reg->key), be64_to_cpu(key)); scst_set_cmd_error_status(cmd, SAM_STAT_RESERVATION_CONFLICT); goto out; } - if (!dev->pr_is_set) + if (!dev->pr_is_set) { scst_pr_set_holder(dev, reg, scope, type); - else { + } else { if (!scst_pr_is_holder(dev, reg)) { /* * This check also required by table "PERSISTENT * RESERVE OUT service actions that are allowed in the * presence of various reservations". */ - TRACE_PR("Only holder can override - reg %p is not a " - "holder", reg); - scst_set_cmd_error_status(cmd, - SAM_STAT_RESERVATION_CONFLICT); + TRACE_PR("Only holder can override - reg %p is not a holder", reg); + scst_set_cmd_error_status(cmd, SAM_STAT_RESERVATION_CONFLICT); goto out; } else { if (dev->pr_scope != scope || dev->pr_type != type) { - TRACE_PR("Error overriding scope or type for " - "reg %p", reg); - scst_set_cmd_error_status(cmd, - SAM_STAT_RESERVATION_CONFLICT); + TRACE_PR("Error overriding scope or type for reg %p", reg); + scst_set_cmd_error_status(cmd, SAM_STAT_RESERVATION_CONFLICT); goto out; - } else - TRACE_PR("Do nothing: reservation of reg %p " - "is the same", reg); + } else { + TRACE_PR("Do nothing: reservation of reg %p is the same", reg); + } } } @@ -2035,7 +1941,6 @@ void scst_pr_reserve(struct scst_cmd *cmd, uint8_t *buffer, int buffer_size) out: TRACE_EXIT(); - return; } /* Called with dev_pr_mutex locked, no IRQ */ @@ -2058,28 +1963,25 @@ void scst_pr_release(struct scst_cmd *cmd, uint8_t *buffer, int buffer_size) if (buffer_size != 24) { TRACE_PR("Invalid buffer size %d", buffer_size); - scst_set_cmd_error(cmd, - SCST_LOAD_SENSE(scst_sense_parameter_list_length_invalid)); + scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_parameter_list_length_invalid)); goto out; } if (!dev->pr_is_set) { - TRACE_PR("%s", "There is no PR - do nothing"); + TRACE_PR("There is no PR - do nothing"); goto out; } reg = tgt_dev->registrant; - TRACE_PR("Release: initiator %s/%d (%p), key %016llx, scope %d, type " - "%d (tgt_dev %p)", debug_transport_id_to_initiator_name( - cmd->sess->transport_id), - cmd->sess->tgt->rel_tgt_id, reg, be64_to_cpu(key), scope, - type, tgt_dev); + TRACE_PR("Release: initiator %s/%d (%p), key %016llx, scope %d, type %d (tgt_dev %p)", + debug_transport_id_to_initiator_name(cmd->sess->transport_id), + cmd->sess->tgt->rel_tgt_id, reg, be64_to_cpu(key), scope, type, tgt_dev); /* We already checked reg is not NULL */ if (reg->key != key) { TRACE_PR("Registrant's %p key %016llx mismatch with %016llx", - reg, be64_to_cpu(reg->key), be64_to_cpu(key)); + reg, be64_to_cpu(reg->key), be64_to_cpu(key)); scst_set_cmd_error_status(cmd, SAM_STAT_RESERVATION_CONFLICT); goto out; } @@ -2090,10 +1992,8 @@ void scst_pr_release(struct scst_cmd *cmd, uint8_t *buffer, int buffer_size) } if (dev->pr_scope != scope || dev->pr_type != type) { - TRACE_PR("%s", "Released scope or type do not match with " - "holder"); - scst_set_cmd_error(cmd, - SCST_LOAD_SENSE(scst_sense_invalid_release)); + TRACE_PR("Released scope or type do not match with holder"); + scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_invalid_release)); goto out; } @@ -2106,15 +2006,13 @@ void scst_pr_release(struct scst_cmd *cmd, uint8_t *buffer, int buffer_size) case TYPE_EXCLUSIVE_ACCESS_REGONLY: case TYPE_WRITE_EXCLUSIVE_ALL_REG: case TYPE_EXCLUSIVE_ACCESS_ALL_REG: - scst_pr_send_ua_all(dev, reg, - SCST_LOAD_SENSE(scst_sense_reservation_released)); + scst_pr_send_ua_all(dev, reg, SCST_LOAD_SENSE(scst_sense_reservation_released)); } scst_pr_dump_prs(dev, false); out: TRACE_EXIT(); - return; } /* Called with dev_pr_mutex locked, no IRQ */ @@ -2133,32 +2031,28 @@ void scst_pr_clear(struct scst_cmd *cmd, uint8_t *buffer, int buffer_size) if (buffer_size != 24) { TRACE_PR("Invalid buffer size %d", buffer_size); - scst_set_cmd_error(cmd, - SCST_LOAD_SENSE(scst_sense_parameter_list_length_invalid)); + scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_parameter_list_length_invalid)); goto out; } reg = tgt_dev->registrant; TRACE_PR("Clear: initiator %s/%d (%p), key %016llx (tgt_dev %p)", - debug_transport_id_to_initiator_name(cmd->sess->transport_id), - cmd->sess->tgt->rel_tgt_id, reg, be64_to_cpu(key), tgt_dev); + debug_transport_id_to_initiator_name(cmd->sess->transport_id), + cmd->sess->tgt->rel_tgt_id, reg, be64_to_cpu(key), tgt_dev); /* We already checked reg is not NULL */ if (reg->key != key) { TRACE_PR("Registrant's %p key %016llx mismatch with %016llx", - reg, be64_to_cpu(reg->key), be64_to_cpu(key)); + reg, be64_to_cpu(reg->key), be64_to_cpu(key)); scst_set_cmd_error_status(cmd, SAM_STAT_RESERVATION_CONFLICT); goto out; } - scst_pr_send_ua_all(dev, reg, - SCST_LOAD_SENSE(scst_sense_reservation_preempted)); + scst_pr_send_ua_all(dev, reg, SCST_LOAD_SENSE(scst_sense_reservation_preempted)); - list_for_each_entry_safe(r, t, &dev->dev_registrants_list, - dev_registrants_list_entry) { + list_for_each_entry_safe(r, t, &dev->dev_registrants_list, dev_registrants_list_entry) scst_pr_remove_registrant(dev, r); - } dev->pr_generation++; @@ -2166,11 +2060,9 @@ void scst_pr_clear(struct scst_cmd *cmd, uint8_t *buffer, int buffer_size) out: TRACE_EXIT(); - return; } -static void scst_pr_do_preempt(struct scst_cmd *cmd, uint8_t *buffer, - int buffer_size, bool abort) +static void scst_pr_do_preempt(struct scst_cmd *cmd, uint8_t *buffer, int buffer_size, bool abort) { __be64 key, action_key; int scope, type; @@ -2185,8 +2077,7 @@ static void scst_pr_do_preempt(struct scst_cmd *cmd, uint8_t *buffer, if (buffer_size != 24) { TRACE_PR("Invalid buffer size %d", buffer_size); - scst_set_cmd_error(cmd, - SCST_LOAD_SENSE(scst_sense_parameter_list_length_invalid)); + scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_parameter_list_length_invalid)); goto out; } @@ -2197,39 +2088,36 @@ static void scst_pr_do_preempt(struct scst_cmd *cmd, uint8_t *buffer, if (!scst_pr_type_valid(type)) { TRACE_PR("Invalid reservation type %d", type); - scst_set_invalid_field_in_cdb(cmd, 1, - SCST_INVAL_FIELD_BIT_OFFS_VALID | 0); + scst_set_invalid_field_in_cdb(cmd, 1, SCST_INVAL_FIELD_BIT_OFFS_VALID | 0); goto out; } reg = tgt_dev->registrant; - TRACE_PR("Preempt%s: initiator %s/%d (%p), key %016llx, action_key " - "%016llx, scope %x type %x (tgt_dev %p)", - abort ? " and abort" : "", - debug_transport_id_to_initiator_name(cmd->sess->transport_id), - cmd->sess->tgt->rel_tgt_id, reg, be64_to_cpu(key), - be64_to_cpu(action_key), scope, type, tgt_dev); + TRACE_PR("Preempt%s: initiator %s/%d (%p), key %016llx, action_key %016llx, scope %x type %x (tgt_dev %p)", + abort ? " and abort" : "", + debug_transport_id_to_initiator_name(cmd->sess->transport_id), + cmd->sess->tgt->rel_tgt_id, reg, be64_to_cpu(key), + be64_to_cpu(action_key), scope, type, tgt_dev); /* We already checked reg is not NULL */ if (reg->key != key) { TRACE_PR("Registrant's %p key %016llx mismatch with %016llx", - reg, be64_to_cpu(reg->key), be64_to_cpu(key)); + reg, be64_to_cpu(reg->key), be64_to_cpu(key)); scst_set_cmd_error_status(cmd, SAM_STAT_RESERVATION_CONFLICT); goto out; } if (!dev->pr_is_set) { - scst_pr_find_registrants_list_key(dev, action_key, - &preempt_list); + scst_pr_find_registrants_list_key(dev, action_key, &preempt_list); if (list_empty(&preempt_list)) goto out_error; list_for_each_entry_safe(r, rt, &preempt_list, aux_list_entry) { if (abort) scst_pr_abort_reg(dev, cmd, r); if (r != reg) { - scst_pr_send_ua_reg(dev, r, SCST_LOAD_SENSE( - scst_sense_registrations_preempted)); + scst_pr_send_ua_reg(dev, r, + SCST_LOAD_SENSE(scst_sense_registrations_preempted)); scst_pr_remove_registrant(dev, r); } } @@ -2239,32 +2127,26 @@ static void scst_pr_do_preempt(struct scst_cmd *cmd, uint8_t *buffer, if (dev->pr_type == TYPE_WRITE_EXCLUSIVE_ALL_REG || dev->pr_type == TYPE_EXCLUSIVE_ACCESS_ALL_REG) { if (action_key == 0) { - scst_pr_find_registrants_list_all(dev, reg, - &preempt_list); - list_for_each_entry_safe(r, rt, &preempt_list, - aux_list_entry) { + scst_pr_find_registrants_list_all(dev, reg, &preempt_list); + list_for_each_entry_safe(r, rt, &preempt_list, aux_list_entry) { sBUG_ON(r == reg); if (abort) scst_pr_abort_reg(dev, cmd, r); scst_pr_send_ua_reg(dev, r, - SCST_LOAD_SENSE( - scst_sense_registrations_preempted)); + SCST_LOAD_SENSE(scst_sense_registrations_preempted)); scst_pr_remove_registrant(dev, r); } scst_pr_set_holder(dev, reg, scope, type); } else { - scst_pr_find_registrants_list_key(dev, action_key, - &preempt_list); + scst_pr_find_registrants_list_key(dev, action_key, &preempt_list); if (list_empty(&preempt_list)) goto out_error; - list_for_each_entry_safe(r, rt, &preempt_list, - aux_list_entry) { + list_for_each_entry_safe(r, rt, &preempt_list, aux_list_entry) { if (abort) scst_pr_abort_reg(dev, cmd, r); if (r != reg) { scst_pr_send_ua_reg(dev, r, - SCST_LOAD_SENSE( - scst_sense_registrations_preempted)); + SCST_LOAD_SENSE(scst_sense_registrations_preempted)); scst_pr_remove_registrant(dev, r); } } @@ -2277,33 +2159,29 @@ static void scst_pr_do_preempt(struct scst_cmd *cmd, uint8_t *buffer, scst_set_invalid_field_in_parm_list(cmd, 8, 0); goto out; } else { - scst_pr_find_registrants_list_key(dev, action_key, - &preempt_list); + scst_pr_find_registrants_list_key(dev, action_key, &preempt_list); if (list_empty(&preempt_list)) goto out_error; - list_for_each_entry_safe(r, rt, &preempt_list, - aux_list_entry) { + list_for_each_entry_safe(r, rt, &preempt_list, aux_list_entry) { if (abort) scst_pr_abort_reg(dev, cmd, r); if (r != reg) scst_pr_send_ua_reg(dev, r, - SCST_LOAD_SENSE( - scst_sense_registrations_preem... [truncated message content] |
From: Gleb C. <lna...@ya...> - 2025-09-09 09:21:54
|
Commit: 5072f0c GitHub URL: https://github.com/SCST-project/scst/commit/5072f0ce5819fca7139f999c4bccd0b5cbe2a208 Author: Gleb Chesnokov Date: 2025-09-09T12:21:23+03:00 Log Message: ----------- scst_copy_mgr: Fix multiple checkpatch warnings This patch does not change any functionality. Modified Paths: -------------- scst/src/scst_copy_mgr.c | 791 +++++++-------- 1 file changed, 352 insertions(+), 439 deletions(-) =================================================================== diff --git a/scst/src/scst_copy_mgr.c b/scst/src/scst_copy_mgr.c index 38e08a2..fc217fa 100644 --- a/scst/src/scst_copy_mgr.c +++ b/scst/src/scst_copy_mgr.c @@ -21,21 +21,21 @@ #undef DEFAULT_SYMBOL_NAMESPACE #define DEFAULT_SYMBOL_NAMESPACE SCST_NAMESPACE -#define SCST_CM_NAME "copy_manager" -#define SCST_CM_TGT_NAME (SCST_CM_NAME "_tgt") -#define SCST_CM_SESS_NAME (SCST_CM_NAME "_sess") +#define SCST_CM_NAME "copy_manager" +#define SCST_CM_TGT_NAME (SCST_CM_NAME "_tgt") +#define SCST_CM_SESS_NAME (SCST_CM_NAME "_sess") -#define SCST_CM_TID_SIZE 24 -#define SCST_CM_TID_ID "COPY_MGR" +#define SCST_CM_TID_SIZE 24 +#define SCST_CM_TID_ID "COPY_MGR" -#define SCST_CM_RETRIES_WAIT HZ -#define SCST_CM_MAX_RETRIES_TIME (30*HZ) -#define SCST_CM_ID_KEEP_TIME (5*HZ) +#define SCST_CM_RETRIES_WAIT HZ +#define SCST_CM_MAX_RETRIES_TIME (30 * HZ) +#define SCST_CM_ID_KEEP_TIME (5 * HZ) -#define SCST_CM_MAX_EACH_IO_SIZE (512*1024) +#define SCST_CM_MAX_EACH_IO_SIZE (512 * 1024) /* Too big value is not too good for the blocking machinery */ -#define SCST_CM_MAX_TGT_DESCR_CNT 5 +#define SCST_CM_MAX_TGT_DESCR_CNT 5 #define SCST_CM_MAX_SEG_DESCR_CNT \ (((PAGE_SIZE * 2) - sizeof(struct scst_cm_ec_cmd_priv)) / \ @@ -201,15 +201,14 @@ static void scst_cm_retry_work_fn(struct work_struct *work) kfree(retry); TRACE_EXIT(); - return; } /* * Checks if cmd finished successfully and performs/schedules retry, if necessary. * Returns one of SCST_CM_STATUS_* codes. */ -static int scst_cm_err_check_retry(struct scst_cmd *cmd, - unsigned long start_time, scst_cm_retry_fn_t retry_fn) +static int scst_cm_err_check_retry(struct scst_cmd *cmd, unsigned long start_time, + scst_cm_retry_fn_t retry_fn) { int res = SCST_CM_STATUS_CMD_SUCCEEDED; unsigned long cur_time, max_retry_time, next_retry_time; @@ -220,10 +219,10 @@ static int scst_cm_err_check_retry(struct scst_cmd *cmd, /* cmd->dev and tgt_dev can be NULL here! */ - TRACE_DBG("cmd %p, status %d, aborted %d", cmd, cmd->status, - scst_cmd_aborted(cmd)); + TRACE_DBG("cmd %p, status %d, aborted %d", + cmd, cmd->status, scst_cmd_aborted(cmd)); - if (likely((cmd->status == 0) && !scst_cmd_aborted(cmd))) + if (likely(cmd->status == 0 && !scst_cmd_aborted(cmd))) goto out; cur_time = jiffies; @@ -233,8 +232,8 @@ static int scst_cm_err_check_retry(struct scst_cmd *cmd, if (test_bit(SCST_CMD_ABORTED, &cmd->cmd_flags)) { if (test_bit(SCST_CMD_ABORTED_OTHER, &cmd->cmd_flags)) { - TRACE_MGMT_DBG("Cmd %p aborted by other initiator, " - "retry possible", cmd); + TRACE_MGMT_DBG("Cmd %p aborted by other initiator, retry possible", + cmd); goto try_retry; } else { TRACE_MGMT_DBG("Cmd %p aborted, no retry ", cmd); @@ -242,21 +241,21 @@ static int scst_cm_err_check_retry(struct scst_cmd *cmd, } } - if ((cmd->status == SAM_STAT_BUSY) || - (cmd->status == SAM_STAT_TASK_SET_FULL) || - (cmd->status == SAM_STAT_RESERVATION_CONFLICT) || - (cmd->status == SAM_STAT_ACA_ACTIVE)) { + if (cmd->status == SAM_STAT_BUSY || + cmd->status == SAM_STAT_TASK_SET_FULL || + cmd->status == SAM_STAT_RESERVATION_CONFLICT || + cmd->status == SAM_STAT_ACA_ACTIVE) { TRACE_DBG("Cmd %p finished with status %d, retry possible", - cmd, cmd->status); + cmd, cmd->status); goto try_retry; } - if ((cmd->status == SAM_STAT_CHECK_CONDITION) && - scst_sense_valid(cmd->sense) && - scst_analyze_sense(cmd->sense, cmd->sense_valid_len, - SCST_SENSE_KEY_VALID, UNIT_ATTENTION, 0, 0)) { - TRACE_DBG("Cmd %p finished with UA, immediate retry " - "possible", cmd); + if (cmd->status == SAM_STAT_CHECK_CONDITION && + scst_sense_valid(cmd->sense) && + scst_analyze_sense(cmd->sense, cmd->sense_valid_len, SCST_SENSE_KEY_VALID, + UNIT_ATTENTION, 0, 0)) { + TRACE_DBG("Cmd %p finished with UA, immediate retry possible", + cmd); imm_retry = true; goto try_retry; } @@ -277,20 +276,18 @@ try_retry: next_retry_time = cur_time + SCST_CM_RETRIES_WAIT; - TRACE_DBG("Retrying cmd %p (imm_retry %d, next_retry_time %ld, " - "cur_time %ld, start_time %ld, max_retry_time %ld): going " - "to sleep", cmd, imm_retry, next_retry_time, cur_time, - start_time, max_retry_time); + TRACE_DBG("Retrying cmd %p (imm_retry %d, next_retry_time %ld, cur_time %ld, start_time %ld, max_retry_time %ld): going to sleep", + cmd, imm_retry, next_retry_time, cur_time, start_time, max_retry_time); mutex_unlock(&scst_cm_mutex); - if (retry_fn == NULL) + if (!retry_fn) goto out_retry_done; /* Wait before retry */ retry = kzalloc(sizeof(*retry), GFP_KERNEL); - if (retry == NULL) { + if (!retry) { PRINT_ERROR("Unable to allocate retry struct"); scst_set_busy(cmd); goto out_failed; @@ -306,8 +303,7 @@ try_retry: schedule_work(&retry->cm_retry_work.work); } else { TRACE_DBG("Scheduling cmd %p retry", cmd); - schedule_delayed_work(&retry->cm_retry_work, - next_retry_time - cur_time); + schedule_delayed_work(&retry->cm_retry_work, next_retry_time - cur_time); } out_retry_done: @@ -326,10 +322,11 @@ static bool scst_cm_is_ec_cmd_done(struct scst_cmd *ec_cmd) res = true; } else if (unlikely(ec_cmd->completed)) { TRACE_MGMT_DBG("EC cmd %p already completed with status (%d)", - ec_cmd, ec_cmd->status); + ec_cmd, ec_cmd->status); res = true; - } else + } else { res = false; + } TRACE_EXIT_RES(res); return res; @@ -351,8 +348,8 @@ static int scst_cm_setup_this_data_descr(struct scst_cmd *ec_cmd) TRACE_ENTRY(); - TRACE_DBG("ec_cmd %p, cm_cur_data_descr %d", ec_cmd, - priv->cm_cur_data_descr); + TRACE_DBG("ec_cmd %p, cm_cur_data_descr %d", + ec_cmd, priv->cm_cur_data_descr); EXTRACHECKS_BUG_ON(priv->cm_cur_data_descr > priv->cm_data_descrs_cnt); @@ -377,14 +374,13 @@ static int scst_cm_setup_this_data_descr(struct scst_cmd *ec_cmd) priv->cm_start_write_lba = dd->dst_lba; TRACE_DBG("len %d, src_lba %lld, dst_lba %lld", dd->data_len, - (long long)dd->src_lba, (long long)dd->dst_lba); - - if (unlikely((dd->data_len & (sd->src_tgt_dev->dev->block_size-1)) != 0) || - unlikely((dd->data_len & (sd->dst_tgt_dev->dev->block_size-1)) != 0)) { - PRINT_ERROR("Data len %d is not even for block size (src block " - "size %d, dst block size %d)", dd->data_len, - sd->src_tgt_dev->dev->block_size, - sd->dst_tgt_dev->dev->block_size); + (long long)dd->src_lba, (long long)dd->dst_lba); + + if (unlikely((dd->data_len & (sd->src_tgt_dev->dev->block_size - 1)) != 0) || + unlikely((dd->data_len & (sd->dst_tgt_dev->dev->block_size - 1)) != 0)) { + PRINT_ERROR("Data len %d is not even for block size (src block size %d, dst block size %d)", + dd->data_len, sd->src_tgt_dev->dev->block_size, + sd->dst_tgt_dev->dev->block_size); scst_set_cmd_error(ec_cmd, SCST_LOAD_SENSE(scst_sense_hardw_error)); res = -EINVAL; goto out; @@ -451,12 +447,12 @@ static void scst_cm_destroy_data_descrs(struct scst_cmd *ec_cmd) TRACE_ENTRY(); - TRACE_DBG("ec_cmd %p, data_descrs %p, data_descrs_cnt %d ", ec_cmd, - priv->cm_data_descrs, priv->cm_data_descrs_cnt); + TRACE_DBG("ec_cmd %p, data_descrs %p, data_descrs_cnt %d ", + ec_cmd, priv->cm_data_descrs, priv->cm_data_descrs_cnt); if (priv->cm_data_descrs != &priv->cm_seg_descrs[priv->cm_cur_seg_descr].data_descr) { - TRACE_DBG_FLAG(TRACE_DEBUG|TRACE_MEMORY, "Freeing " - "data_descrs %p", priv->cm_data_descrs); + TRACE_DBG_FLAG(TRACE_DEBUG | TRACE_MEMORY, "Freeing data_descrs %p", + priv->cm_data_descrs); kfree(priv->cm_data_descrs); } @@ -464,7 +460,6 @@ static void scst_cm_destroy_data_descrs(struct scst_cmd *ec_cmd) priv->cm_data_descrs_cnt = 0; TRACE_EXIT(); - return; } /* @@ -475,7 +470,7 @@ static void scst_cm_destroy_data_descrs(struct scst_cmd *ec_cmd) * and sense supposed to be set. */ static int scst_cm_setup_data_descrs(struct scst_cmd *ec_cmd, - const struct scst_ext_copy_data_descr *dds, int dds_cnt) + const struct scst_ext_copy_data_descr *dds, int dds_cnt) { int res; struct scst_cm_ec_cmd_priv *priv = ec_cmd->cmd_data_descriptors; @@ -517,8 +512,8 @@ static int scst_cm_setup_seg_descr(struct scst_cmd *ec_cmd) TRACE_ENTRY(); - TRACE_DBG("ec_cmd %p, cm_cur_seg_descr %d", ec_cmd, - priv->cm_cur_seg_descr); + TRACE_DBG("ec_cmd %p, cm_cur_seg_descr %d", + ec_cmd, priv->cm_cur_seg_descr); EXTRACHECKS_BUG_ON(priv->cm_cur_seg_descr > ec_cmd->cmd_data_descriptors_cnt); @@ -532,11 +527,11 @@ static int scst_cm_setup_seg_descr(struct scst_cmd *ec_cmd) break; priv->cm_cur_seg_descr++; - TRACE_DBG("ec_cmd %p, cm_cur_seg_descr %d", ec_cmd, - priv->cm_cur_seg_descr); + TRACE_DBG("ec_cmd %p, cm_cur_seg_descr %d", + ec_cmd, priv->cm_cur_seg_descr); } - if (priv->cm_list_id != NULL) { + if (priv->cm_list_id) { /* SCSI: including the being processed one */ priv->cm_list_id->cm_segs_processed = priv->cm_cur_seg_descr + 1; } @@ -569,7 +564,6 @@ static void scst_cm_advance_seg_descr(struct scst_cmd *ec_cmd) priv->cm_cur_seg_descr++; TRACE_EXIT(); - return; } static void scst_cm_prepare_final_sense(struct scst_cmd *ec_cmd) @@ -586,18 +580,16 @@ static void scst_cm_prepare_final_sense(struct scst_cmd *ec_cmd) if (likely(priv->cm_error == SCST_CM_ERROR_NONE)) goto out; - TRACE_DBG("ec_cmd %p, cm_error %d, sense_to_copy %d", ec_cmd, - priv->cm_error, sense_to_copy); + TRACE_DBG("ec_cmd %p, cm_error %d, sense_to_copy %d", + ec_cmd, priv->cm_error, sense_to_copy); if (sense_to_copy > (SCST_SENSE_BUFFERSIZE - 18)) { - PRINT_WARNING("Too small sense buffer, %d bytes will be " - "truncated (ec_cmd %p)", - sense_to_copy - (SCST_SENSE_BUFFERSIZE-18), ec_cmd); + PRINT_WARNING("Too small sense buffer, %d bytes will be truncated (ec_cmd %p)", + sense_to_copy - (SCST_SENSE_BUFFERSIZE - 18), ec_cmd); sense_to_copy = SCST_SENSE_BUFFERSIZE - 18; } - if ((priv->cm_error == SCST_CM_ERROR_WRITE) && - (ec_cmd->status != SAM_STAT_CHECK_CONDITION)) { + if (priv->cm_error == SCST_CM_ERROR_WRITE && ec_cmd->status != SAM_STAT_CHECK_CONDITION) { int rc; struct scst_ext_copy_seg_descr *sd = &priv->cm_seg_descrs[priv->cm_cur_seg_descr]; @@ -607,9 +599,9 @@ static void scst_cm_prepare_final_sense(struct scst_cmd *ec_cmd) if (rc != 0) goto out; - TRACE_DBG("d_sense %d, cm_cur_seg_descr %d, cur_data_descr %d, " - "tgt_descr_offs %d", d_sense, priv->cm_cur_seg_descr, - priv->cm_cur_data_descr, sd->tgt_descr_offs); + TRACE_DBG("d_sense %d, cm_cur_seg_descr %d, cur_data_descr %d, tgt_descr_offs %d", + d_sense, priv->cm_cur_seg_descr, priv->cm_cur_data_descr, + sd->tgt_descr_offs); if (d_sense) { /* Descriptor format */ @@ -650,10 +642,9 @@ static void scst_cm_prepare_final_sense(struct scst_cmd *ec_cmd) } fsense = mempool_alloc(scst_sense_mempool, GFP_KERNEL); - if (fsense == NULL) { - PRINT_ERROR("Allocation of the intermediate Extended Copy " - "sense buffer failed. Reported sense data can be " - "incorrect (ec_cmd %p)", ec_cmd); + if (!fsense) { + PRINT_ERROR("Allocation of the intermediate Extended Copy sense buffer failed. Reported sense data can be incorrect (ec_cmd %p)", + ec_cmd); goto out; } memset(fsense, 0, SCST_SENSE_BUFFERSIZE); @@ -683,8 +674,9 @@ static void scst_cm_prepare_final_sense(struct scst_cmd *ec_cmd) } else if (priv->cm_error == SCST_CM_ERROR_WRITE) { fsense[9] = 18; copy_sense = scst_sense_valid(ec_cmd->sense); - } else + } else { sBUG(); + } if (copy_sense) { TRACE_DBG("Copying %db of old sense", sense_to_copy); @@ -700,17 +692,17 @@ static void scst_cm_prepare_final_sense(struct scst_cmd *ec_cmd) fsense[7] = add_sense_len; /* additional Sense Length */ ec_cmd->status = SAM_STAT_CHECK_CONDITION; - if (ec_cmd->sense != NULL) { + if (ec_cmd->sense) { memcpy(ec_cmd->sense, fsense, sense_len); ec_cmd->sense_valid_len = sense_len; - } else + } else { scst_alloc_set_sense(ec_cmd, 0, fsense, sense_len); + } mempool_free(fsense, scst_sense_mempool); out: TRACE_EXIT(); - return; } static void scst_cm_store_list_id_details(struct scst_cmd *ec_cmd) @@ -720,10 +712,10 @@ static void scst_cm_store_list_id_details(struct scst_cmd *ec_cmd) TRACE_ENTRY(); - if (l != NULL) { - TRACE_DBG("List id %p done (status %d, sense valid %d, sense " - "len %d)", l, ec_cmd->status, scst_sense_valid(ec_cmd->sense), - ec_cmd->sense_valid_len); + if (l) { + TRACE_DBG("List id %p done (status %d, sense valid %d, sense len %d)", + l, ec_cmd->status, scst_sense_valid(ec_cmd->sense), + ec_cmd->sense_valid_len); spin_lock_irq(&scst_cm_lock); l->cm_list_id_state = SCST_CM_LIST_ID_STATE_DONE; if (ec_cmd->status != 0) { @@ -732,10 +724,8 @@ static void scst_cm_store_list_id_details(struct scst_cmd *ec_cmd) int len = ec_cmd->sense_valid_len; if (len > sizeof(l->cm_sense)) { - PRINT_WARNING("EC command's sense is " - "too big (%d) with max allowed " - "%d, truncating", len, - (int)sizeof(l->cm_sense)); + PRINT_WARNING("EC command's sense is too big (%d) with max allowed %d, truncating", + len, (int)sizeof(l->cm_sense)); len = sizeof(l->cm_sense); } l->cm_sense_len = ec_cmd->sense_valid_len; @@ -746,7 +736,6 @@ static void scst_cm_store_list_id_details(struct scst_cmd *ec_cmd) } TRACE_EXIT(); - return; } static void scst_cm_ec_cmd_done(struct scst_cmd *ec_cmd) @@ -760,7 +749,7 @@ static void scst_cm_ec_cmd_done(struct scst_cmd *ec_cmd) TRACE_DBG("ec_cmd %p finished with status %d", ec_cmd, ec_cmd->status); EXTRACHECKS_BUG_ON(priv->cm_cur_in_flight != 0); - EXTRACHECKS_BUG_ON(priv->cm_data_descrs != NULL); + EXTRACHECKS_BUG_ON(priv->cm_data_descrs); scst_cm_prepare_final_sense(ec_cmd); scst_cm_store_list_id_details(ec_cmd); @@ -769,7 +758,6 @@ static void scst_cm_ec_cmd_done(struct scst_cmd *ec_cmd) ec_cmd->scst_cmd_done(ec_cmd, SCST_CMD_STATE_DEFAULT, SCST_CONTEXT_THREAD); TRACE_EXIT(); - return; } static void scst_cm_ec_sched_next_seg(struct scst_cmd *ec_cmd) @@ -787,7 +775,6 @@ static void scst_cm_ec_sched_next_seg(struct scst_cmd *ec_cmd) scst_cm_ext_copy_exec(ec_cmd); TRACE_EXIT(); - return; } static void scst_cm_in_flight_cmd_finished(struct scst_cmd *ec_cmd) @@ -809,19 +796,18 @@ static void scst_cm_in_flight_cmd_finished(struct scst_cmd *ec_cmd) if (f > 0) goto out; - if (priv->cm_list_id != NULL) + if (priv->cm_list_id) priv->cm_list_id->cm_written_size += priv->cm_written; scst_cm_ec_sched_next_seg(ec_cmd); out: TRACE_EXIT(); - return; } -static int scst_cm_add_to_internal_cmd_list(struct scst_cmd *cmd, - struct scst_cmd *ec_cmd, struct scst_cmd *orig_cmd, - scst_i_finish_fn_t finish_fn) +static int scst_cm_add_to_internal_cmd_list(struct scst_cmd *cmd, struct scst_cmd *ec_cmd, + struct scst_cmd *orig_cmd, + scst_i_finish_fn_t finish_fn) { int res; struct scst_cm_ec_cmd_priv *priv = ec_cmd->cmd_data_descriptors; @@ -832,9 +818,9 @@ static int scst_cm_add_to_internal_cmd_list(struct scst_cmd *cmd, EXTRACHECKS_BUG_ON(ec_cmd == cmd); p = kzalloc(sizeof(*p), GFP_KERNEL); - if (p == NULL) { - PRINT_ERROR("Unable to alloc scst_cm_internal_cmd_priv " - "(size %d)", (int)sizeof(*p)); + if (!p) { + PRINT_ERROR("Unable to alloc scst_cm_internal_cmd_priv (size %d)", + (int)sizeof(*p)); goto out_enomem; } @@ -843,7 +829,7 @@ static int scst_cm_add_to_internal_cmd_list(struct scst_cmd *cmd, p->cm_cmd = cmd; TRACE_DBG("Adding internal cmd %p (priv %p, ec_cmd %p, orig_cmd %p)", - cmd, p, ec_cmd, orig_cmd); + cmd, p, ec_cmd, orig_cmd); spin_lock_irq(&scst_cm_lock); list_add_tail(&p->cm_internal_cmd_list_entry, &priv->cm_internal_cmd_list); spin_unlock_irq(&scst_cm_lock); @@ -862,16 +848,14 @@ out_enomem: goto out; } -static void scst_cm_del_free_from_internal_cmd_list(struct scst_cmd *cmd, - bool unblock_dev) +static void scst_cm_del_free_from_internal_cmd_list(struct scst_cmd *cmd, bool unblock_dev) { struct scst_cm_internal_cmd_priv *p = cmd->tgt_i_priv; TRACE_ENTRY(); - TRACE_DBG("Deleting/freeing internal cmd %p (op %s, priv %p, " - "orig_cmd %p)", cmd, scst_get_opcode_name(cmd), p, - p->cm_orig_cmd); + TRACE_DBG("Deleting/freeing internal cmd %p (op %s, priv %p, orig_cmd %p)", + cmd, scst_get_opcode_name(cmd), p, p->cm_orig_cmd); spin_lock_irq(&scst_cm_lock); list_del(&p->cm_internal_cmd_list_entry); @@ -887,14 +871,12 @@ static void scst_cm_del_free_from_internal_cmd_list(struct scst_cmd *cmd, kfree(p); TRACE_EXIT(); - return; } static void scst_cm_read_cmd_finished(struct scst_cmd *rcmd); /* cm_mutex suppose to be locked */ -static int __scst_cm_push_single_read(struct scst_cmd *ec_cmd, - int64_t lba, int blocks) +static int __scst_cm_push_single_read(struct scst_cmd *ec_cmd, int64_t lba, int blocks) { int res; struct scst_cm_ec_cmd_priv *priv = ec_cmd->cmd_data_descriptors; @@ -909,8 +891,7 @@ static int __scst_cm_push_single_read(struct scst_cmd *ec_cmd, TRACE_ENTRY(); if (unlikely(scst_cm_is_ec_cmd_done(ec_cmd))) { - TRACE_MGMT_DBG("EC cmd %p done: aborting further read " - "commands", ec_cmd); + TRACE_MGMT_DBG("EC cmd %p done: aborting further read commands", ec_cmd); priv->cm_left_to_read = 0; res = -EPIPE; goto out; @@ -936,10 +917,9 @@ static int __scst_cm_push_single_read(struct scst_cmd *ec_cmd, /* No app tag check */ } - rcmd = __scst_create_prepare_internal_cmd(read_cdb, - cdb_len, SCST_CMD_QUEUE_SIMPLE, - priv->cm_read_tgt_dev, GFP_KERNEL, false); - if (rcmd == NULL) { + rcmd = __scst_create_prepare_internal_cmd(read_cdb, cdb_len, SCST_CMD_QUEUE_SIMPLE, + priv->cm_read_tgt_dev, GFP_KERNEL, false); + if (!rcmd) { res = -ENOMEM; goto out_busy; } @@ -952,14 +932,12 @@ static int __scst_cm_push_single_read(struct scst_cmd *ec_cmd, rcmd->expected_transfer_len_full += len >> (block_shift - SCST_DIF_TAG_SHIFT); rcmd->expected_values_set = 1; - res = scst_cm_add_to_internal_cmd_list(rcmd, ec_cmd, ec_cmd, - scst_cm_read_cmd_finished); + res = scst_cm_add_to_internal_cmd_list(rcmd, ec_cmd, ec_cmd, scst_cm_read_cmd_finished); if (res != 0) goto out_free_rcmd; - TRACE_DBG("Adding ec_cmd's (%p) READ rcmd %p (lba %lld, blocks %d, " - "check_dif %d) to active cmd list", ec_cmd, rcmd, - (long long)rcmd->lba, blocks, check_dif); + TRACE_DBG("Adding ec_cmd's (%p) READ rcmd %p (lba %lld, blocks %d, check_dif %d) to active cmd list", + ec_cmd, rcmd, (long long)rcmd->lba, blocks, check_dif); spin_lock_irq(&rcmd->cmd_threads->cmd_list_lock); list_add_tail(&rcmd->cmd_list_entry, &rcmd->cmd_threads->active_cmd_list); spin_unlock_irq(&rcmd->cmd_threads->cmd_list_lock); @@ -991,7 +969,7 @@ static void scst_cm_read_retry_fn(struct scst_cmd *rcmd) mutex_lock(&priv->cm_mutex); rc = __scst_cm_push_single_read(ec_cmd, rcmd->lba, - rcmd->data_len >> priv->cm_read_tgt_dev->dev->block_shift); + rcmd->data_len >> priv->cm_read_tgt_dev->dev->block_shift); /* ec_cmd can get dead after we will drop cm_mutex! */ scst_cm_del_free_from_internal_cmd_list(rcmd, false); @@ -1004,11 +982,10 @@ static void scst_cm_read_retry_fn(struct scst_cmd *rcmd) scst_cm_in_flight_cmd_finished(ec_cmd); TRACE_EXIT(); - return; } -static int scst_cm_push_single_write(struct scst_cmd *ec_cmd, - int64_t lba, int blocks, struct scst_cmd *rcmd); +static int scst_cm_push_single_write(struct scst_cmd *ec_cmd, int64_t lba, int blocks, + struct scst_cmd *rcmd); static void scst_cm_write_retry_fn(struct scst_cmd *wcmd) { @@ -1024,8 +1001,8 @@ static void scst_cm_write_retry_fn(struct scst_cmd *wcmd) mutex_lock(&priv->cm_mutex); rc = scst_cm_push_single_write(ec_cmd, wcmd->lba, - wcmd->data_len >> priv->cm_write_tgt_dev->dev->block_shift, - rcmd); + wcmd->data_len >> priv->cm_write_tgt_dev->dev->block_shift, + rcmd); /* ec_cmd can get dead after we will drop cm_mutex! */ scst_cm_del_free_from_internal_cmd_list(wcmd, false); @@ -1038,11 +1015,9 @@ static void scst_cm_write_retry_fn(struct scst_cmd *wcmd) scst_cm_in_flight_cmd_finished(ec_cmd); TRACE_EXIT(); - return; } -static int scst_cm_push_single_read(struct scst_cmd *ec_cmd, int blocks, - bool inc_cur_in_flight); +static int scst_cm_push_single_read(struct scst_cmd *ec_cmd, int blocks, bool inc_cur_in_flight); static void scst_cm_write_cmd_finished(struct scst_cmd *wcmd) { @@ -1056,7 +1031,7 @@ static void scst_cm_write_cmd_finished(struct scst_cmd *wcmd) TRACE_ENTRY(); TRACE_DBG("Write cmd %p finished (ec_cmd %p, rcmd %p, cm_cur_in_flight %d)", - wcmd, rcmd, ec_cmd, priv->cm_cur_in_flight); + wcmd, rcmd, ec_cmd, priv->cm_cur_in_flight); EXTRACHECKS_BUG_ON(wcmd->cdb[0] != WRITE_16); @@ -1064,18 +1039,16 @@ static void scst_cm_write_cmd_finished(struct scst_cmd *wcmd) goto out_finished; rc = scst_cm_err_check_retry(wcmd, ec_cmd->start_time, scst_cm_write_retry_fn); - if (likely(rc == SCST_CM_STATUS_CMD_SUCCEEDED)) - goto cont; - else if (rc == SCST_CM_STATUS_RETRY) - goto out; - else { + if (unlikely(rc != SCST_CM_STATUS_CMD_SUCCEEDED)) { + if (rc == SCST_CM_STATUS_RETRY) + goto out; + TRACE_DBG("Write cmd %p (ec_cmd %p) finished not successfully", - wcmd, ec_cmd); - if (wcmd->status == SAM_STAT_CHECK_CONDITION) - rc = scst_set_cmd_error_sense(ec_cmd, wcmd->sense, - wcmd->sense_valid_len); - else { - sBUG_ON(wcmd->sense != NULL); + wcmd, ec_cmd); + if (wcmd->status == SAM_STAT_CHECK_CONDITION) { + rc = scst_set_cmd_error_sense(ec_cmd, wcmd->sense, wcmd->sense_valid_len); + } else { + sBUG_ON(wcmd->sense); rc = scst_set_cmd_error_status(ec_cmd, wcmd->status); } if (rc != 0) { @@ -1085,15 +1058,16 @@ static void scst_cm_write_cmd_finished(struct scst_cmd *wcmd) */ WARN_ON(scst_is_ua_sense(wcmd->sense, wcmd->sense_valid_len)); sBUG_ON(priv->cm_error == SCST_CM_ERROR_NONE); - } else + } else { priv->cm_error = SCST_CM_ERROR_WRITE; + } + goto out_finished; } -cont: priv->cm_written += wcmd->data_len; - TRACE_DBG("ec_cmd %p, cm_written %lld (data_len %lld)", ec_cmd, - (long long)priv->cm_written, (long long)wcmd->data_len); + TRACE_DBG("ec_cmd %p, cm_written %lld (data_len %lld)", + ec_cmd, (long long)priv->cm_written, (long long)wcmd->data_len); wcmd->sg = NULL; wcmd->sg_cnt = 0; @@ -1142,8 +1116,8 @@ out_finished: goto out_put; } -static int scst_cm_push_single_write(struct scst_cmd *ec_cmd, - int64_t lba, int blocks, struct scst_cmd *rcmd) +static int scst_cm_push_single_write(struct scst_cmd *ec_cmd, int64_t lba, int blocks, + struct scst_cmd *rcmd) { int res; struct scst_cm_ec_cmd_priv *priv = ec_cmd->cmd_data_descriptors; @@ -1165,10 +1139,10 @@ static int scst_cm_push_single_write(struct scst_cmd *ec_cmd, put_unaligned_be64(lba, &write16_cdb[2]); put_unaligned_be32(blocks, &write16_cdb[10]); - wcmd = __scst_create_prepare_internal_cmd(write16_cdb, - sizeof(write16_cdb), SCST_CMD_QUEUE_SIMPLE, - priv->cm_write_tgt_dev, GFP_KERNEL, false); - if (wcmd == NULL) { + wcmd = __scst_create_prepare_internal_cmd(write16_cdb, sizeof(write16_cdb), + SCST_CMD_QUEUE_SIMPLE, priv->cm_write_tgt_dev, + GFP_KERNEL, false); + if (!wcmd) { res = -ENOMEM; goto out_busy; } @@ -1179,8 +1153,7 @@ static int scst_cm_push_single_write(struct scst_cmd *ec_cmd, wcmd->expected_transfer_len_full = len; wcmd->expected_values_set = 1; - res = scst_cm_add_to_internal_cmd_list(wcmd, ec_cmd, rcmd, - scst_cm_write_cmd_finished); + res = scst_cm_add_to_internal_cmd_list(wcmd, ec_cmd, rcmd, scst_cm_write_cmd_finished); if (res != 0) goto out_free_wcmd; @@ -1190,8 +1163,8 @@ static int scst_cm_push_single_write(struct scst_cmd *ec_cmd, wcmd->tgt_i_sg_cnt = rcmd->sg_cnt; wcmd->tgt_i_data_buf_alloced = 1; - TRACE_DBG("Adding EC (%p) WRITE(16) cmd %p (lba %lld, blocks %d) to " - "active cmd list", ec_cmd, wcmd, (long long)wcmd->lba, blocks); + TRACE_DBG("Adding EC (%p) WRITE(16) cmd %p (lba %lld, blocks %d) to active cmd list", + ec_cmd, wcmd, (long long)wcmd->lba, blocks); spin_lock_irq(&wcmd->cmd_threads->cmd_list_lock); list_add_tail(&wcmd->cmd_list_entry, &wcmd->cmd_threads->active_cmd_list); wake_up(&wcmd->cmd_threads->cmd_list_waitQ); @@ -1228,18 +1201,16 @@ static void scst_cm_read_cmd_finished(struct scst_cmd *rcmd) goto out_finished; rc = scst_cm_err_check_retry(rcmd, ec_cmd->start_time, scst_cm_read_retry_fn); - if (likely(rc == SCST_CM_STATUS_CMD_SUCCEEDED)) - goto cont; - else if (rc == SCST_CM_STATUS_RETRY) - goto out; - else { + if (unlikely(rc != SCST_CM_STATUS_CMD_SUCCEEDED)) { + if (rc == SCST_CM_STATUS_RETRY) + goto out; + TRACE_DBG("Read cmd %p (ec_cmd %p) finished not successfully", - rcmd, ec_cmd); - if (rcmd->status == SAM_STAT_CHECK_CONDITION) - rc = scst_set_cmd_error_sense(ec_cmd, rcmd->sense, - rcmd->sense_valid_len); - else { - sBUG_ON(rcmd->sense != NULL); + rcmd, ec_cmd); + if (rcmd->status == SAM_STAT_CHECK_CONDITION) { + rc = scst_set_cmd_error_sense(ec_cmd, rcmd->sense, rcmd->sense_valid_len); + } else { + sBUG_ON(rcmd->sense); rc = scst_set_cmd_error_status(ec_cmd, rcmd->status); } if (rc != 0) { @@ -1249,12 +1220,12 @@ static void scst_cm_read_cmd_finished(struct scst_cmd *rcmd) */ WARN_ON(scst_is_ua_sense(rcmd->sense, rcmd->sense_valid_len)); sBUG_ON(priv->cm_error == SCST_CM_ERROR_NONE); - } else + } else { priv->cm_error = SCST_CM_ERROR_READ; + } goto out_finished; } -cont: lba = rcmd->lba - priv->cm_start_read_lba; lba <<= priv->cm_read_tgt_dev->dev->block_shift; lba >>= priv->cm_write_tgt_dev->dev->block_shift; @@ -1263,12 +1234,11 @@ cont: len = rcmd->data_len; blocks = len >> priv->cm_write_tgt_dev->dev->block_shift; - TRACE_DBG("rcmd->lba %lld, start_read_lba %lld, read shift %d, write " - "shift %d, start_write_lba %lld, lba %lld, len %d, blocks %d", - (long long)rcmd->lba, (long long)priv->cm_start_read_lba, - priv->cm_read_tgt_dev->dev->block_shift, - priv->cm_write_tgt_dev->dev->block_shift, - (long long)priv->cm_start_write_lba, lba, len, blocks); + TRACE_DBG("rcmd->lba %lld, start_read_lba %lld, read shift %d, write shift %d, start_write_lba %lld, lba %lld, len %d, blocks %d", + (long long)rcmd->lba, (long long)priv->cm_start_read_lba, + priv->cm_read_tgt_dev->dev->block_shift, + priv->cm_write_tgt_dev->dev->block_shift, + (long long)priv->cm_start_write_lba, lba, len, blocks); rc = scst_cm_push_single_write(ec_cmd, lba, blocks, rcmd); if (rc != 0) @@ -1286,17 +1256,15 @@ out_finished: } /* cm_mutex suppose to be locked */ -static int scst_cm_push_single_read(struct scst_cmd *ec_cmd, int blocks, - bool inc_cur_in_flight) +static int scst_cm_push_single_read(struct scst_cmd *ec_cmd, int blocks, bool inc_cur_in_flight) { int res; struct scst_cm_ec_cmd_priv *priv = ec_cmd->cmd_data_descriptors; TRACE_ENTRY(); - TRACE_DBG("ec_cmd %p, cm_cur_read_lba %lld, cm_left_to_read %d, " - "blocks %d", ec_cmd, (long long)priv->cm_cur_read_lba, - priv->cm_left_to_read, blocks); + TRACE_DBG("ec_cmd %p, cm_cur_read_lba %lld, cm_left_to_read %d, blocks %d", + ec_cmd, (long long)priv->cm_cur_read_lba, priv->cm_left_to_read, blocks); res = __scst_cm_push_single_read(ec_cmd, priv->cm_cur_read_lba, blocks); if (res != 0) @@ -1307,8 +1275,8 @@ static int scst_cm_push_single_read(struct scst_cmd *ec_cmd, int blocks, if (inc_cur_in_flight) { priv->cm_cur_in_flight++; - TRACE_DBG("ec_cmd %p, new cm_cur_in_flight %d", ec_cmd, - priv->cm_cur_in_flight); + TRACE_DBG("ec_cmd %p, new cm_cur_in_flight %d", + ec_cmd, priv->cm_cur_in_flight); } out: @@ -1368,16 +1336,15 @@ out: out_err: if (priv->cm_cur_in_flight != 0) goto out_wake; - else { - mutex_unlock(&priv->cm_mutex); - scst_cm_ec_cmd_done(ec_cmd); - } + + mutex_unlock(&priv->cm_mutex); + scst_cm_ec_cmd_done(ec_cmd); goto out; } /* cm_mutex suppose to be locked or no activities on this ec_cmd's priv */ static void scst_cm_process_data_descrs(struct scst_cmd *ec_cmd, - const struct scst_ext_copy_data_descr *dds, int dds_cnt) + const struct scst_ext_copy_data_descr *dds, int dds_cnt) { int rc; @@ -1435,12 +1402,12 @@ EXPORT_SYMBOL_GPL(scst_ext_copy_get_cur_seg_data_len); * If dds is NULL, then all data have been remapped, so SCST core will switch * to the next segment descriptor, if any. */ -void scst_ext_copy_remap_done(struct scst_cmd *ec_cmd, - struct scst_ext_copy_data_descr *dds, int dds_cnt) +void scst_ext_copy_remap_done(struct scst_cmd *ec_cmd, struct scst_ext_copy_data_descr *dds, + int dds_cnt) { TRACE_ENTRY(); - if (dds == NULL) + if (!dds) scst_cm_ec_sched_next_seg(ec_cmd); else scst_cm_process_data_descrs(ec_cmd, dds, dds_cnt); @@ -1448,7 +1415,6 @@ void scst_ext_copy_remap_done(struct scst_cmd *ec_cmd, /* ec_cmd can be dead here! */ TRACE_EXIT(); - return; } EXPORT_SYMBOL_GPL(scst_ext_copy_remap_done); @@ -1465,7 +1431,6 @@ static void scst_cm_remap_retry_fn(struct scst_cmd *cmd) sBUG_ON(rc != 0); TRACE_EXIT(); - return; } /* @@ -1485,7 +1450,7 @@ static int scst_cm_try_to_remap(struct scst_cmd *ec_cmd) TRACE_ENTRY(); - if (handler->ext_copy_remap == NULL) { + if (!handler->ext_copy_remap) { res = 1; goto out; } @@ -1495,17 +1460,16 @@ static int scst_cm_try_to_remap(struct scst_cmd *ec_cmd) /* !! priv data descriptors fields are not setup yet !! */ TRACE_DBG("Checking reservations on read dev %s (ec_cmd %p)", - sd->src_tgt_dev->dev->virt_name, ec_cmd); + sd->src_tgt_dev->dev->virt_name, ec_cmd); memset(cdb, 0, sizeof(cdb)); cdb[0] = READ_16; put_unaligned_be64(dd->src_lba, &cdb[2]); put_unaligned_be32(dd->data_len >> sd->src_tgt_dev->dev->block_shift, &cdb[10]); - cmd = __scst_create_prepare_internal_cmd(cdb, - sizeof(cdb), SCST_CMD_QUEUE_SIMPLE, - sd->src_tgt_dev, GFP_KERNEL, true); - if (cmd == NULL) + cmd = __scst_create_prepare_internal_cmd(cdb, sizeof(cdb), SCST_CMD_QUEUE_SIMPLE, + sd->src_tgt_dev, GFP_KERNEL, true); + if (!cmd) goto out_busy; cmd->internal_check_local_events = 1; @@ -1518,17 +1482,16 @@ static int scst_cm_try_to_remap(struct scst_cmd *ec_cmd) __scst_cmd_put(cmd); TRACE_DBG("Checking reservations on write dev %s (ec_cmd %p)", - sd->dst_tgt_dev->dev->virt_name, ec_cmd); + sd->dst_tgt_dev->dev->virt_name, ec_cmd); memset(cdb, 0, sizeof(cdb)); cdb[0] = WRITE_16; put_unaligned_be64(dd->dst_lba, &cdb[2]); put_unaligned_be32(dd->data_len >> sd->dst_tgt_dev->dev->block_shift, &cdb[10]); - cmd = __scst_create_prepare_internal_cmd(cdb, - sizeof(cdb), SCST_CMD_QUEUE_SIMPLE, - sd->dst_tgt_dev, GFP_KERNEL, true); - if (cmd == NULL) + cmd = __scst_create_prepare_internal_cmd(cdb, sizeof(cdb), SCST_CMD_QUEUE_SIMPLE, + sd->dst_tgt_dev, GFP_KERNEL, true); + if (!cmd) goto out_busy; cmd->internal_check_local_events = 1; @@ -1541,7 +1504,7 @@ static int scst_cm_try_to_remap(struct scst_cmd *ec_cmd) __scst_cmd_put(cmd); TRACE_DBG("Calling ext_copy_remap() for dev %s (ec_cmd %p)", - sd->dst_tgt_dev->dev->virt_name, ec_cmd); + sd->dst_tgt_dev->dev->virt_name, ec_cmd); handler->ext_copy_remap(ec_cmd, sd); @@ -1554,12 +1517,11 @@ out_check_retry: sBUG_ON(rc == SCST_CM_STATUS_CMD_SUCCEEDED); if (rc == SCST_CM_STATUS_CMD_FAILED) { TRACE_DBG("Remap check cmd %p (ec_cmd %p, op %s) failed", - cmd, ec_cmd, scst_get_opcode_name(cmd)); - if (cmd->status == SAM_STAT_CHECK_CONDITION) - rc = scst_set_cmd_error_sense(ec_cmd, cmd->sense, - cmd->sense_valid_len); - else { - sBUG_ON(cmd->sense != NULL); + cmd, ec_cmd, scst_get_opcode_name(cmd)); + if (cmd->status == SAM_STAT_CHECK_CONDITION) { + rc = scst_set_cmd_error_sense(ec_cmd, cmd->sense, cmd->sense_valid_len); + } else { + sBUG_ON(cmd->sense); rc = scst_set_cmd_error_status(ec_cmd, cmd->status); } if (rc != 0) { @@ -1569,9 +1531,9 @@ out_check_retry: */ WARN_ON(scst_is_ua_sense(cmd->sense, cmd->sense_valid_len)); } else { - if (cmd->cdb[0] == READ_16) + if (cmd->cdb[0] == READ_16) { priv->cm_error = SCST_CM_ERROR_READ; - else { + } else { EXTRACHECKS_BUG_ON(cmd->cdb[0] != WRITE_16); priv->cm_error = SCST_CM_ERROR_WRITE; } @@ -1605,11 +1567,10 @@ static void scst_cm_process_cur_seg_descr(struct scst_cmd *ec_cmd) /* No remapping supported */ scst_ext_copy_remap_done(ec_cmd, - &priv->cm_seg_descrs[priv->cm_cur_seg_descr].data_descr, 1); + &priv->cm_seg_descrs[priv->cm_cur_seg_descr].data_descr, 1); out: TRACE_EXIT(); - return; } enum scst_exec_res scst_cm_ext_copy_exec(struct scst_cmd *ec_cmd) @@ -1620,7 +1581,7 @@ enum scst_exec_res scst_cm_ext_copy_exec(struct scst_cmd *ec_cmd) TRACE_ENTRY(); - if (unlikely(priv == NULL)) + if (unlikely(!priv)) goto out_local_done; if (unlikely(scst_cm_is_ec_cmd_done(ec_cmd))) { @@ -1669,8 +1630,8 @@ bool scst_cm_ec_cmd_overlap(struct scst_cmd *ec_cmd, struct scst_cmd *cmd) for (i = 0; i < ec_cmd->cmd_data_descriptors_cnt; i++) { struct scst_ext_copy_seg_descr *sd = &priv->cm_seg_descrs[i]; - TRACE_DBG("type %d, dst_dev %p, dev %p", sd->type, - sd->dst_tgt_dev->dev, cmd->dev); + TRACE_DBG("type %d, dst_dev %p, dev %p", + sd->type, sd->dst_tgt_dev->dev, cmd->dev); if (sd->type != SCST_EXT_COPY_SEG_DATA) continue; @@ -1678,11 +1639,12 @@ bool scst_cm_ec_cmd_overlap(struct scst_cmd *ec_cmd, struct scst_cmd *cmd) continue; res = scst_lba1_inside_lba2(sd->data_descr.dst_lba, cmd->lba, - cmd->data_len >> cmd->dev->block_shift); + cmd->data_len >> cmd->dev->block_shift); if (res) goto out; + res = scst_lba1_inside_lba2(cmd->lba, sd->data_descr.dst_lba, - sd->data_descr.data_len >> sd->dst_tgt_dev->dev->block_shift); + sd->data_descr.data_len >> sd->dst_tgt_dev->dev->block_shift); if (res) goto out; } @@ -1746,13 +1708,12 @@ bool scst_cm_check_block_all_devs(struct scst_cmd *cmd) ec_cmd = p->cm_orig_cmd; TRACE_BLOCK("Rewaking blocked EC cmd %p (fcmd %p)", - ec_cmd, cmd); + ec_cmd, cmd); scst_check_unblock_dev(cmd); spin_lock_irq(&ec_cmd->cmd_threads->cmd_list_lock); - list_add_tail(&ec_cmd->cmd_list_entry, - &ec_cmd->cmd_threads->active_cmd_list); + list_add_tail(&ec_cmd->cmd_list_entry, &ec_cmd->cmd_threads->active_cmd_list); wake_up(&ec_cmd->cmd_threads->cmd_list_waitQ); spin_unlock_irq(&ec_cmd->cmd_threads->cmd_list_lock); @@ -1771,7 +1732,7 @@ bool scst_cm_check_block_all_devs(struct scst_cmd *cmd) scst_check_unblock_dev(ec_cmd); d = ec_cmd->cmd_data_descriptors; - if (d == NULL) { + if (!d) { spin_lock_bh(&ec_cmd->dev->dev_lock); res = scst_do_check_blocked_dev(ec_cmd); spin_unlock_bh(&ec_cmd->dev->dev_lock); @@ -1790,8 +1751,8 @@ bool scst_cm_check_block_all_devs(struct scst_cmd *cmd) TRACE_DBG("dev %p (fcmd %p)", e->cm_fcmd->dev, e->cm_fcmd); res = scst_do_check_blocked_dev(e->cm_fcmd); if (unlikely(res)) { - TRACE_BLOCK("fcmd %p (ec_cmd %p) blocked, undo " - "check blocking devices", e->cm_fcmd, ec_cmd); + TRACE_BLOCK("fcmd %p (ec_cmd %p) blocked, undo check blocking devices", + e->cm_fcmd, ec_cmd); break; } } @@ -1799,8 +1760,7 @@ bool scst_cm_check_block_all_devs(struct scst_cmd *cmd) if (unlikely(res)) { struct scst_cmd *blocked_cmd = e->cm_fcmd; - list_for_each_entry(e, &d->cm_sorted_devs_list, - cm_sorted_devs_list_entry) { + list_for_each_entry(e, &d->cm_sorted_devs_list, cm_sorted_devs_list_entry) { if (e->cm_fcmd == blocked_cmd) break; __scst_check_unblock_dev(e->cm_fcmd); @@ -1809,10 +1769,8 @@ bool scst_cm_check_block_all_devs(struct scst_cmd *cmd) } #if !defined(__CHECKER__) - list_for_each_entry_reverse(e, &d->cm_sorted_devs_list, - cm_sorted_devs_list_entry) { + list_for_each_entry_reverse(e, &d->cm_sorted_devs_list, cm_sorted_devs_list_entry) spin_unlock(&e->cm_fcmd->dev->dev_lock); - } #endif local_bh_enable(); @@ -1834,14 +1792,13 @@ void scst_cm_abort_ec_cmd(struct scst_cmd *ec_cmd) spin_lock_irqsave(&scst_cm_lock, flags); - if (p == NULL) + if (!p) goto out_unlock; TRACE_MGMT_DBG("Aborting fantom and internal commands of ec_cmd %p", - ec_cmd); + ec_cmd); - list_for_each_entry(ip, &p->cm_internal_cmd_list, - cm_internal_cmd_list_entry) { + list_for_each_entry(ip, &p->cm_internal_cmd_list, cm_internal_cmd_list_entry) { struct scst_cmd *c = ip->cm_cmd; TRACE_MGMT_DBG("Aborting (f)cmd %p", c); @@ -1852,7 +1809,6 @@ out_unlock: spin_unlock_irqrestore(&scst_cm_lock, flags); TRACE_EXIT(); - return; } static void scst_cm_del_free_list_id(struct scst_cm_list_id *l) @@ -1868,7 +1824,6 @@ static void scst_cm_del_free_list_id(struct scst_cm_list_id *l) kfree(l); TRACE_EXIT(); - return; } static void scst_cm_sched_del_list_id(struct scst_cmd *ec_cmd) @@ -1913,16 +1868,13 @@ static void scst_cm_sched_del_list_id(struct scst_cmd *ec_cmd) TRACE_DBG("Schedule pending free list id %p", l); - schedule_delayed_work(&sess->sess_cm_list_id_cleanup_work, - SCST_CM_ID_KEEP_TIME); + schedule_delayed_work(&sess->sess_cm_list_id_cleanup_work, SCST_CM_ID_KEEP_TIME); out: TRACE_EXIT(); - return; } -static struct scst_cm_list_id *scst_cm_add_list_id(struct scst_cmd *cmd, - int list_id) +static struct scst_cm_list_id *scst_cm_add_list_id(struct scst_cmd *cmd, int list_id) { struct scst_cm_list_id *res; struct scst_session *sess = cmd->sess; @@ -1931,7 +1883,7 @@ static struct scst_cm_list_id *scst_cm_add_list_id(struct scst_cmd *cmd, TRACE_ENTRY(); res = kzalloc(sizeof(*res), GFP_KERNEL); - if (res == NULL) { + if (!res) { TRACE(TRACE_OUT_OF_MEM, "Unable to allocate list_id"); scst_set_busy(cmd); goto out; @@ -1950,8 +1902,7 @@ static struct scst_cm_list_id *scst_cm_add_list_id(struct scst_cmd *cmd, } TRACE_DBG("List id %d already exists", list_id); - scst_set_cmd_error(cmd, - SCST_LOAD_SENSE(scst_sense_operation_in_progress)); + scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_operation_in_progress)); goto out_unlock_free; } } @@ -1974,8 +1925,8 @@ out_unlock_free: void sess_cm_list_id_cleanup_work_fn(struct work_struct *work) { - struct scst_session *sess = container_of(work, - struct scst_session, sess_cm_list_id_cleanup_work.work); + struct scst_session *sess = container_of(work, struct scst_session, + sess_cm_list_id_cleanup_work.work); struct scst_cm_list_id *l, *t; unsigned long cur_time = jiffies; unsigned long flags; @@ -1991,18 +1942,17 @@ void sess_cm_list_id_cleanup_work_fn(struct work_struct *work) list_for_each_entry_safe(l, t, &sess->sess_cm_list_id_list, sess_cm_list_id_entry) { if (l->cm_list_id_state != SCST_CM_LIST_ID_STATE_PENDING_FREE) break; - if (time_after_eq(cur_time, l->cm_time_to_free)) + if (time_after_eq(cur_time, l->cm_time_to_free)) { scst_cm_del_free_list_id(l); - else { + } else { TRACE_DBG("Reschedule pending free list ids cleanup"); schedule_delayed_work(&sess->sess_cm_list_id_cleanup_work, - l->cm_time_to_free - cur_time); + l->cm_time_to_free - cur_time); } } spin_unlock_irqrestore(&scst_cm_lock, flags); TRACE_EXIT(); - return; } void scst_cm_free_pending_list_ids(struct scst_session *sess) @@ -2022,7 +1972,6 @@ void scst_cm_free_pending_list_ids(struct scst_session *sess) spin_unlock_irq(&scst_cm_lock); TRACE_EXIT(); - return; } static void scst_cm_copy_status(struct scst_cmd *cmd) @@ -2109,9 +2058,9 @@ static void scst_cm_failed_seg_details(struct scst_cmd *cmd) size = 60 + SCST_SENSE_BUFFERSIZE; tbuf = kzalloc(size, GFP_KERNEL); - if (tbuf == NULL) { - TRACE(TRACE_OUT_OF_MEM, "Unable to allocate FAILED SEGMENTS " - "DETAILS buffer (size %d)", size); + if (!tbuf) { + TRACE(TRACE_OUT_OF_MEM, + "Unable to allocate FAILED SEGMENTS DETAILS buffer (size %d)", size); goto out_busy; } @@ -2129,9 +2078,9 @@ static void scst_cm_failed_seg_details(struct scst_cmd *cmd) goto skip; } - if ((cmd->bufflen == 0) || - ((l->cm_status == 0) && (cmd->bufflen >= 60)) || - ((l->cm_status != 0) && (cmd->bufflen >= 60 + SCST_SENSE_BUFFERSIZE))) + if (cmd->bufflen == 0 || + (l->cm_status == 0 && cmd->bufflen >= 60) || + (l->cm_status != 0 && (cmd->bufflen >= 60 + SCST_SENSE_BUFFERSIZE))) l->cm_can_be_immed_free = 1; if (l->cm_status == 0) @@ -2140,9 +2089,9 @@ static void scst_cm_failed_seg_details(struct scst_cmd *cmd) size = 60 + l->cm_sense_len; TRACE_DBG("l %p, status %d, sense_len %d, size %d", l, - l->cm_status, l->cm_sense_len, size); + l->cm_status, l->cm_sense_len, size); - put_unaligned_be32(size-3, &tbuf[0]); + put_unaligned_be32(size - 3, &tbuf[0]); tbuf[56] = l->cm_status; EXTRACHECKS_BUG_ON(l->cm_sense_len > SCST_SENSE_BUFFERSIZE); BUILD_BUG_ON(sizeof(l->cm_sense) != SCST_SENSE_BUFFERSIZE); @@ -2192,7 +2141,7 @@ out_busy: static void scst_cm_oper_parameters(struct scst_cmd *cmd) { ssize_t length = 0; - uint8_t *buf, tbuf[44+2] /* 2 descriptors implemented */; + uint8_t *buf, tbuf[44 + 2] /* 2 descriptors implemented */; TRACE_ENTRY(); @@ -2214,7 +2163,7 @@ static void scst_cm_oper_parameters(struct scst_cmd *cmd) put_unaligned_be32(SCST_MAX_SEG_DESC_LEN, &tbuf[12]); /* MAXIMUM SEGMENT LENGTH: 256MB */ - put_unaligned_be32(256*1024*1024, &tbuf[16]); + put_unaligned_be32(256 * 1024 * 1024, &tbuf[16]); /* No inline and held data. No stream device max data size. */ @@ -2247,7 +2196,6 @@ static void scst_cm_oper_parameters(struct scst_cmd *cmd) out: TRACE_EXIT(); - return; } enum scst_exec_res scst_cm_rcv_copy_res_exec(struct scst_cmd *cmd) @@ -2270,10 +2218,9 @@ enum scst_exec_res scst_cm_rcv_copy_res_exec(struct scst_cmd *cmd) scst_cm_failed_seg_details(cmd); break; default: - TRACE(TRACE_MINOR, "%s: action %d not supported", cmd->op_name, - action); - scst_set_invalid_field_in_cdb(cmd, 1, - SCST_INVAL_FIELD_BIT_OFFS_VALID | 0); + TRACE(TRACE_MINOR, "%s: action %d not supported", + cmd->op_name, action); + scst_set_invalid_field_in_cdb(cmd, 1, SCST_INVAL_FIELD_BIT_OFFS_VALID | 0); break; } @@ -2291,8 +2238,8 @@ struct scst_cm_init_inq_priv { struct scst_device *dev; }; -static int scst_cm_send_init_inquiry(struct scst_device *dev, - unsigned int unpacked_lun, struct scst_cm_init_inq_priv *priv); +static int scst_cm_send_init_inquiry(struct scst_device *dev, unsigned int unpacked_lun, + struct scst_cm_init_inq_priv *priv); static void scst_cm_inq_retry_fn(struct scst_cmd *cmd) { @@ -2305,7 +2252,6 @@ static void scst_cm_inq_retry_fn(struct scst_cmd *cmd) scst_cm_send_init_inquiry(priv->dev, cmd->lun, priv); TRACE_EXIT(); - return; } static void scst_cm_update_dev_fini(struct scst_device *dev); @@ -2341,9 +2287,8 @@ static void scst_cm_init_inq_finish(struct scst_cmd *cmd) spin_unlock_bh(&dev->dev_lock); if (rc != SCST_CM_STATUS_CMD_SUCCEEDED) { - PRINT_CRIT_ERROR("Unable to perform initial INQUIRY for device " - "%s. Copy manager for this device will be disabled", - dev->virt_name); + PRINT_CRIT_ERROR("Unable to perform initial INQUIRY for device %s. Copy manager for this device will be disabled", + dev->virt_name); goto out_put_ref; } @@ -2368,9 +2313,9 @@ static void scst_cm_init_inq_finish(struct scst_cmd *cmd) } page_len = get_unaligned_be16(&buf[2]); - if (page_len+3 > cmd->resp_data_len) { + if (page_len + 3 > cmd->resp_data_len) { PRINT_WARNING("Page len (%d) doesn't match resp len (%d), ignoring", - page_len+3, cmd->resp_data_len); + page_len + 3, cmd->resp_data_len); goto out_put; } @@ -2381,31 +2326,30 @@ static void scst_cm_init_inq_finish(struct scst_cmd *cmd) if (off + 3 >= page_len) { PRINT_WARNING("Too small page len %d, (off %d), ignoring", - page_len, off); + page_len, off); goto out_put; } des_len = buf[off + 3]; if ((off + des_len) > page_len) { - PRINT_WARNING("Too small buf len %d (off %d, des_len %d), " - "ignoring", page_len, off, des_len); + PRINT_WARNING("Too small buf len %d (off %d, des_len %d), ignoring", + page_len, off, des_len); goto out_put; } des_len += 4; - if (((buf[off] & 0xF0) != 0) || ((buf[off+1] & 0xF0) != 0)) { - TRACE_DBG("Unsupported designator (%x, %x), " - "ignoring", buf[off] & 0xF0, buf[off+1] & 0xF0); + if (((buf[off] & 0xF0) != 0) || ((buf[off + 1] & 0xF0) != 0)) { + TRACE_DBG("Unsupported designator (%x, %x), ignoring", + buf[off] & 0xF0, buf[off + 1] & 0xF0); goto next; } des_alloc_len = sizeof(*des) + des_len; des = kzalloc(des_alloc_len, GFP_KERNEL); - if (des == NULL) { - PRINT_CRIT_ERROR("Unable to allocate designator (len %d, " - "type %x), ignoring it", des_alloc_len, - buf[off+1] & 0xF); + if (!des) { + PRINT_CRIT_ERROR("Unable to allocate designator (len %d, type %x), ignoring it", + des_alloc_len, buf[off + 1] & 0xF); goto out_put; } @@ -2434,11 +2378,10 @@ out_put_ref: scst_cm_update_dev_fini(dev); out: TRACE_EXIT(); - return; } -static int scst_cm_send_init_inquiry(struct scst_device *dev, - unsigned int unpacked_lun, struct scst_cm_init_inq_priv *priv) +static int scst_cm_send_init_inquiry(struct scst_device *dev, unsigned int unpacked_lun, + struct scst_cm_init_inq_priv *priv) { static const uint8_t inq_cdb[6] = { INQUIRY, 1, 0x83, 0x10, 0, 0 }; __be64 lun; @@ -2452,9 +2395,9 @@ static int scst_cm_send_init_inquiry(struct scst_device *dev, goto out; } - if (priv == NULL) { + if (!priv) { priv = kzalloc(sizeof(*priv), GFP_KERNEL); - if (priv == NULL) { + if (!priv) { PRINT_ERROR("Unable to alloc priv"); res = -ENOMEM; goto out; @@ -2466,9 +2409,9 @@ static int scst_cm_send_init_inquiry(struct scst_device *dev, lun = scst_pack_lun(unpacked_lun, scst_cm_sess->acg->addr_method); - cmd = scst_rx_cmd(scst_cm_sess, (const uint8_t *)&lun, - sizeof(lun), inq_cdb, sizeof(inq_cdb), false); - if (cmd == NULL) { + cmd = scst_rx_cmd(scst_cm_sess, (const uint8_t *)&lun, sizeof(lun), inq_cdb, + sizeof(inq_cdb), false); + if (!cmd) { res = -ENOMEM; goto out_free; } @@ -2533,7 +2476,7 @@ static unsigned int scst_cm_get_lun(const struct scst_device *dev) res = tgt_dev->lun; rcu_read_unlock(); TRACE_DBG("LUN %d found (full LUN %lld)", - res, tgt_dev->lun); + res, tgt_dev->lun); goto out; } } @@ -2584,9 +2527,8 @@ static int scst_cm_dev_register(struct scst_device *dev, uint64_t lun) lun = scst_cm_get_free_lun(); - res = scst_acg_add_lun(scst_cm_tgt->default_acg, - scst_cm_tgt->tgt_luns_kobj, dev, lun, SCST_ADD_LUN_CM, - &acg_dev); + res = scst_acg_add_lun(scst_cm_tgt->default_acg, scst_cm_tgt->tgt_luns_kobj, + dev, lun, SCST_ADD_LUN_CM, &acg_dev); if (res != 0) goto out_err; } @@ -2638,8 +2580,6 @@ static void scst_cm_dev_free_designators(struct scst_device *dev) mutex_unlock(&scst_cm_mutex); TRACE_EXIT(); - - return; } /* scst_mutex supposed to be held */ @@ -2660,8 +2600,6 @@ static void scst_cm_dev_unregister(struct scst_device *dev) scst_acg_del_lun(scst_cm_tgt->default_acg, lun, false); TRACE_EXIT(); - - return; } static int __scst_cm_update_dev(struct scst_device *dev) @@ -2762,8 +2700,6 @@ void scst_cm_update_dev(struct scst_device *dev) out: TRACE_EXIT(); - - return; } int scst_cm_on_dev_register(struct scst_device *dev) @@ -2793,7 +2729,6 @@ void scst_cm_on_dev_unregister(struct scst_device *dev) scst_cm_dev_unregister(dev); TRACE_EXIT(); - return; } /* scst_mutex supposed to be held */ @@ -2805,7 +2740,7 @@ int scst_cm_on_add_acg(struct scst_acg *acg) lockdep_assert_held(&scst_mutex); - if (scst_cm_tgt == NULL) + if (!scst_cm_tgt) goto out; if (acg->tgt != scst_cm_tgt) @@ -2831,8 +2766,7 @@ void scst_cm_on_del_acg(struct scst_acg *acg) } /* scst_mutex supposed to be held */ -int scst_cm_on_add_lun(struct scst_acg_dev *acg_dev, uint64_t lun, - unsigned int *flags) +int scst_cm_on_add_lun(struct scst_acg_dev *acg_dev, uint64_t lun, unsigned int *flags) { int res = 0; @@ -2880,9 +2814,8 @@ out: } /* scst_mutex2 supposed to be held */ -static bool scst_cm_check_access_acg(const char *initiator_name, - const struct scst_device *dev, const struct scst_acg *acg, - bool default_acg) +static bool scst_cm_check_access_acg(const char *initiator_name, const struct scst_device *dev, + const struct scst_acg *acg, bool default_acg) { bool res = true; struct scst_acg_dev *acg_dev; @@ -2911,8 +2844,8 @@ found: return res; } -static bool scst_cm_check_access(const char *initiator_name, - const struct scst_device *dev, bool *read_only) +static bool scst_cm_check_access(const char *initiator_name, const struct scst_device *dev, + bool *read_only) { bool res = true; struct scst_tgt_template *tgtt; @@ -2953,8 +2886,8 @@ static bool scst_cm_check_access(const char *initiator_name, } res = false; - PRINT_WARNING("Initiator %s not allowed to use device %s in EXTENDED " - "COPY command", initiator_name, dev->virt_name); + PRINT_WARNING("Initiator %s not allowed to use device %s in EXTENDED COPY command", + initiator_name, dev->virt_name); out_unlock_rd_only: mutex_unlock(&scst_mutex2); @@ -2973,8 +2906,8 @@ struct scst_cm_tgt_descr { }; /* Parse the copy source or copy destination (CSCD) descriptors. */ -static int scst_cm_parse_id_tgt_descr(struct scst_cmd *cmd, const uint8_t *seg, - int offs, struct scst_cm_tgt_descr *tgt_descr) +static int scst_cm_parse_id_tgt_descr(struct scst_cmd *cmd, const uint8_t *seg, int offs, + struct scst_cm_tgt_descr *tgt_descr) { int res = 32; struct scst_cm_desig *des; @@ -2989,8 +2922,8 @@ static int scst_cm_parse_id_tgt_descr(struct scst_cmd *cmd, const uint8_t *seg, if ((seg[1] & 0xC0) != 0) { PRINT_WARNING("LU ID %x not supported", seg[1] & 0xC0); - scst_set_invalid_field_in_parm_list(cmd, offs+1, - SCST_INVAL_FIELD_BIT_OFFS_VALID | 6); + scst_set_invalid_field_in_parm_list(cmd, offs + 1, + SCST_INVAL_FIELD_BIT_OFFS_VALID | 6); goto out_err; } @@ -3002,9 +2935,9 @@ static int scst_cm_parse_id_tgt_descr(struct scst_cmd *cmd, const uint8_t *seg, if ((seg[1] & 0xF) != 0) { PRINT_WARNING("PERIPHERAL DEVICE TYPE %d not supported", - seg[1] & 0xF); - scst_set_invalid_field_in_parm_list(cmd, offs+1, - SCST_INVAL_FIELD_BIT_OFFS_VALID | 0); + seg[1] & 0xF); + scst_set_invalid_field_in_parm_list(cmd, offs + 1, + SCST_INVAL_FIELD_BIT_OFFS_VALID | 0); goto out_err; } @@ -3015,8 +2948,8 @@ static int scst_cm_parse_id_tgt_descr(struct scst_cmd *cmd, const uint8_t *seg, /* ToDo: make it hash based */ list_for_each_entry(des, &scst_cm_desig_list, cm_desig_list_entry) { - TRACE_DBG("des %p (tgt_dev %p, lun %lld)", des, des->desig_tgt_dev, - (unsigned long long)des->desig_tgt_dev->lun); + TRACE_DBG("des %p (tgt_dev %p, lun %lld)", + des, des->desig_tgt_dev, (unsigned long long)des->desig_tgt_dev->lun); /* Check the code set field. */ if (seg[4] != des->desig[0]) continue; @@ -3033,35 +2966,36 @@ static int scst_cm_parse_id_tgt_descr(struct scst_cmd *cmd, const uint8_t *seg, continue; if (memcmp(&des->desig[4], &seg[8], seg[7]) == 0) { TRACE_DBG("Tgt_dev %p (lun %lld) found", - des->desig_tgt_dev, - (unsigned long long)des->desig_tgt_dev->lun); + des->desig_tgt_dev, + (unsigned long long)des->desig_tgt_dev->lun); mutex_unlock(&scst_cm_mutex); if (block != des->desig_tgt_dev->dev->block_size) { - PRINT_WARNING("Block size %d doesn't match %d", block, - des->desig_tgt_dev->dev->block_size); - scst_set_invalid_field_in_parm_list(cmd, offs+29, 0); + PRINT_WARNING("Block size %d doesn't match %d", + block, des->desig_tgt_dev->dev->block_size); + scst_set_invalid_field_in_parm_list(cmd, offs + 29, 0); goto out_err; } if (!scst_cm_check_access(cmd->sess->initiator_name, - des->desig_tgt_dev->dev, &read_only)) + des->desig_tgt_dev->dev, &read_only)) goto out_not_found; tgt_descr->tgt_dev = des->desig_tgt_dev; tgt_descr->read_only = read_only; TRACE_DBG("Found des %p (tgt_dev %p, read_only %d)", - des, tgt_descr->tgt_dev, tgt_descr->read_only); + des, tgt_descr->tgt_dev, tgt_descr->read_only); goto out; } } mutex_unlock(&scst_cm_mutex); - TRACE(TRACE_MINOR|TRACE_SCSI, "Target descriptor designator not found " - "(initiator %s, offs %d)", cmd->sess->initiator_name, offs); - TRACE_BUFF_FLAG(TRACE_MINOR|TRACE_SCSI, "Designator", seg, 32); + TRACE(TRACE_MINOR | TRACE_SCSI, + "Target descriptor designator not found (initiator %s, offs %d)", + cmd->sess->initiator_name, offs); + TRACE_BUFF_FLAG(TRACE_MINOR | TRACE_SCSI, "Designator", seg, 32); out_not_found: scst_set_invalid_field_in_parm_list(cmd, offs, 0); @@ -3074,15 +3008,15 @@ out: return res; } -static int scst_cm_set_seg_err_sense(struct scst_cmd *cmd, int asc, int ascq, - int seg_num, int offs) +static int scst_cm_set_seg_err_sense(struct scst_cmd *cmd, int asc, int ascq, int seg_num, + int offs) { int res, d_sense = scst_get_cmd_dev_d_sense(cmd); TRACE_ENTRY(); - TRACE_DBG("cmd %p, seg %d, offs %d (d_sense %d)", cmd, seg_num, offs, - d_sense); + TRACE_DBG("cmd %p, seg %d, offs %d (d_sense %d)", + cmd, seg_num, offs, d_sense); res = scst_set_cmd_error_status(cmd, SAM_STAT_CHECK_CONDITION); if (res != 0) @@ -3149,11 +3083,9 @@ static void scst_cm_fantom_cmd_finished(struct scst_cmd *cmd) /* Nothing to do */ TRACE_EXIT(); - return; } -static int scst_cm_add_to_descr_list(struct scst_cmd *ec_cmd, - struct scst_tgt_dev *tgt_dev) +static int scst_cm_add_to_descr_list(struct scst_cmd *ec_cmd, struct scst_tgt_dev *tgt_dev) { int res; struct scst_cm_ec_cmd_priv *priv = ec_cmd->cmd_data_descriptors; @@ -3167,15 +3099,15 @@ static int scst_cm_add_to_descr_list(struct scst_cmd *ec_cmd, list_for_each_entry(e, &priv->cm_sorted_devs_list, cm_sorted_devs_list_entry) { if (e->cm_fcmd->dev == tgt_dev->dev) { TRACE_DBG("Dev %p is already in cm_sorted_devs_list", - tgt_dev->dev); + tgt_dev->dev); goto out_success; } } e = kzalloc(sizeof(*e), GFP_KERNEL); - if (e == NULL) { + if (!e) { PRINT_ERROR("Unable to allocate scst_cm_dev_entry (size %d)", - (int)sizeof(*e)); + (int)sizeof(*e)); goto out_enomem; } @@ -3184,10 +3116,10 @@ static int scst_cm_add_to_descr_list(struct scst_cmd *ec_cmd, goto skip_fcmd_create; } - fcmd = __scst_create_prepare_internal_cmd(ec_cmd->cdb, - ec_cmd->cdb_len, SCST_CMD_QUEUE_SIMPLE, tgt_dev, - GFP_KERNEL, true); - if (fcmd == NULL) + fcmd = __scst_create_prepare_internal_cmd(ec_cmd->cdb, ec_cmd->cdb_len, + SCST_CMD_QUEUE_SIMPLE, tgt_dev, GFP_KERNEL, + true); + if (!fcmd) goto out_enomem_free_e; fcmd->expected_data_direction = ec_cmd->expected_data_direction; @@ -3199,14 +3131,13 @@ static int scst_cm_add_to_descr_list(struct scst_cmd *ec_cmd, fcmd->state = SCST_CMD_STATE_EXEC_CHECK_BLOCKING; - res = scst_cm_add_to_internal_cmd_list(fcmd, ec_cmd, ec_cmd, - scst_cm_fantom_cmd_finished); + res = scst_cm_add_to_internal_cmd_list(fcmd, ec_cmd, ec_cmd, scst_cm_fantom_cmd_finished); if (res != 0) goto out_free_cmd; skip_fcmd_create: - TRACE_DBG("ec_cmd %p, e %p, fcmd %p, tgt_dev %p (dev %p)", ec_cmd, e, fcmd, - tgt_dev, tgt_dev->dev); + TRACE_DBG("ec_cmd %p, e %p, fcmd %p, tgt_dev %p (dev %p)", + ec_cmd, e, fcmd, tgt_dev, tgt_dev->dev); e->cm_fcmd = fcmd; @@ -3214,16 +3145,14 @@ skip_fcmd_create: list_for_each_entry_reverse(t, &priv->cm_sorted_devs_list, cm_sorted_devs_list_entry) { EXTRACHECKS_BUG_ON(t->cm_fcmd->dev == tgt_dev->dev); if (((unsigned long)e->cm_fcmd->dev) > ((unsigned long)t->cm_fcmd->dev)) { - __list_add(&e->cm_sorted_devs_list_entry, - &t->cm_sorted_devs_list_entry, - t->cm_sorted_devs_list_entry.next); + __list_add(&e->cm_sorted_devs_list_entry, &t->cm_sorted_devs_list_entry, + t->cm_sorted_devs_list_entry.next); added = true; break; } } if (!added) - list_add(&e->cm_sorted_devs_list_entry, - &priv->cm_sorted_devs_list); + list_add(&e->cm_sorted_devs_list_entry, &priv->cm_sorted_devs_list); #if defined(CONFIG_SCST_DEBUG) || defined(CONFIG_SCST_EXTRACHECKS) { @@ -3231,7 +3160,7 @@ skip_fcmd_create: list_for_each_entry(t, &priv->cm_sorted_devs_list, cm_sorted_devs_list_entry) { TRACE_DBG("t %p, cm dev %p", t, t->cm_fcmd->dev); - if (tp != NULL) { + if (tp) { if (((unsigned long)t->cm_fcmd->dev) <= ((unsigned long)tp->cm_fcmd->dev)) { list_for_each_entry(t, &priv->cm_sorted_devs_list, cm_sorted_devs_list_entry) { pr_emerg("%s: t %p, cm dev %p\n", @@ -3267,9 +3196,9 @@ out_enomem: goto out; } -static int scst_cm_parse_b2b_seg_descr(struct scst_cmd *ec_cmd, - const uint8_t *seg, const struct scst_cm_tgt_descr *tgt_descrs, - int tgt_descrs_cnt, int seg_num) +static int scst_cm_parse_b2b_seg_descr(struct scst_cmd *ec_cmd, const uint8_t *seg, + const struct scst_cm_tgt_descr *tgt_descrs, + int tgt_descrs_cnt, int seg_num) { struct scst_cm_ec_cmd_priv *priv = ec_cmd->cmd_data_descriptors; struct scst_ext_copy_seg_descr *d = &priv->cm_seg_descrs[seg_num]; @@ -3297,7 +3226,7 @@ static int scst_cm_parse_b2b_seg_descr(struct scst_cmd *ec_cmd, } src_des = &tgt_descrs[src_des_idx]; - if (src_des->tgt_dev == NULL) { + if (!src_des->tgt_dev) { PRINT_WARNING("Segment with NULL src tgt device"); /* COPY TARGET DEVICE NOT REACHABLE */ scst_cm_set_seg_err_sense(ec_cmd, 0xD, 2, seg_num, 4); @@ -3312,7 +3241,7 @@ static int scst_cm_parse_b2b_seg_descr(struct scst_cmd *ec_cmd, } tgt_des = &tgt_descrs[tgt_des_idx]; - if (tgt_des->tgt_dev == NULL) { + if (!tgt_des->tgt_dev) { PRINT_WARNING("Segment with NULL tgt device"); /* COPY TARGET DEVICE NOT REACHABLE */ scst_cm_set_seg_err_sense(ec_cmd, 0xD, 2, seg_num, 6); @@ -3331,12 +3260,11 @@ static int scst_cm_parse_b2b_seg_descr(struct scst_cmd *ec_cmd, else len = blocks << src_des->tgt_dev->dev->block_shift; - if (unlikely((len & (src_des->tgt_dev->dev->block_size-1)) != 0) || - unlikely((len & (tgt_des->tgt_dev->dev->block_size-1)) != 0)) { - PRINT_WARNING("Data len %d is not even for block size (src block " - "size %d, dst block size %d)", len, - src_des->tgt_dev->dev->block_size, - tgt_des->tgt_dev->dev->block_size); + if (unlikely((len & (src_des->tgt_dev->dev->block_size - 1)) != 0) || + unlikely((len & (tgt_des->tgt_dev->dev->block_size - 1)) != 0)) { + PRINT_WARNING("Data len %d is not even for block size (src block size %d, dst block size %d)", + len, src_des->tgt_dev->dev->block_size, + tgt_des->tgt_dev->dev->block_size); scst_cm_set_seg_err_sense(ec_cmd, 0, 0, seg_num, 10); goto out_err; } @@ -3349,14 +3277,13 @@ static int scst_cm_parse_b2b_seg_descr(struct scst_cmd *ec_cmd, d->data_descr.dst_lba = get_unaligned_be64(&seg[20]); d->tgt_descr_offs = tgt_des->param_offs; - TRACE(TRACE_DEBUG|TRACE_SCSI, "ec_cmd %p, src dev %s, dst dev %s, " - "len %d, src_lba %lld, dst_lba %lld", ec_cmd, - d->src_tgt_dev->dev->virt_name, d->dst_tgt_dev->dev->virt_name, - len, (long long)d->data_descr.src_lba, - (long long)d->data_descr.dst_lba); + TRACE(TRACE_DEBUG | TRACE_SCSI, + "ec_cmd %p, src dev %s, dst dev %s, len %d, src_lba %lld, dst_lba %lld", + ec_cmd, d->src_tgt_dev->dev->virt_name, d->dst_tgt_dev->dev->virt_name, + len, (long long)d->data_descr.src_lba, (long long)d->data_descr.dst_lba); TRACE_DBG("src tgt_dev %p, dst tgt_dev %p, tgt_descr_of... [truncated message content] |
From: Gleb C. <lna...@ya...> - 2025-09-08 13:43:52
|
Commit: f8bfa63 GitHub URL: https://github.com/SCST-project/scst/commit/f8bfa638b692f322196822e1b08e02feb217664e Author: Tony Battersby Date: 2025-09-08T16:40:12+03:00 Log Message: ----------- scst: Export scst_tgt->sg_tablesize via sysfs This value is available in initiator mode via /sys/class/scsi_host/hostN/sg_tablesize; make it available in target mode as well. Userspace code may use it when making decisions about buffer sizes. Signed-off-by: Tony Battersby <to...@cy...> Modified Paths: -------------- scst/src/scst_sysfs.c | 21 +++++++++++++++ 1 file changed, 21 insertions(+) =================================================================== diff --git a/scst/src/scst_sysfs.c b/scst/src/scst_sysfs.c index 340e735..131f1b1 100644 --- a/scst/src/scst_sysfs.c +++ b/scst/src/scst_sysfs.c @@ -2718,6 +2718,26 @@ out: static struct kobj_attribute scst_tgt_comment = __ATTR(comment, 0644, scst_tgt_comment_show, scst_tgt_comment_store); + +static ssize_t scst_tgt_sg_tablesize_show(struct kobject *kobj, struct kobj_attribute *attr, + char *buf) +{ + struct scst_tgt *tgt; + int ret; + + TRACE_ENTRY(); + + tgt = container_of(kobj, struct scst_tgt, tgt_kobj); + + ret = sysfs_emit(buf, "%d\n", tgt->sg_tablesize); + + TRACE_EXIT_RES(ret); + return ret; +} + +static struct kobj_attribute scst_tgt_sg_tablesize = + __ATTR(sg_tablesize, 0444, scst_tgt_sg_tablesize_show, NULL); + /* * Creates an attribute entry for one target. Allows for target driver to * create an attribute that is not for every target. @@ -2910,6 +2930,7 @@ static struct attribute *scst_tgt_attrs[] = { &scst_tgt_aen_disabled.attr, &scst_tgt_forwarding.attr, &scst_tgt_comment.attr, + &scst_tgt_sg_tablesize.attr, &scst_tgt_addr_method.attr, &scst_tgt_io_grouping_type.attr, &scst_tgt_black_hole.attr, |
From: Gleb C. <lna...@ya...> - 2025-09-08 13:43:40
|
Commit: 70e0d81 GitHub URL: https://github.com/SCST-project/scst/commit/70e0d81436b47a1a23e527252296a1aabe83cd86 Author: Tony Battersby Date: 2025-09-08T16:40:12+03:00 Log Message: ----------- scst_user: Fix oops in SCST_USER_PARSE_EXCEPTION If dev->generic_parse() detects a math overflow and calls scst_set_cmd_error(), and scst_user is using SCST_USER_PARSE_EXCEPTION, then it will trigger a sBUG() in scst_targ.c::scst_parse_cmd() where it checks for a valid cmd->state: scst: scst_parse_cmd:1385:***CRITICAL ERROR***: Bad state for completed cmd (cmd 000000005abc21e1, state 1) BUG at /usr/src/debug/scst/3.10+git/scst/src/scst_targ.c:1387 Fix by treating negative generic_parse() errors as final. Signed-off-by: Tony Battersby <to...@cy...> Modified Paths: -------------- scst/src/dev_handlers/scst_user.c | 9 +++++++++ 1 file changed, 9 insertions(+) =================================================================== diff --git a/scst/src/dev_handlers/scst_user.c b/scst/src/dev_handlers/scst_user.c index cfd9ce2..88b37eb 100644 --- a/scst/src/dev_handlers/scst_user.c +++ b/scst/src/dev_handlers/scst_user.c @@ -757,6 +757,15 @@ static int dev_user_parse(struct scst_cmd *cmd) res = SCST_CMD_STATE_NEED_THREAD_CTX; goto out; } + if (rc < 0) { + /* + * May have already called e.g. scst_set_cmd_error(); + * too late to try user parse without cleaning up + * first. + */ + PRINT_ERROR("PARSE failed (ucmd %p, rc %d)", ucmd, rc); + goto out_error; + } fallthrough; case SCST_USER_PARSE_CALL: |
From: Gleb C. <lna...@ya...> - 2025-09-08 13:43:15
|
Commit: f9de3f4 GitHub URL: https://github.com/SCST-project/scst/commit/f9de3f4169524e9337e895a335e25914889e907b Author: Tony Battersby Date: 2025-09-08T16:40:12+03:00 Log Message: ----------- scst: Fix parsing of CDB control byte SCST_GET_CDB_LEN() returns 0 for vendor-specific opcodes such as: 0xD1 READ DYN RUNTIME ATT 0xD2 WRITE DYN RUNTIME ATTR 0xE7 INIT ELEMENT STATUS WRANGE This causes scst_set_cmd_from_cdb_info() to check cdb[-1] for the control byte, causing an out-of-bounds array read. - Move the parsing of the control byte after get_cdb_info() since that may set the CDB length to a known value. - If the CDB length is still unknown, then assume the control byte is 0 without accessing the CDB. - Check for variable-length CDBs in scst_set_cmd_from_cdb_info() rather than using the wrong control byte and then overriding it in get_cdb_info_var_len(). This is necessary because the override would no longer work after the change above. Also, the following code doesn't work: #define CONTROL_BYTE_NACA_BIT 0x04 unsigned int cmd_naca:1; cmd_naca = (control & CONTROL_BYTE_NACA_BIT); The result will always be 0. Use this instead: cmd_naca = !!(control & CONTROL_BYTE_NACA_BIT); (cmd_linked happened to work because CONTROL_BYTE_LINK_BIT is 0x01, but apply the same fix there also for consistency). Signed-off-by: Tony Battersby <to...@cy...> Modified Paths: -------------- scst/src/scst_lib.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) =================================================================== diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index 7eda3aa..6b48030 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -11941,8 +11941,6 @@ static int scst_set_cmd_from_cdb_info(struct scst_cmd *cmd, int res; cmd->cdb_len = SCST_GET_CDB_LEN(cmd->cdb[0]); - cmd->cmd_naca = (cmd->cdb[cmd->cdb_len - 1] & CONTROL_BYTE_NACA_BIT); - cmd->cmd_linked = (cmd->cdb[cmd->cdb_len - 1] & CONTROL_BYTE_LINK_BIT); cmd->op_name = ptr->info_op_name; cmd->data_direction = ptr->info_data_direction; cmd->op_flags = ptr->info_op_flags | SCST_INFO_VALID; @@ -11952,6 +11950,15 @@ static int scst_set_cmd_from_cdb_info(struct scst_cmd *cmd, cmd->len_len = ptr->info_len_len; cmd->log2_max_buf_len = ptr->log2_max_buf_len; res = (*ptr->get_cdb_info)(cmd, ptr); + + /* get_cdb_info() may override cdb_len, so do this after */ + if (likely(cmd->cdb_len != 0)) { + unsigned int control = (cmd->cdb[0] == 0x7F) ? cmd->cdb[1] : + cmd->cdb[cmd->cdb_len - 1]; + cmd->cmd_naca = !!(control & CONTROL_BYTE_NACA_BIT); + cmd->cmd_linked = !!(control & CONTROL_BYTE_LINK_BIT); + } + if (!cmd->log2_max_buf_len || cmd->bufflen <= (1U << cmd->log2_max_buf_len)) return res; @@ -12047,9 +12054,6 @@ static int get_cdb_info_var_len(struct scst_cmd *cmd, res = scst_set_cmd_from_cdb_info(cmd, ptr); - cmd->cmd_naca = (cmd->cdb[1] & CONTROL_BYTE_NACA_BIT); - cmd->cmd_linked = (cmd->cdb[1] & CONTROL_BYTE_LINK_BIT); - out: TRACE_EXIT_RES(res); return res; |
From: Gleb C. <lna...@ya...> - 2025-09-08 13:42:09
|
Commit: 63f2375 GitHub URL: https://github.com/SCST-project/scst/commit/63f2375fe4c3075e066400175a2c8a74469a7f5a Author: Tony Battersby Date: 2025-09-08T16:40:12+03:00 Log Message: ----------- kbuild: Remove stack protector flags -fstack-protector-strong is controlled by the in-tree CONFIG_STACKPROTECTOR_STRONG config option. If the flag is set without the config option, scst fails to build: ERROR: modpost: "__stack_chk_fail" [scst/src/scst.ko] undefined! -fstack-clash-protection is disabled in the kernel's Makefile due to an incompatibility with randomize_kstack_offset. Fixes: 86d3d4bb1d14 ("kbuild: Enable additional compiler warnings") Signed-off-by: Tony Battersby <to...@cy...> Modified Paths: -------------- fcst/Kbuild | 2 -- iscsi-scst/kernel/Kbuild | 2 -- iscsi-scst/kernel/isert-scst/Kbuild | 2 -- qla2x00t-32gbit/Kbuild | 2 -- qla2x00t-32gbit/qla2x00-target/Kbuild | 2 -- qla2x00t/Kbuild | 2 -- qla2x00t/qla2x00-target/Kbuild | 2 -- scst/src/Kbuild | 2 -- scst/src/dev_handlers/Kbuild | 2 -- scst_local/Kbuild | 2 -- srpt/src/Kbuild | 2 -- 11 files changed, 22 deletions(-) =================================================================== diff --git a/fcst/Kbuild b/fcst/Kbuild index f9e3611..c4fc956 100644 --- a/fcst/Kbuild +++ b/fcst/Kbuild @@ -14,8 +14,6 @@ ccflags-y += -Wall \ -pipe \ -g \ -grecord-gcc-switches \ - -fstack-clash-protection \ - -fstack-protector-strong \ -Wstrict-prototypes obj-$(CONFIG_FCST) += fcst.o diff --git a/iscsi-scst/kernel/Kbuild b/iscsi-scst/kernel/Kbuild index 6fa853e..499d825 100644 --- a/iscsi-scst/kernel/Kbuild +++ b/iscsi-scst/kernel/Kbuild @@ -30,8 +30,6 @@ ccflags-y := -I$(src)/../include \ -pipe \ -g \ -grecord-gcc-switches \ - -fstack-clash-protection \ - -fstack-protector-strong \ -Wstrict-prototypes ccflags-y += $(CONFTEST_CFLAGS) diff --git a/iscsi-scst/kernel/isert-scst/Kbuild b/iscsi-scst/kernel/isert-scst/Kbuild index e6ecfa6..94bb3e8 100644 --- a/iscsi-scst/kernel/isert-scst/Kbuild +++ b/iscsi-scst/kernel/isert-scst/Kbuild @@ -35,8 +35,6 @@ ccflags-y := -I$(src)/../../../scst/include \ -pipe \ -g \ -grecord-gcc-switches \ - -fstack-clash-protection \ - -fstack-protector-strong \ -Wstrict-prototypes obj-m += isert-scst.o diff --git a/qla2x00t-32gbit/Kbuild b/qla2x00t-32gbit/Kbuild index 31cb059..beab2ee 100644 --- a/qla2x00t-32gbit/Kbuild +++ b/qla2x00t-32gbit/Kbuild @@ -11,8 +11,6 @@ ccflags-y := -I$(src)/../scst/include \ -pipe \ -g \ -grecord-gcc-switches \ - -fstack-clash-protection \ - -fstack-protector-strong \ -Wstrict-prototypes ifneq ($(CONFIG_SCSI_QLA2XXX_TARGET),) diff --git a/qla2x00t-32gbit/qla2x00-target/Kbuild b/qla2x00t-32gbit/qla2x00-target/Kbuild index 24251e3..0ceae42 100644 --- a/qla2x00t-32gbit/qla2x00-target/Kbuild +++ b/qla2x00t-32gbit/qla2x00-target/Kbuild @@ -14,8 +14,6 @@ ccflags-y := -I$(src)/../../scst/include \ -pipe \ -g \ -grecord-gcc-switches \ - -fstack-clash-protection \ - -fstack-protector-strong \ -Wstrict-prototypes #ccflags-y += -DCONFIG_QLA_TGT_DEBUG_WORK_IN_THREAD diff --git a/qla2x00t/Kbuild b/qla2x00t/Kbuild index e3deaec..12a67aa 100644 --- a/qla2x00t/Kbuild +++ b/qla2x00t/Kbuild @@ -11,8 +11,6 @@ ccflags-y := -I$(src)/../scst/include \ -pipe \ -g \ -grecord-gcc-switches \ - -fstack-clash-protection \ - -fstack-protector-strong \ -Wstrict-prototypes ifneq ($(CONFIG_SCSI_QLA2XXX_TARGET),) diff --git a/qla2x00t/qla2x00-target/Kbuild b/qla2x00t/qla2x00-target/Kbuild index 9f78e1b..f34982b 100644 --- a/qla2x00t/qla2x00-target/Kbuild +++ b/qla2x00t/qla2x00-target/Kbuild @@ -14,8 +14,6 @@ ccflags-y := -I$(src)/../../scst/include \ -pipe \ -g \ -grecord-gcc-switches \ - -fstack-clash-protection \ - -fstack-protector-strong \ -Wstrict-prototypes #ccflags-y += -DCONFIG_QLA_TGT_DEBUG_WORK_IN_THREAD diff --git a/scst/src/Kbuild b/scst/src/Kbuild index 94d5af7..60c962f 100644 --- a/scst/src/Kbuild +++ b/scst/src/Kbuild @@ -11,8 +11,6 @@ ccflags-y := -I$(src)/../include \ -pipe \ -g \ -grecord-gcc-switches \ - -fstack-clash-protection \ - -fstack-protector-strong \ -Wstrict-prototypes ccflags-y += $(shell [ -n "${BUILD_DATE}" ] && echo -DSCST_BUILD_DATE=${BUILD_DATE}) \ diff --git a/scst/src/dev_handlers/Kbuild b/scst/src/dev_handlers/Kbuild index 8a813a1..f9d9c23 100644 --- a/scst/src/dev_handlers/Kbuild +++ b/scst/src/dev_handlers/Kbuild @@ -13,8 +13,6 @@ ccflags-y := -I$(src)/../../include \ -pipe \ -g \ -grecord-gcc-switches \ - -fstack-clash-protection \ - -fstack-protector-strong \ -Wstrict-prototypes #ccflags-y += -DCONFIG_DEBUG_EXT_COPY_REMAP diff --git a/scst_local/Kbuild b/scst_local/Kbuild index 0e9a878..3cf7804 100644 --- a/scst_local/Kbuild +++ b/scst_local/Kbuild @@ -13,8 +13,6 @@ ccflags-y := -I$(src)/../scst/include \ -pipe \ -g \ -grecord-gcc-switches \ - -fstack-clash-protection \ - -fstack-protector-strong \ -Wstrict-prototypes obj-m := scst_local.o diff --git a/srpt/src/Kbuild b/srpt/src/Kbuild index 6962b26..034b10d 100644 --- a/srpt/src/Kbuild +++ b/srpt/src/Kbuild @@ -16,8 +16,6 @@ ccflags-y += -I$(src)/../../scst/include \ -pipe \ -g \ -grecord-gcc-switches \ - -fstack-clash-protection \ - -fstack-protector-strong \ -Wstrict-prototypes obj-m += ib_srpt.o |
From: Gleb C. <lna...@ya...> - 2025-09-08 13:40:35
|
Commit: 189ab46 GitHub URL: https://github.com/SCST-project/scst/commit/189ab46a97bcb67bac1d474031eb2e71cc62b114 Author: Tony Battersby Date: 2025-09-08T16:40:12+03:00 Log Message: ----------- scst: Fix garbage in trace_level files 'hd /sys/kernel/scst_tgt/trace_level' shows a series of extraneous nul chars at the end of the first line. Fixes: 9cbca538303f ("scst: Replace sprintf() with scnprintf() in sysfs callbacks") Signed-off-by: Tony Battersby <to...@cy...> Modified Paths: -------------- scst/src/scst_sysfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) =================================================================== diff --git a/scst/src/scst_sysfs.c b/scst/src/scst_sysfs.c index 66c9414..340e735 100644 --- a/scst/src/scst_sysfs.c +++ b/scst/src/scst_sysfs.c @@ -156,8 +156,8 @@ static ssize_t scst_trace_level_show(const struct scst_trace_log *local_tbl, { ssize_t ret = 0; - ret += scst_read_trace_tbl(scst_trace_tbl, buf, log_level, ret); - ret += scst_read_trace_tbl(local_tbl, buf, log_level, ret); + ret = scst_read_trace_tbl(scst_trace_tbl, buf, log_level, ret); + ret = scst_read_trace_tbl(local_tbl, buf, log_level, ret); ret += sysfs_emit_at(buf, ret, "\n\n\nUsage:\n" |