Message ID | 20190604082308.5575-2-ming.lei@redhat.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | scsi: two SG_CHAIN related fixes | expand |
> +#ifndef CONFIG_ARCH_NO_SG_CHAIN > #define SCSI_INLINE_PROT_SG_CNT 1 > - > #define SCSI_INLINE_SG_CNT 2 > +#else > +#define SCSI_INLINE_PROT_SG_CNT 0 > +#define SCSI_INLINE_SG_CNT 0 > +#endif Please avoid the double negative and just use an ifdef. Otherwise looks good: Reviewed-by: Christoph Hellwig <hch@lst.de>
On Tue, Jun 04, 2019 at 04:23:07PM +0800, 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 <hch@lst.de> > Cc: Bart Van Assche <bvanassche@acm.org> > Cc: Ewan D. Milne <emilne@redhat.com> > Cc: Hannes Reinecke <hare@suse.com> > Cc: Guenter Roeck <linux@roeck-us.net> > Fixes: c3288dd8c232 ("scsi: core: avoid pre-allocating big SGL for data") > Reported-by: Guenter Roeck <linux@roeck-us.net> > Signed-off-by: Ming Lei <ming.lei@redhat.com> alpha images still crash with this patch applied (see response to patch 0/2) for traceback). Guenter
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 6e81258471fa..9ef632963740 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. */ +#ifndef CONFIG_ARCH_NO_SG_CHAIN #define SCSI_INLINE_PROT_SG_CNT 1 - #define SCSI_INLINE_SG_CNT 2 +#else +#define SCSI_INLINE_PROT_SG_CNT 0 +#define SCSI_INLINE_SG_CNT 0 +#endif static struct kmem_cache *scsi_sdb_cache; static struct kmem_cache *scsi_sense_cache;
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@lst.de> Cc: Bart Van Assche <bvanassche@acm.org> Cc: Ewan D. Milne <emilne@redhat.com> Cc: Hannes Reinecke <hare@suse.com> Cc: Guenter Roeck <linux@roeck-us.net> Fixes: c3288dd8c232 ("scsi: core: avoid pre-allocating big SGL for data") Reported-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Ming Lei <ming.lei@redhat.com> --- drivers/scsi/scsi_lib.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)