scsi: sd: sd_zbc: Rename sd_zbc_setup_write_cmnd
authorDamien Le Moal <damien.lemoal@wdc.com>
Mon, 24 Apr 2017 07:51:13 +0000 (16:51 +0900)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 25 Apr 2017 17:00:57 +0000 (13:00 -0400)
Rename sd_zbc_setup_write_cmnd() to sd_zbc_write_lock_zone() to be clear
about what the function actually does. To be consistent, also rename
sd_zbc_cancel_write_cmnd() to sd_zbc_write_unlock_zone().

No functional change is introduced by this patch.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Reviewed-by: Bart Van Assche <Bart.VanAssche@sandisk.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/sd.c
drivers/scsi/sd.h
drivers/scsi/sd_zbc.c

index 7aa00d95f69f2f80706c01b4ea1dd146e0f3e304..4195b7c7f81e6912e0af769f56df7f41ea63be5f 100644 (file)
@@ -846,7 +846,7 @@ static int sd_setup_write_same_cmnd(struct scsi_cmnd *cmd)
        BUG_ON(bio_offset(bio) || bio_iovec(bio).bv_len != sdp->sector_size);
 
        if (sd_is_zoned(sdkp)) {
-               ret = sd_zbc_setup_write_cmnd(cmd);
+               ret = sd_zbc_write_lock_zone(cmd);
                if (ret != BLKPREP_OK)
                        return ret;
        }
@@ -918,7 +918,7 @@ static int sd_setup_read_write_cmnd(struct scsi_cmnd *SCpnt)
        unsigned char protect;
 
        if (zoned_write) {
-               ret = sd_zbc_setup_write_cmnd(SCpnt);
+               ret = sd_zbc_write_lock_zone(SCpnt);
                if (ret != BLKPREP_OK)
                        return ret;
        }
@@ -1145,7 +1145,7 @@ static int sd_setup_read_write_cmnd(struct scsi_cmnd *SCpnt)
        ret = BLKPREP_OK;
  out:
        if (zoned_write && ret != BLKPREP_OK)
-               sd_zbc_cancel_write_cmnd(SCpnt);
+               sd_zbc_write_unlock_zone(SCpnt);
 
        return ret;
 }
index e6241c4458782522713313f6153dc8382e6660ff..952100232e24b7d02db66116a1588936dae22c33 100644 (file)
@@ -272,8 +272,8 @@ static inline int sd_is_zoned(struct scsi_disk *sdkp)
 extern int sd_zbc_read_zones(struct scsi_disk *sdkp, unsigned char *buffer);
 extern void sd_zbc_remove(struct scsi_disk *sdkp);
 extern void sd_zbc_print_zones(struct scsi_disk *sdkp);
-extern int sd_zbc_setup_write_cmnd(struct scsi_cmnd *cmd);
-extern void sd_zbc_cancel_write_cmnd(struct scsi_cmnd *cmd);
+extern int sd_zbc_write_lock_zone(struct scsi_cmnd *cmd);
+extern void sd_zbc_write_unlock_zone(struct scsi_cmnd *cmd);
 extern int sd_zbc_setup_report_cmnd(struct scsi_cmnd *cmd);
 extern int sd_zbc_setup_reset_cmnd(struct scsi_cmnd *cmd);
 extern void sd_zbc_complete(struct scsi_cmnd *cmd, unsigned int good_bytes,
@@ -291,13 +291,13 @@ static inline void sd_zbc_remove(struct scsi_disk *sdkp) {}
 
 static inline void sd_zbc_print_zones(struct scsi_disk *sdkp) {}
 
-static inline int sd_zbc_setup_write_cmnd(struct scsi_cmnd *cmd)
+static inline int sd_zbc_write_lock_zone(struct scsi_cmnd *cmd)
 {
        /* Let the drive fail requests */
        return BLKPREP_OK;
 }
 
-static inline void sd_zbc_cancel_write_cmnd(struct scsi_cmnd *cmd) {}
+static inline void sd_zbc_write_unlock_zone(struct scsi_cmnd *cmd) {}
 
 static inline int sd_zbc_setup_report_cmnd(struct scsi_cmnd *cmd)
 {
index 92620c8ea8ad93722c466652a4b82cd43013d8a8..a7926825b1205a398564099550e0284e7d9b8fd2 100644 (file)
@@ -269,7 +269,7 @@ int sd_zbc_setup_reset_cmnd(struct scsi_cmnd *cmd)
        return BLKPREP_OK;
 }
 
-int sd_zbc_setup_write_cmnd(struct scsi_cmnd *cmd)
+int sd_zbc_write_lock_zone(struct scsi_cmnd *cmd)
 {
        struct request *rq = cmd->request;
        struct scsi_disk *sdkp = scsi_disk(rq->rq_disk);
@@ -303,8 +303,9 @@ int sd_zbc_setup_write_cmnd(struct scsi_cmnd *cmd)
        return BLKPREP_OK;
 }
 
-static void sd_zbc_unlock_zone(struct request *rq)
+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) {
@@ -315,11 +316,6 @@ static void sd_zbc_unlock_zone(struct request *rq)
        }
 }
 
-void sd_zbc_cancel_write_cmnd(struct scsi_cmnd *cmd)
-{
-       sd_zbc_unlock_zone(cmd->request);
-}
-
 void sd_zbc_complete(struct scsi_cmnd *cmd,
                     unsigned int good_bytes,
                     struct scsi_sense_hdr *sshdr)
@@ -333,7 +329,7 @@ void sd_zbc_complete(struct scsi_cmnd *cmd,
        case REQ_OP_ZONE_RESET:
 
                /* Unlock the zone */
-               sd_zbc_unlock_zone(rq);
+               sd_zbc_write_unlock_zone(cmd);
 
                if (!result ||
                    sshdr->sense_key != ILLEGAL_REQUEST)