This Linux kernel change "scsi: core: don’t preallocate small SGL in case of NO_SG_CHAIN" is included in the Linux 5.3 release. This change is authored by Ming Lei <ming.lei [at] redhat.com> on Thu Jun 6 16:34:09 2019 +0800. The commit for this change in Linux stable tree is 3e99b3b (patch).
scsi: core: don't preallocate small SGL in case of NO_SG_CHAIN The preallocated small SGL depends on SG_CHAIN so if the ARCH doesn't support SG_CHAIN, preallocation of small SGL can't work at all. Fix this issue by not using small preallocation in case of NO_SG_CHAIN. Cc: Christoph Hellwig <email@example.com> Cc: Bart Van Assche <firstname.lastname@example.org> Cc: Ewan D. Milne <email@example.com> Cc: Hannes Reinecke <firstname.lastname@example.org> Cc: Guenter Roeck <email@example.com> Reported-by: Guenter Roeck <firstname.lastname@example.org> Reviewed-by: Christoph Hellwig <email@example.com> Reviewed-by: Bart Van Assche <firstname.lastname@example.org> Tested-by: Guenter Roeck <email@example.com> Signed-off-by: Ming Lei <firstname.lastname@example.org> Signed-off-by: Martin K. Petersen <email@example.com>
There are 6 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.
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 45b43e9..30cbea5 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -43,9 +43,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;