[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2abb1fb8-88c6-401d-b65f-b7001b2203ec@acm.org>
Date: Fri, 29 Sep 2023 10:59:14 -0700
From: Bart Van Assche <bvanassche@....org>
To: John Garry <john.g.garry@...cle.com>, axboe@...nel.dk,
kbusch@...nel.org, hch@....de, sagi@...mberg.me,
jejb@...ux.ibm.com, martin.petersen@...cle.com, djwong@...nel.org,
viro@...iv.linux.org.uk, brauner@...nel.org,
chandan.babu@...cle.com, dchinner@...hat.com
Cc: linux-block@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-nvme@...ts.infradead.org, linux-xfs@...r.kernel.org,
linux-fsdevel@...r.kernel.org, tytso@....edu, jbongio@...gle.com,
linux-api@...r.kernel.org
Subject: Re: [PATCH 19/21] scsi: sd: Add WRITE_ATOMIC_16 support
On 9/29/23 03:27, John Garry wrote:
> +static blk_status_t sd_setup_atomic_cmnd(struct scsi_cmnd *cmd,
> + sector_t lba, unsigned int nr_blocks,
> + unsigned char flags)
> +{
> + cmd->cmd_len = 16;
> + cmd->cmnd[0] = WRITE_ATOMIC_16;
> + cmd->cmnd[1] = flags;
> + put_unaligned_be64(lba, &cmd->cmnd[2]);
> + cmd->cmnd[10] = 0;
> + cmd->cmnd[11] = 0;
> + put_unaligned_be16(nr_blocks, &cmd->cmnd[12]);
> + cmd->cmnd[14] = 0;
> + cmd->cmnd[15] = 0;
> +
> + return BLK_STS_OK;
> +}
Please store the 'dld' value in the GROUP NUMBER field. See e.g.
sd_setup_rw16_cmnd().
> @@ -1139,6 +1156,7 @@ static blk_status_t sd_setup_read_write_cmnd(struct scsi_cmnd *cmd)
> unsigned int nr_blocks = sectors_to_logical(sdp, blk_rq_sectors(rq));
> unsigned int mask = logical_to_sectors(sdp, 1) - 1;
> bool write = rq_data_dir(rq) == WRITE;
> + bool atomic_write = !!(rq->cmd_flags & REQ_ATOMIC) && write;
Please leave out the superfluous "!!".
Thanks,
Bart.
Powered by blists - more mailing lists