libata: add extra internal command
Bump the internal tag to 32, instead of stealing the last tag in our regular command space. This works just fine, since we don't actually need a separate hardware tag for this. Internal commands cannot coexist with NCQ commands. As a bonus, we get rid of the special casing of what tag to use for the internal command. This is in preparation for utilizing all 32 commands for normal IO. Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Tejun Heo <tj@kernel.org>
This commit is contained in:
@@ -125,9 +125,8 @@ enum {
|
||||
LIBATA_MAX_PRD = ATA_MAX_PRD / 2,
|
||||
LIBATA_DUMB_MAX_PRD = ATA_MAX_PRD / 4, /* Worst case */
|
||||
ATA_DEF_QUEUE = 1,
|
||||
/* tag ATA_MAX_QUEUE - 1 is reserved for internal commands */
|
||||
ATA_MAX_QUEUE = 32,
|
||||
ATA_TAG_INTERNAL = ATA_MAX_QUEUE - 1,
|
||||
ATA_TAG_INTERNAL = ATA_MAX_QUEUE,
|
||||
ATA_SHORT_PAUSE = 16,
|
||||
|
||||
ATAPI_MAX_DRAIN = 16 << 10,
|
||||
@@ -850,7 +849,7 @@ struct ata_port {
|
||||
unsigned int udma_mask;
|
||||
unsigned int cbl; /* cable type; ATA_CBL_xxx */
|
||||
|
||||
struct ata_queued_cmd qcmd[ATA_MAX_QUEUE];
|
||||
struct ata_queued_cmd qcmd[ATA_MAX_QUEUE + 1];
|
||||
unsigned long sas_tag_allocated; /* for sas tag allocation only */
|
||||
u64 qc_active;
|
||||
int nr_active_links; /* #links with active qcs */
|
||||
@@ -1486,16 +1485,16 @@ extern void ata_port_pbar_desc(struct ata_port *ap, int bar, ssize_t offset,
|
||||
const char *name);
|
||||
#endif
|
||||
|
||||
static inline unsigned int ata_tag_valid(unsigned int tag)
|
||||
{
|
||||
return (tag < ATA_MAX_QUEUE) ? 1 : 0;
|
||||
}
|
||||
|
||||
static inline bool ata_tag_internal(unsigned int tag)
|
||||
{
|
||||
return tag == ATA_TAG_INTERNAL;
|
||||
}
|
||||
|
||||
static inline bool ata_tag_valid(unsigned int tag)
|
||||
{
|
||||
return tag < ATA_MAX_QUEUE || ata_tag_internal(tag);
|
||||
}
|
||||
|
||||
/*
|
||||
* device helpers
|
||||
*/
|
||||
@@ -1656,7 +1655,7 @@ static inline void ata_qc_set_polling(struct ata_queued_cmd *qc)
|
||||
static inline struct ata_queued_cmd *__ata_qc_from_tag(struct ata_port *ap,
|
||||
unsigned int tag)
|
||||
{
|
||||
if (likely(ata_tag_valid(tag)))
|
||||
if (ata_tag_valid(tag))
|
||||
return &ap->qcmd[tag];
|
||||
return NULL;
|
||||
}
|
||||
|
Reference in New Issue
Block a user