public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* aacraid question: is maximum_num_containers supposed to be minimum?
@ 2012-01-11  8:28 Dan Carpenter
  2012-01-11  8:38 ` Xi Wang
  2012-01-11 14:15 ` Mark Salyzyn
  0 siblings, 2 replies; 4+ messages in thread
From: Dan Carpenter @ 2012-01-11  8:28 UTC (permalink / raw)
  To: Adaptec OEM Raid Solutions; +Cc: linux-scsi, linux-kernel

MAXIMUM_NUM_CONTAINERS is consistently used as a minimum not a maximum
so I was wondering what was up with that?  This is ancient code that
predates git.

drivers/scsi/aacraid/aachba.c
   382          if (maximum_num_containers < MAXIMUM_NUM_CONTAINERS)
   383                  maximum_num_containers = MAXIMUM_NUM_CONTAINERS;
   384          fsa_dev_ptr = kzalloc(sizeof(*fsa_dev_ptr) * maximum_num_containers,
   385                          GFP_KERNEL);

Btw, if maximum_num_containers were really a maximum instead of minimum
then it should be unsigned.  That was what brought the code to my
attention initially.

drivers/scsi/aacraid/linit.c
  1235          if (shost->max_id < MAXIMUM_NUM_CONTAINERS)
  1236                  shost->max_id = MAXIMUM_NUM_CONTAINERS;
  1237          else
  1238                  shost->this_id = shost->max_id;

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: aacraid question: is maximum_num_containers supposed to be minimum?
  2012-01-11  8:28 aacraid question: is maximum_num_containers supposed to be minimum? Dan Carpenter
@ 2012-01-11  8:38 ` Xi Wang
  2012-01-11  9:04   ` Dan Carpenter
  2012-01-11 14:15 ` Mark Salyzyn
  1 sibling, 1 reply; 4+ messages in thread
From: Xi Wang @ 2012-01-11  8:38 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Adaptec OEM Raid Solutions, Haogang Chen, linux-scsi,
	linux-kernel

On Jan 11, 2012, at 3:28 AM, Dan Carpenter wrote:
> MAXIMUM_NUM_CONTAINERS is consistently used as a minimum not a maximum
> so I was wondering what was up with that?  This is ancient code that
> predates git.

Check out some early discussion. ;-)

https://lkml.org/lkml/2011/12/3/85

- xi

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: aacraid question: is maximum_num_containers supposed to be minimum?
  2012-01-11  8:38 ` Xi Wang
@ 2012-01-11  9:04   ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2012-01-11  9:04 UTC (permalink / raw)
  To: Xi Wang; +Cc: Adaptec OEM Raid Solutions, Haogang Chen, linux-scsi,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 704 bytes --]

On Wed, Jan 11, 2012 at 03:38:55AM -0500, Xi Wang wrote:
> On Jan 11, 2012, at 3:28 AM, Dan Carpenter wrote:
> > MAXIMUM_NUM_CONTAINERS is consistently used as a minimum not a maximum
> > so I was wondering what was up with that?  This is ancient code that
> > predates git.
> 
> Check out some early discussion. ;-)
> 
> https://lkml.org/lkml/2011/12/3/85

Heh.  That's weird that we were both looking at the same code so
many years down the line.

Still Haogang is assuming that MAXIMUM_NUM_CONTAINERS is supposed to
be a minimum instead of it just being used that way by mistake.
Mark is more familiar with code and thought it was supposed to be a
maximum.

regards,
dan carpenter

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: aacraid question: is maximum_num_containers supposed to be minimum?
  2012-01-11  8:28 aacraid question: is maximum_num_containers supposed to be minimum? Dan Carpenter
  2012-01-11  8:38 ` Xi Wang
@ 2012-01-11 14:15 ` Mark Salyzyn
  1 sibling, 0 replies; 4+ messages in thread
From: Mark Salyzyn @ 2012-01-11 14:15 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Adaptec OEM Raid Solutions, linux-scsi, linux-kernel

It is *both*, in part because of history, and usage.

Initially the value was the hard coded maximum number of containers (arrays) for the earlier Firmware that never reported what they were capable of, until the value became variable based on Firmware Release with a new information field. Older Firmware would report zero.

In order to stress compatibility, and reliability should the value that is returned from the Firmware report badly, if a controller had less than this value, then we would allocate at least that amount of space for containers. This is the point at which the value went from being a maximum to a minimum.

The first bus is the containers, the remaining higher buses are the physical devices. If the number of ids on a physical bus is less than the number of containers, then we up it to match the first bus to that we have symmetry. An addition check,along this vein, to make sure that the max_ids is at least the returned maximum_num_containers ...

A clarification patch replacing minimum with maximum would help, but is purely cosmetic. You are the first person to ask this question in over a decade ;->

Sincerely -- Mark Salyzyn

On Jan 11, 2012, at 3:28 AM, Dan Carpenter wrote:

> MAXIMUM_NUM_CONTAINERS is consistently used as a minimum not a maximum
> so I was wondering what was up with that?  This is ancient code that
> predates git.
> 
> drivers/scsi/aacraid/aachba.c
>   382          if (maximum_num_containers < MAXIMUM_NUM_CONTAINERS)
>   383                  maximum_num_containers = MAXIMUM_NUM_CONTAINERS;
>   384          fsa_dev_ptr = kzalloc(sizeof(*fsa_dev_ptr) * maximum_num_containers,
>   385                          GFP_KERNEL);
> 
> Btw, if maximum_num_containers were really a maximum instead of minimum
> then it should be unsigned.  That was what brought the code to my
> attention initially.
> 
> drivers/scsi/aacraid/linit.c
>  1235          if (shost->max_id < MAXIMUM_NUM_CONTAINERS)
>  1236                  shost->max_id = MAXIMUM_NUM_CONTAINERS;
>  1237          else
>  1238                  shost->this_id = shost->max_id;
> 
> regards,
> dan carpenter
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-01-11 14:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-11  8:28 aacraid question: is maximum_num_containers supposed to be minimum? Dan Carpenter
2012-01-11  8:38 ` Xi Wang
2012-01-11  9:04   ` Dan Carpenter
2012-01-11 14:15 ` Mark Salyzyn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox