On 6/4/19 6:06 PM, Ming Lei wrote:
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 <[email protected]>
Cc: Bart Van Assche <[email protected]>
Cc: Ewan D. Milne <[email protected]>
Cc: Hannes Reinecke <[email protected]>
Cc: Guenter Roeck <[email protected]>
Fixes: c3288dd8c232 ("scsi: core: avoid pre-allocating big SGL for data")
Reported-by: Guenter Roeck <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
Signed-off-by: Ming Lei <[email protected]>
---
  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

Reviewed-by: Bart Van Assche <[email protected]>

Reply via email to