The pre-allocated small SGL depends on SG_CHAIN, so if the ARCH doesn't support SG_CHAIN, pre-allocation of small SGL can't work at all. Fixes this issue by not using small pre-allocation in case of NO_SG_CHAIN. Cc: Christoph Hellwig <hch@xxxxxx> Cc: Bart Van Assche <bvanassche@xxxxxxx> Cc: Ewan D. Milne <emilne@xxxxxxxxxx> Cc: Hannes Reinecke <hare@xxxxxxxx> Cc: Guenter Roeck <linux@xxxxxxxxxxxx> Fixes: c3288dd8c232 ("scsi: core: avoid pre-allocating big SGL for data") Reported-by: Guenter Roeck <linux@xxxxxxxxxxxx> Reviewed-by: Christoph Hellwig <hch@xxxxxx> Signed-off-by: Ming Lei <ming.lei@xxxxxxxxxx> --- drivers/scsi/scsi_lib.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 6e81258471fa..29aba762a4f1 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -44,9 +44,13 @@ * Size of integrity metadata is usually small, 1 inline sg should * cover normal cases. */ +#ifdef CONFIG_ARCH_NO_SG_CHAIN +#define SCSI_INLINE_PROT_SG_CNT 0 +#define SCSI_INLINE_SG_CNT 0 +#else #define SCSI_INLINE_PROT_SG_CNT 1 - #define SCSI_INLINE_SG_CNT 2 +#endif static struct kmem_cache *scsi_sdb_cache; static struct kmem_cache *scsi_sense_cache; -- 2.20.1