diff options
author | Damien Le Moal <damien.lemoal@wdc.com> | 2017-12-21 09:43:44 +0300 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2018-01-09 06:27:32 +0300 |
commit | 39051dd85f2870624c3fc7a099b11c67fb822aed (patch) | |
tree | 3cdf261d28887558ab64b729bdea9cc83f5b6f3a /drivers/scsi/sd_zbc.c | |
parent | 23349ca93aed05917d9178d0a9e21db599a0eb5d (diff) | |
download | linux-39051dd85f2870624c3fc7a099b11c67fb822aed.tar.xz |
scsi: sd: Remove zone write locking
The block layer now handles zone write locking.
[mkp: removed SCMD_ZONE_WRITE_LOCK reference in scsi_debugfs]
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/sd_zbc.c')
-rw-r--r-- | drivers/scsi/sd_zbc.c | 83 |
1 files changed, 0 insertions, 83 deletions
diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c index c715b8363ce0..6c348a211ebb 100644 --- a/drivers/scsi/sd_zbc.c +++ b/drivers/scsi/sd_zbc.c @@ -230,17 +230,6 @@ static inline sector_t sd_zbc_zone_sectors(struct scsi_disk *sdkp) } /** - * sd_zbc_zone_no - Get the number of the zone conataining a sector. - * @sdkp: The target disk - * @sector: 512B sector address contained in the zone - */ -static inline unsigned int sd_zbc_zone_no(struct scsi_disk *sdkp, - sector_t sector) -{ - return sectors_to_logical(sdkp->device, sector) >> sdkp->zone_shift; -} - -/** * sd_zbc_setup_reset_cmnd - Prepare a RESET WRITE POINTER scsi command. * @cmd: the command to setup * @@ -279,78 +268,6 @@ int sd_zbc_setup_reset_cmnd(struct scsi_cmnd *cmd) } /** - * sd_zbc_write_lock_zone - Write lock a sequential zone. - * @cmd: write command - * - * Called from sd_init_cmd() for write requests (standard write, write same or - * write zeroes operations). If the request target zone is not already locked, - * the zone is locked and BLKPREP_OK returned, allowing the request to proceed - * through dispatch in scsi_request_fn(). Otherwise, BLKPREP_DEFER is returned, - * forcing the request to wait for the zone to be unlocked, that is, for the - * previously issued write request targeting the same zone to complete. - * - * This is called from blk_peek_request() context with the queue lock held and - * before the request is removed from the scheduler. As a result, multiple - * contexts executing concurrently scsi_request_fn() cannot result in write - * sequence reordering as only a single write request per zone is allowed to - * proceed. - */ -int sd_zbc_write_lock_zone(struct scsi_cmnd *cmd) -{ - struct request *rq = cmd->request; - struct scsi_disk *sdkp = scsi_disk(rq->rq_disk); - sector_t sector = blk_rq_pos(rq); - sector_t zone_sectors = sd_zbc_zone_sectors(sdkp); - unsigned int zno = sd_zbc_zone_no(sdkp, sector); - - /* - * Note: Checks of the alignment of the write command on - * logical blocks is done in sd.c - */ - - /* Do not allow zone boundaries crossing on host-managed drives */ - if (blk_queue_zoned_model(sdkp->disk->queue) == BLK_ZONED_HM && - (sector & (zone_sectors - 1)) + blk_rq_sectors(rq) > zone_sectors) - return BLKPREP_KILL; - - /* - * Do not issue more than one write at a time per - * zone. This solves write ordering problems due to - * the unlocking of the request queue in the dispatch - * path in the non scsi-mq case. - */ - if (sdkp->zones_wlock && - test_and_set_bit(zno, sdkp->zones_wlock)) - return BLKPREP_DEFER; - - WARN_ON_ONCE(cmd->flags & SCMD_ZONE_WRITE_LOCK); - cmd->flags |= SCMD_ZONE_WRITE_LOCK; - - return BLKPREP_OK; -} - -/** - * sd_zbc_write_unlock_zone - Write unlock a sequential zone. - * @cmd: write command - * - * Called from sd_uninit_cmd(). Unlocking the request target zone will allow - * dispatching the next write request for the zone. - */ -void sd_zbc_write_unlock_zone(struct scsi_cmnd *cmd) -{ - struct request *rq = cmd->request; - struct scsi_disk *sdkp = scsi_disk(rq->rq_disk); - - if (sdkp->zones_wlock && cmd->flags & SCMD_ZONE_WRITE_LOCK) { - unsigned int zno = sd_zbc_zone_no(sdkp, blk_rq_pos(rq)); - WARN_ON_ONCE(!test_bit(zno, sdkp->zones_wlock)); - cmd->flags &= ~SCMD_ZONE_WRITE_LOCK; - clear_bit_unlock(zno, sdkp->zones_wlock); - smp_mb__after_atomic(); - } -} - -/** * sd_zbc_complete - ZBC command post processing. * @cmd: Completed command * @good_bytes: Command reply bytes |