diff --git a/scst/include/scst.h b/scst/include/scst.h index 47e965877..14a7e68b0 100644 --- a/scst/include/scst.h +++ b/scst/include/scst.h @@ -36,6 +36,10 @@ #endif #include +#if 0 /* Let's disable it for now to see if users will complain about it */ +#define CONFIG_SCST_PER_DEVICE_CMD_COUNT_LIMIT +#endif + /* #define CONFIG_SCST_PROC */ #ifdef CONFIG_SCST_PROC @@ -2351,14 +2355,17 @@ struct scst_device { /**************************************************************/ /* - * How many cmds alive on this dev. Modified independently to the - * above fields, hence the alignment. Gcc reported to have - * a long standing bug, when it uses 64-bit memory accesses for - * int bit fields, so this alignment must be here to workaroud it. + * Device lock. Modified independently to the above fields, hence + * the alignment. Gcc reported to have a long standing bug, when + * it uses 64-bit memory accesses for int bit fields, so this + * alignment must be here to workaroud it. */ - atomic_t dev_cmd_count __aligned(sizeof(long)); + spinlock_t dev_lock __aligned(sizeof(long)); - spinlock_t dev_lock; /* device lock */ +#ifdef CONFIG_SCST_PER_DEVICE_CMD_COUNT_LIMIT + /* How many cmds alive on this dev */ + atomic_t dev_cmd_count; +#endif /* * How many times device was blocked for new cmds execution. diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index e04dbd1fb..b98060a94 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -3380,7 +3380,9 @@ int scst_alloc_device(gfp_t gfp_mask, struct scst_device **out_dev) } dev->handler = &scst_null_devtype; +#ifdef CONFIG_SCST_PER_DEVICE_CMD_COUNT_LIMIT atomic_set(&dev->dev_cmd_count, 0); +#endif scst_init_mem_lim(&dev->dev_mem_lim); spin_lock_init(&dev->dev_lock); INIT_LIST_HEAD(&dev->blocked_cmd_list); diff --git a/scst/src/scst_targ.c b/scst/src/scst_targ.c index dd1cfc21b..382125eef 100644 --- a/scst/src/scst_targ.c +++ b/scst/src/scst_targ.c @@ -38,11 +38,6 @@ #include "scst_priv.h" #include "scst_pres.h" -#if 0 /* Let's disable it for now to see if users will complain about it */ -/* Deleting it don't forget to delete dev_cmd_count */ -#define CONFIG_SCST_PER_DEVICE_CMD_COUNT_LIMIT -#endif - static void scst_cmd_set_sn(struct scst_cmd *cmd); static int __scst_init_cmd(struct scst_cmd *cmd); static struct scst_cmd *__scst_find_cmd_by_tag(struct scst_session *sess,