Re: [PATCH v2 4/6] scsi: pm8001: Use sas_task_find_rq() for tagging

From: John Garry
Date: Tue Oct 04 2022 - 03:37:09 EST


On 04/10/2022 06:53, Hannes Reinecke wrote:
-    void *bitmap = pm8001_ha->tags;
+    void *bitmap = pm8001_ha->rsvd_tags;
      unsigned long flags;
      unsigned int tag;
      spin_lock_irqsave(&pm8001_ha->bitmap_lock, flags);
-    tag = find_first_zero_bit(bitmap, pm8001_ha->tags_num);
-    if (tag >= pm8001_ha->tags_num) {
+    tag = find_first_zero_bit(bitmap, PM8001_RESERVE_SLOT);
+    if (tag >= PM8001_RESERVE_SLOT) {
          spin_unlock_irqrestore(&pm8001_ha->bitmap_lock, flags);
          return -SAS_QUEUE_FULL;
      }
      __set_bit(tag, bitmap);
      spin_unlock_irqrestore(&pm8001_ha->bitmap_lock, flags);
+
+    /* reserved tags are in the upper region of the tagset */
+    tag += pm8001_ha->shost->can_queue;
      *tag_out = tag;
      return 0;
  }
Can you move the reserved tags to the _lower_ region of the tagset?
That way the tag allocation scheme matches with what the block-layer does, and the eventual conversion to reserved tags becomes easier.

Yeah, I agree that having a scheme which matches the block layer would be good for consistency and I will make that change, but I am not sure how it helps conversion to reserved tags.

Thanks,
John