diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-02-12 17:30:53 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-02-12 17:30:53 -0500 |
commit | 8494bcf5b7c4b2416687e233dd34d4c6b6fe5653 (patch) | |
tree | cebb468e170e639ecfd61ddc5ebcba86c21105fa /drivers/ata | |
parent | 3e12cefbe143b4947171ff92dd50024c4841e291 (diff) | |
parent | b042a3ca949053231950a1b15f31cccca9e305f3 (diff) |
Merge branch 'for-3.20/drivers' of git://git.kernel.dk/linux-block
Pull block driver changes from Jens Axboe:
"This contains:
- The 4k/partition fixes for brd from Boaz/Matthew.
- A few xen front/back block fixes from David Vrabel and Roger Pau
Monne.
- Floppy changes from Takashi, cleaning the device file creation.
- Switching libata to use the new blk-mq tagging policy, removing
code (and a suboptimal implementation) from libata. This will
throw you a merge conflict, since a bug in the original libata
tagging code was fixed since this code was branched. Trivial.
From Shaohua.
- Conversion of loop to blk-mq, from Ming Lei.
- Cleanup of the io_schedule() handling in bsg from Peter Zijlstra.
He claims it improves on unreadable code, which will cost him a
beer.
- Maintainer update or NDB, now handled by Markus Pargmann.
- NVMe:
- Optimization from me that avoids a kmalloc/kfree per IO for
smaller (<= 8KB) IO. This cuts about 1% of high IOPS CPU
overhead.
- Removal of (now) dead RCU code, a relic from before NVMe was
converted to blk-mq"
* 'for-3.20/drivers' of git://git.kernel.dk/linux-block:
xen-blkback: default to X86_32 ABI on x86
xen-blkfront: fix accounting of reqs when migrating
xen-blkback,xen-blkfront: add myself as maintainer
block: Simplify bsg complete all
floppy: Avoid manual call of device_create_file()
NVMe: avoid kmalloc/kfree for smaller IO
MAINTAINERS: Update NBD maintainer
libata: make sata_sil24 use fifo tag allocator
libata: move sas ata tag allocation to libata-scsi.c
libata: use blk taging
NVMe: within nvme_free_queues(), delete RCU sychro/deferred free
null_blk: suppress invalid partition info
brd: Request from fdisk 4k alignment
brd: Fix all partitions BUGs
axonram: Fix bug in direct_access
loop: add blk-mq.h include
block: loop: don't handle REQ_FUA explicitly
block: loop: introduce lo_discard() and lo_req_flush()
block: loop: say goodby to bio
block: loop: improve performance via blk-mq
Diffstat (limited to 'drivers/ata')
-rw-r--r-- | drivers/ata/libata-core.c | 70 | ||||
-rw-r--r-- | drivers/ata/libata-scsi.c | 33 | ||||
-rw-r--r-- | drivers/ata/libata.h | 4 | ||||
-rw-r--r-- | drivers/ata/sata_sil24.c | 1 |
4 files changed, 54 insertions, 54 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 4b0d5e71858e..4c35f0822d06 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -1585,8 +1585,6 @@ unsigned ata_exec_internal_sg(struct ata_device *dev, | |||
1585 | else | 1585 | else |
1586 | tag = 0; | 1586 | tag = 0; |
1587 | 1587 | ||
1588 | if (test_and_set_bit(tag, &ap->qc_allocated)) | ||
1589 | BUG(); | ||
1590 | qc = __ata_qc_from_tag(ap, tag); | 1588 | qc = __ata_qc_from_tag(ap, tag); |
1591 | 1589 | ||
1592 | qc->tag = tag; | 1590 | qc->tag = tag; |
@@ -4722,69 +4720,36 @@ void swap_buf_le16(u16 *buf, unsigned int buf_words) | |||
4722 | } | 4720 | } |
4723 | 4721 | ||
4724 | /** | 4722 | /** |
4725 | * ata_qc_new - Request an available ATA command, for queueing | 4723 | * ata_qc_new_init - Request an available ATA command, and initialize it |
4726 | * @ap: target port | 4724 | * @dev: Device from whom we request an available command structure |
4727 | * | ||
4728 | * Some ATA host controllers may implement a queue depth which is less | ||
4729 | * than ATA_MAX_QUEUE. So we shouldn't allocate a tag which is beyond | ||
4730 | * the hardware limitation. | ||
4731 | * | 4725 | * |
4732 | * LOCKING: | 4726 | * LOCKING: |
4733 | * None. | 4727 | * None. |
4734 | */ | 4728 | */ |
4735 | 4729 | ||
4736 | static struct ata_queued_cmd *ata_qc_new(struct ata_port *ap) | 4730 | struct ata_queued_cmd *ata_qc_new_init(struct ata_device *dev, int tag) |
4737 | { | 4731 | { |
4738 | struct ata_queued_cmd *qc = NULL; | 4732 | struct ata_port *ap = dev->link->ap; |
4739 | unsigned int max_queue = ap->host->n_tags; | 4733 | struct ata_queued_cmd *qc; |
4740 | unsigned int i, tag; | ||
4741 | 4734 | ||
4742 | /* no command while frozen */ | 4735 | /* no command while frozen */ |
4743 | if (unlikely(ap->pflags & ATA_PFLAG_FROZEN)) | 4736 | if (unlikely(ap->pflags & ATA_PFLAG_FROZEN)) |
4744 | return NULL; | 4737 | return NULL; |
4745 | 4738 | ||
4746 | for (i = 0, tag = ap->last_tag + 1; i < max_queue; i++, tag++) { | 4739 | /* libsas case */ |
4747 | if (ap->flags & ATA_FLAG_LOWTAG) | 4740 | if (!ap->scsi_host) { |
4748 | tag = i; | 4741 | tag = ata_sas_allocate_tag(ap); |
4749 | else | 4742 | if (tag < 0) |
4750 | tag = tag < max_queue ? tag : 0; | 4743 | return NULL; |
4751 | |||
4752 | /* the last tag is reserved for internal command. */ | ||
4753 | if (tag == ATA_TAG_INTERNAL) | ||
4754 | continue; | ||
4755 | |||
4756 | if (!test_and_set_bit(tag, &ap->qc_allocated)) { | ||
4757 | qc = __ata_qc_from_tag(ap, tag); | ||
4758 | qc->tag = tag; | ||
4759 | ap->last_tag = tag; | ||
4760 | break; | ||
4761 | } | ||
4762 | } | 4744 | } |
4763 | 4745 | ||
4764 | return qc; | 4746 | qc = __ata_qc_from_tag(ap, tag); |
4765 | } | 4747 | qc->tag = tag; |
4766 | 4748 | qc->scsicmd = NULL; | |
4767 | /** | 4749 | qc->ap = ap; |
4768 | * ata_qc_new_init - Request an available ATA command, and initialize it | 4750 | qc->dev = dev; |
4769 | * @dev: Device from whom we request an available command structure | ||
4770 | * | ||
4771 | * LOCKING: | ||
4772 | * None. | ||
4773 | */ | ||
4774 | |||
4775 | struct ata_queued_cmd *ata_qc_new_init(struct ata_device *dev) | ||
4776 | { | ||
4777 | struct ata_port *ap = dev->link->ap; | ||
4778 | struct ata_queued_cmd *qc; | ||
4779 | |||
4780 | qc = ata_qc_new(ap); | ||
4781 | if (qc) { | ||
4782 | qc->scsicmd = NULL; | ||
4783 | qc->ap = ap; | ||
4784 | qc->dev = dev; | ||
4785 | 4751 | ||
4786 | ata_qc_reinit(qc); | 4752 | ata_qc_reinit(qc); |
4787 | } | ||
4788 | 4753 | ||
4789 | return qc; | 4754 | return qc; |
4790 | } | 4755 | } |
@@ -4811,7 +4776,8 @@ void ata_qc_free(struct ata_queued_cmd *qc) | |||
4811 | tag = qc->tag; | 4776 | tag = qc->tag; |
4812 | if (likely(ata_tag_valid(tag))) { | 4777 | if (likely(ata_tag_valid(tag))) { |
4813 | qc->tag = ATA_TAG_POISON; | 4778 | qc->tag = ATA_TAG_POISON; |
4814 | clear_bit(tag, &ap->qc_allocated); | 4779 | if (!ap->scsi_host) |
4780 | ata_sas_free_tag(tag, ap); | ||
4815 | } | 4781 | } |
4816 | } | 4782 | } |
4817 | 4783 | ||
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 280729325ebd..b061ba2c31d8 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c | |||
@@ -756,7 +756,7 @@ static struct ata_queued_cmd *ata_scsi_qc_new(struct ata_device *dev, | |||
756 | { | 756 | { |
757 | struct ata_queued_cmd *qc; | 757 | struct ata_queued_cmd *qc; |
758 | 758 | ||
759 | qc = ata_qc_new_init(dev); | 759 | qc = ata_qc_new_init(dev, cmd->request->tag); |
760 | if (qc) { | 760 | if (qc) { |
761 | qc->scsicmd = cmd; | 761 | qc->scsicmd = cmd; |
762 | qc->scsidone = cmd->scsi_done; | 762 | qc->scsidone = cmd->scsi_done; |
@@ -3668,6 +3668,9 @@ int ata_scsi_add_hosts(struct ata_host *host, struct scsi_host_template *sht) | |||
3668 | */ | 3668 | */ |
3669 | shost->max_host_blocked = 1; | 3669 | shost->max_host_blocked = 1; |
3670 | 3670 | ||
3671 | if (scsi_init_shared_tag_map(shost, host->n_tags)) | ||
3672 | goto err_add; | ||
3673 | |||
3671 | rc = scsi_add_host_with_dma(ap->scsi_host, | 3674 | rc = scsi_add_host_with_dma(ap->scsi_host, |
3672 | &ap->tdev, ap->host->dev); | 3675 | &ap->tdev, ap->host->dev); |
3673 | if (rc) | 3676 | if (rc) |
@@ -4230,3 +4233,31 @@ int ata_sas_queuecmd(struct scsi_cmnd *cmd, struct ata_port *ap) | |||
4230 | return rc; | 4233 | return rc; |
4231 | } | 4234 | } |
4232 | EXPORT_SYMBOL_GPL(ata_sas_queuecmd); | 4235 | EXPORT_SYMBOL_GPL(ata_sas_queuecmd); |
4236 | |||
4237 | int ata_sas_allocate_tag(struct ata_port *ap) | ||
4238 | { | ||
4239 | unsigned int max_queue = ap->host->n_tags; | ||
4240 | unsigned int i, tag; | ||
4241 | |||
4242 | for (i = 0, tag = ap->sas_last_tag + 1; i < max_queue; i++, tag++) { | ||
4243 | if (ap->flags & ATA_FLAG_LOWTAG) | ||
4244 | tag = 1; | ||
4245 | else | ||
4246 | tag = tag < max_queue ? tag : 0; | ||
4247 | |||
4248 | /* the last tag is reserved for internal command. */ | ||
4249 | if (tag == ATA_TAG_INTERNAL) | ||
4250 | continue; | ||
4251 | |||
4252 | if (!test_and_set_bit(tag, &ap->sas_tag_allocated)) { | ||
4253 | ap->sas_last_tag = tag; | ||
4254 | return tag; | ||
4255 | } | ||
4256 | } | ||
4257 | return -1; | ||
4258 | } | ||
4259 | |||
4260 | void ata_sas_free_tag(unsigned int tag, struct ata_port *ap) | ||
4261 | { | ||
4262 | clear_bit(tag, &ap->sas_tag_allocated); | ||
4263 | } | ||
diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h index 82ebe263d2f1..f840ca18a7c0 100644 --- a/drivers/ata/libata.h +++ b/drivers/ata/libata.h | |||
@@ -63,7 +63,7 @@ extern struct ata_link *ata_dev_phys_link(struct ata_device *dev); | |||
63 | extern void ata_force_cbl(struct ata_port *ap); | 63 | extern void ata_force_cbl(struct ata_port *ap); |
64 | extern u64 ata_tf_to_lba(const struct ata_taskfile *tf); | 64 | extern u64 ata_tf_to_lba(const struct ata_taskfile *tf); |
65 | extern u64 ata_tf_to_lba48(const struct ata_taskfile *tf); | 65 | extern u64 ata_tf_to_lba48(const struct ata_taskfile *tf); |
66 | extern struct ata_queued_cmd *ata_qc_new_init(struct ata_device *dev); | 66 | extern struct ata_queued_cmd *ata_qc_new_init(struct ata_device *dev, int tag); |
67 | extern int ata_build_rw_tf(struct ata_taskfile *tf, struct ata_device *dev, | 67 | extern int ata_build_rw_tf(struct ata_taskfile *tf, struct ata_device *dev, |
68 | u64 block, u32 n_block, unsigned int tf_flags, | 68 | u64 block, u32 n_block, unsigned int tf_flags, |
69 | unsigned int tag); | 69 | unsigned int tag); |
@@ -144,6 +144,8 @@ extern void ata_scsi_dev_rescan(struct work_struct *work); | |||
144 | extern int ata_bus_probe(struct ata_port *ap); | 144 | extern int ata_bus_probe(struct ata_port *ap); |
145 | extern int ata_scsi_user_scan(struct Scsi_Host *shost, unsigned int channel, | 145 | extern int ata_scsi_user_scan(struct Scsi_Host *shost, unsigned int channel, |
146 | unsigned int id, u64 lun); | 146 | unsigned int id, u64 lun); |
147 | int ata_sas_allocate_tag(struct ata_port *ap); | ||
148 | void ata_sas_free_tag(unsigned int tag, struct ata_port *ap); | ||
147 | 149 | ||
148 | 150 | ||
149 | /* libata-eh.c */ | 151 | /* libata-eh.c */ |
diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c index ea655949023f..ba2667fa0528 100644 --- a/drivers/ata/sata_sil24.c +++ b/drivers/ata/sata_sil24.c | |||
@@ -388,6 +388,7 @@ static struct scsi_host_template sil24_sht = { | |||
388 | .can_queue = SIL24_MAX_CMDS, | 388 | .can_queue = SIL24_MAX_CMDS, |
389 | .sg_tablesize = SIL24_MAX_SGE, | 389 | .sg_tablesize = SIL24_MAX_SGE, |
390 | .dma_boundary = ATA_DMA_BOUNDARY, | 390 | .dma_boundary = ATA_DMA_BOUNDARY, |
391 | .tag_alloc_policy = BLK_TAG_ALLOC_FIFO, | ||
391 | }; | 392 | }; |
392 | 393 | ||
393 | static struct ata_port_operations sil24_ops = { | 394 | static struct ata_port_operations sil24_ops = { |