public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <bart.vanassche@wdc.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org, Christoph Hellwig <hch@lst.de>,
	Bart Van Assche <bart.vanassche@wdc.com>,
	"Martin K . Petersen" <martin.petersen@oracle.com>,
	Ming Lei <ming.lei@redhat.com>
Subject: [PATCH 2/3] sd: Remove the __data_len hack for WRITE SAME again
Date: Mon, 25 Jun 2018 17:10:08 -0700	[thread overview]
Message-ID: <20180626001009.16557-3-bart.vanassche@wdc.com> (raw)
In-Reply-To: <20180626001009.16557-1-bart.vanassche@wdc.com>

Now that blk_rq_payload_bytes() has been fixed, remove the __data_len
hack again from sd_setup_write_same_cmnd(), the function that handles
REQ_OP_WRITE_SAME. See also commit 08965c2eba13 ("Revert "sd: remove
__data_len hack for WRITE SAME""). See also commit f80de881d8df ("sd:
remove __data_len hack for WRITE SAME").

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Cc: Martin K. Petersen <martin.petersen@oracle.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Ming Lei <ming.lei@redhat.com>
---
 drivers/scsi/sd.c | 18 +-----------------
 1 file changed, 1 insertion(+), 17 deletions(-)

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 9421d9877730..89da86308aaf 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -947,8 +947,6 @@ static int sd_setup_write_same_cmnd(struct scsi_cmnd *cmd)
 	struct bio *bio = rq->bio;
 	sector_t sector = blk_rq_pos(rq);
 	unsigned int nr_sectors = blk_rq_sectors(rq);
-	unsigned int nr_bytes = blk_rq_bytes(rq);
-	int ret;
 
 	if (sdkp->device->no_write_same)
 		return BLKPREP_INVALID;
@@ -975,21 +973,7 @@ static int sd_setup_write_same_cmnd(struct scsi_cmnd *cmd)
 	cmd->transfersize = sdp->sector_size;
 	cmd->allowed = SD_MAX_RETRIES;
 
-	/*
-	 * For WRITE SAME the data transferred via the DATA OUT buffer is
-	 * different from the amount of data actually written to the target.
-	 *
-	 * We set up __data_len to the amount of data transferred via the
-	 * DATA OUT buffer so that blk_rq_map_sg sets up the proper S/G list
-	 * to transfer a single sector of data first, but then reset it to
-	 * the amount of data to be written right after so that the I/O path
-	 * knows how much to actually write.
-	 */
-	rq->__data_len = sdp->sector_size;
-	ret = scsi_init_io(cmd);
-	rq->__data_len = nr_bytes;
-
-	return ret;
+	return scsi_init_io(cmd);
 }
 
 static int sd_setup_flush_cmnd(struct scsi_cmnd *cmd)
-- 
2.17.1

  parent reply	other threads:[~2018-06-26  0:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-26  0:10 [PATCH 0/3] Fix blk_mq_end_request() and blk_end_request() for WRITE SAME Bart Van Assche
2018-06-26  0:10 ` [PATCH 1/3] block: Fix blk_rq_payload_bytes() Bart Van Assche
2018-06-26  0:10 ` Bart Van Assche [this message]
2018-06-26  0:10 ` [PATCH 3/3] block: Fix blk_end_request_all() for WRITE SAME requests Bart Van Assche
2018-06-26 15:53 ` [PATCH 0/3] Fix blk_mq_end_request() and blk_end_request() for WRITE SAME Martin K. Petersen
2018-06-26 16:24   ` Bart Van Assche
2018-06-29  8:58   ` Christoph Hellwig
2018-06-29 15:50     ` Bart Van Assche

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180626001009.16557-3-bart.vanassche@wdc.com \
    --to=bart.vanassche@wdc.com \
    --cc=axboe@kernel.dk \
    --cc=hch@lst.de \
    --cc=linux-block@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=ming.lei@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox