- void *bitmap = pm8001_ha->tags;Can you move the reserved tags to the _lower_ region of the tagset?
+ 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;
}
That way the tag allocation scheme matches with what the block-layer does, and the eventual conversion to reserved tags becomes easier.