diff --git a/iscsi-scst/kernel/config.c b/iscsi-scst/kernel/config.c index 8bd5b37fc..0831c6957 100644 --- a/iscsi-scst/kernel/config.c +++ b/iscsi-scst/kernel/config.c @@ -544,20 +544,6 @@ struct file_operations ctr_fops = { }; #ifdef CONFIG_SCST_DEBUG -void iscsi_dump_iov(struct msghdr *msg) -{ - if (trace_flag & TRACE_D_IOV) { - int i; - printk(LOG_FLAG "%p, %zd\n", msg->msg_iov, msg->msg_iovlen); - for (i = 0; i < min_t(size_t, msg->msg_iovlen, - ISCSI_CONN_IOV_MAX); i++) { - printk(LOG_FLAG "%d: %p,%zd\n", - i, msg->msg_iov[i].iov_base, - msg->msg_iov[i].iov_len); - } - } -} - static void iscsi_dump_char(int ch) { static unsigned char text[16]; diff --git a/iscsi-scst/kernel/iscsi.c b/iscsi-scst/kernel/iscsi.c index e418bde97..f47da8ba5 100644 --- a/iscsi-scst/kernel/iscsi.c +++ b/iscsi-scst/kernel/iscsi.c @@ -66,6 +66,7 @@ static void iscsi_send_task_mgmt_resp(struct iscsi_cmnd *req, int status); static void cmnd_prepare_get_rejected_cmd_data(struct iscsi_cmnd *cmnd); static void iscsi_check_send_delayed_tm_resp(struct iscsi_session *sess); static void iscsi_session_push_cmnd(struct iscsi_cmnd *cmnd); +static void req_cmnd_release(struct iscsi_cmnd *req); static inline u32 cmnd_write_size(struct iscsi_cmnd *cmnd) { @@ -392,7 +393,7 @@ again_rsp: * Corresponding conn may also gets destroyed atfer this function, except only * if it's called from the read thread! */ -void req_cmnd_release(struct iscsi_cmnd *req) +static void req_cmnd_release(struct iscsi_cmnd *req) { struct iscsi_cmnd *c, *t; diff --git a/iscsi-scst/kernel/iscsi.h b/iscsi-scst/kernel/iscsi.h index 60af1ac12..e4d7ac2f2 100644 --- a/iscsi-scst/kernel/iscsi.h +++ b/iscsi-scst/kernel/iscsi.h @@ -359,7 +359,6 @@ extern int cmnd_rx_start(struct iscsi_cmnd *); extern void cmnd_rx_end(struct iscsi_cmnd *); extern void cmnd_tx_start(struct iscsi_cmnd *); extern void cmnd_tx_end(struct iscsi_cmnd *); -extern void req_cmnd_release(struct iscsi_cmnd *req); extern void req_cmnd_release_force(struct iscsi_cmnd *req, int flags); extern void rsp_cmnd_release(struct iscsi_cmnd *); extern void cmnd_done(struct iscsi_cmnd *cmnd); diff --git a/iscsi-scst/kernel/iscsi_dbg.h b/iscsi-scst/kernel/iscsi_dbg.h index b442d9cdf..4261e00ee 100644 --- a/iscsi-scst/kernel/iscsi_dbg.h +++ b/iscsi-scst/kernel/iscsi_dbg.h @@ -43,12 +43,9 @@ #endif #ifdef CONFIG_SCST_DEBUG -struct msghdr; struct iscsi_pdu; -extern void iscsi_dump_iov(struct msghdr *msg); extern void iscsi_dump_pdu(struct iscsi_pdu *pdu); #else -#define iscsi_dump_iov(x) do {} while (0) #define iscsi_dump_pdu(x) do {} while (0) #endif diff --git a/scst/include/scst.h b/scst/include/scst.h index aa06e9356..442e455d6 100644 --- a/scst/include/scst.h +++ b/scst/include/scst.h @@ -2600,9 +2600,6 @@ int scst_alloc_set_sense(struct scst_cmd *cmd, int atomic, void scst_set_sense(uint8_t *buffer, int len, int key, int asc, int ascq); -void scst_set_cmd_error_sense(struct scst_cmd *cmd, uint8_t *sense, - unsigned int len); - /* * Returnes a pseudo-random number for debugging purposes. Available only in * the DEBUG build. diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index 51703d249..32e7dd065 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -37,6 +37,22 @@ static void scst_free_tgt_dev(struct scst_tgt_dev *tgt_dev); static void scst_check_internal_sense(struct scst_device *dev, int result, uint8_t *sense, int sense_len); +static void scst_alloc_set_UA(struct scst_tgt_dev *tgt_dev, + const uint8_t *sense, int sense_len, int head); +static void scst_free_all_UA(struct scst_tgt_dev *tgt_dev); +static void scst_release_space(struct scst_cmd *cmd); +static void scst_sess_free_tgt_devs(struct scst_session *sess); +static void scst_unblock_cmds(struct scst_device *dev); + +#ifdef CONFIG_SCST_DEBUG_TM +static void tm_dbg_init_tgt_dev(struct scst_tgt_dev *tgt_dev, + struct scst_acg_dev *acg_dev); +static void tm_dbg_deinit_tgt_dev(struct scst_tgt_dev *tgt_dev); +#else +static inline void tm_dbg_init_tgt_dev(struct scst_tgt_dev *tgt_dev, + struct scst_acg_dev *acg_dev) {} +static inline void tm_dbg_deinit_tgt_dev(struct scst_tgt_dev *tgt_dev) {} +#endif /* CONFIG_SCST_DEBUG_TM */ int scst_alloc_sense(struct scst_cmd *cmd, int atomic) { @@ -144,7 +160,7 @@ void scst_set_sense(uint8_t *buffer, int len, int key, } EXPORT_SYMBOL(scst_set_sense); -void scst_set_cmd_error_sense(struct scst_cmd *cmd, uint8_t *sense, +static void scst_set_cmd_error_sense(struct scst_cmd *cmd, uint8_t *sense, unsigned int len) { TRACE_ENTRY(); @@ -950,7 +966,7 @@ int scst_acg_remove_name(struct scst_acg *acg, const char *name) return res; } -struct scst_cmd *scst_create_prepare_internal_cmd( +static struct scst_cmd *scst_create_prepare_internal_cmd( struct scst_cmd *orig_cmd, int bufsize) { struct scst_cmd *res; @@ -983,7 +999,7 @@ out: return res; } -void scst_free_internal_cmd(struct scst_cmd *cmd) +static void scst_free_internal_cmd(struct scst_cmd *cmd) { TRACE_ENTRY(); @@ -3104,7 +3120,7 @@ void __scst_block_dev(struct scst_device *dev) } /* No locks */ -void scst_block_dev(struct scst_device *dev, int outstanding) +static void scst_block_dev(struct scst_device *dev, int outstanding) { spin_lock_bh(&dev->dev_lock); __scst_block_dev(dev); diff --git a/scst/src/scst_main.c b/scst/src/scst_main.c index 3f4a4fbc3..b671c0bd2 100644 --- a/scst/src/scst_main.c +++ b/scst/src/scst_main.c @@ -70,7 +70,8 @@ */ struct mutex scst_mutex; -struct list_head scst_template_list; + /* All 3 protected by scst_mutex */ +static struct list_head scst_template_list; struct list_head scst_dev_list; struct list_head scst_dev_type_list; @@ -121,8 +122,9 @@ struct list_head scst_sess_shut_list; wait_queue_head_t scst_dev_cmd_waitQ; -struct mutex scst_suspend_mutex; -struct list_head scst_cmd_lists_list; +static struct mutex scst_suspend_mutex; +/* protected by scst_suspend_mutex */ +static struct list_head scst_cmd_lists_list; static int scst_threads; struct scst_threads_info_t scst_threads_info; @@ -144,7 +146,7 @@ static struct io_context *scst_ioc; #endif #endif -unsigned int scst_max_cmd_mem; +static unsigned int scst_max_cmd_mem; unsigned int scst_max_dev_cmd_mem; module_param_named(scst_threads, scst_threads, int, 0); diff --git a/scst/src/scst_mem.c b/scst/src/scst_mem.c index 9ee173057..304e1b5cf 100644 --- a/scst/src/scst_mem.c +++ b/scst/src/scst_mem.c @@ -1057,6 +1057,7 @@ void sgv_pool_deinit(struct sgv_pool *pool) } TRACE_EXIT(); + return; } void sgv_pool_set_allocator(struct sgv_pool *pool, diff --git a/scst/src/scst_priv.h b/scst/src/scst_priv.h index dfecf2c6f..84b069892 100644 --- a/scst/src/scst_priv.h +++ b/scst/src/scst_priv.h @@ -125,7 +125,6 @@ extern unsigned long scst_trace_flag; #define SCST_TGT_RETRY_TIMEOUT (3/2*HZ) -extern unsigned int scst_max_cmd_mem; extern unsigned int scst_max_dev_cmd_mem; extern mempool_t *scst_mgmt_mempool; @@ -145,15 +144,10 @@ extern struct scst_sgv_pools scst_sgv; extern unsigned long scst_flags; extern struct mutex scst_mutex; extern atomic_t scst_cmd_count; -extern struct list_head scst_template_list; /* protected by scst_mutex */ -extern struct list_head scst_dev_list; /* protected by scst_mutex */ -extern struct list_head scst_dev_type_list; /* protected by scst_mutex */ +extern struct list_head scst_dev_list; +extern struct list_head scst_dev_type_list; extern wait_queue_head_t scst_dev_cmd_waitQ; -extern struct mutex scst_suspend_mutex; -/* protected by scst_suspend_mutex */ -extern struct list_head scst_cmd_lists_list; - extern struct list_head scst_acg_list; extern struct scst_acg *scst_default_acg; @@ -260,12 +254,8 @@ void scst_free_device(struct scst_device *dev); struct scst_acg *scst_alloc_add_acg(const char *acg_name); int scst_destroy_acg(struct scst_acg *acg); -int scst_proc_group_add_tree(struct scst_acg *acg, const char *name); -void scst_proc_del_acg_tree(struct proc_dir_entry *acg_proc_root, - const char *name); int scst_sess_alloc_tgt_devs(struct scst_session *sess); -void scst_sess_free_tgt_devs(struct scst_session *sess); void scst_nexus_loss(struct scst_tgt_dev *tgt_dev); int scst_acg_add_dev(struct scst_acg *acg, struct scst_device *dev, @@ -275,9 +265,6 @@ int scst_acg_remove_dev(struct scst_acg *acg, struct scst_device *dev); int scst_acg_add_name(struct scst_acg *acg, const char *name); int scst_acg_remove_name(struct scst_acg *acg, const char *name); -struct scst_cmd *scst_create_prepare_internal_cmd( - struct scst_cmd *orig_cmd, int bufsize); -void scst_free_internal_cmd(struct scst_cmd *cmd); int scst_prepare_request_sense(struct scst_cmd *orig_cmd); struct scst_cmd *scst_complete_request_sense(struct scst_cmd *cmd); @@ -297,8 +284,6 @@ static inline void scst_destroy_cmd(struct scst_cmd *cmd) return; } -void scst_proccess_redirect_cmd(struct scst_cmd *cmd, - enum scst_exec_context context, int check_retries); void scst_check_retries(struct scst_tgt *tgt); void scst_tgt_retry_timer_fn(unsigned long arg); @@ -338,7 +323,6 @@ static inline int scst_exec_req(struct scsi_device *sdev, #endif int scst_alloc_space(struct scst_cmd *cmd); -void scst_release_space(struct scst_cmd *cmd); void scst_scsi_op_list_init(void); enum scst_sg_copy_dir { @@ -349,9 +333,6 @@ void scst_copy_sg(struct scst_cmd *cmd, enum scst_sg_copy_dir); uint64_t scst_unpack_lun(const uint8_t *lun, int len); -struct scst_cmd *__scst_find_cmd_by_tag(struct scst_session *sess, - uint64_t tag); - struct scst_mgmt_cmd *scst_alloc_mgmt_cmd(gfp_t gfp_mask); void scst_free_mgmt_cmd(struct scst_mgmt_cmd *mcmd); void scst_done_cmd_mgmt(struct scst_cmd *cmd); @@ -383,9 +364,6 @@ void scst_dev_check_set_local_UA(struct scst_device *dev, void scst_check_set_UA(struct scst_tgt_dev *tgt_dev, const uint8_t *sense, int sense_len, int head); -void scst_alloc_set_UA(struct scst_tgt_dev *tgt_dev, const uint8_t *sense, - int sense_len, int head); -void scst_free_all_UA(struct scst_tgt_dev *tgt_dev); int scst_set_pending_UA(struct scst_cmd *cmd); void scst_abort_cmd(struct scst_cmd *cmd, struct scst_mgmt_cmd *mcmd, @@ -419,10 +397,8 @@ static inline int scst_is_implicit_hq(struct scst_cmd *cmd) */ extern int scst_inc_on_dev_cmd(struct scst_cmd *cmd); -extern void scst_unblock_cmds(struct scst_device *dev); extern void __scst_block_dev(struct scst_device *dev); -extern void scst_block_dev(struct scst_device *dev, int outstanding); extern void scst_block_dev_cmd(struct scst_cmd *cmd, int outstanding); extern void scst_unblock_dev(struct scst_device *dev); extern void scst_unblock_dev_cmd(struct scst_cmd *cmd); @@ -519,9 +495,6 @@ static inline void scst_check_restore_sg_buff(struct scst_cmd *cmd) } #ifdef CONFIG_SCST_DEBUG_TM -extern void tm_dbg_init_tgt_dev(struct scst_tgt_dev *tgt_dev, - struct scst_acg_dev *acg_dev); -extern void tm_dbg_deinit_tgt_dev(struct scst_tgt_dev *tgt_dev); 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); @@ -529,9 +502,6 @@ extern void tm_dbg_task_mgmt(struct scst_device *dev, const char *fn, int force); extern int tm_dbg_is_release(void); #else -static inline void tm_dbg_init_tgt_dev(struct scst_tgt_dev *tgt_dev, - struct scst_acg_dev *acg_dev) {} -static inline void tm_dbg_deinit_tgt_dev(struct scst_tgt_dev *tgt_dev) {} static inline void tm_dbg_check_released_cmds(void) {} static inline int tm_dbg_check_cmd(struct scst_cmd *cmd) { diff --git a/scst/src/scst_proc.c b/scst/src/scst_proc.c index 28037d9ad..6f7a8c781 100644 --- a/scst/src/scst_proc.c +++ b/scst/src/scst_proc.c @@ -555,7 +555,7 @@ static void scst_proc_cleanup_module_log(void) return; } -int scst_proc_group_add_tree(struct scst_acg *acg, const char *name) +static int scst_proc_group_add_tree(struct scst_acg *acg, const char *name) { int res = 0; struct proc_dir_entry *generic; @@ -609,7 +609,7 @@ out_remove: goto out; } -void scst_proc_del_acg_tree(struct proc_dir_entry *acg_proc_root, +static void scst_proc_del_acg_tree(struct proc_dir_entry *acg_proc_root, const char *name) { TRACE_ENTRY(); diff --git a/scst/src/scst_targ.c b/scst/src/scst_targ.c index a55cce6ca..43bb00282 100644 --- a/scst/src/scst_targ.c +++ b/scst/src/scst_targ.c @@ -35,6 +35,10 @@ static void scst_cmd_set_sn(struct scst_cmd *cmd); static int __scst_init_cmd(struct scst_cmd *cmd); static void scst_finish_cmd_mgmt(struct scst_cmd *cmd); +static struct scst_cmd *__scst_find_cmd_by_tag(struct scst_session *sess, + uint64_t tag); +static void scst_proccess_redirect_cmd(struct scst_cmd *cmd, + enum scst_exec_context context, int check_retries); static inline void scst_schedule_tasklet(struct scst_cmd *cmd) {