Re: [PATCH v6 2/4] Add support for SCT Write Same
From: Tom Yan <hidden>
Date: 2016-08-25 06:40:45
Also in:
lkml
You only fill the bytes that you want to to set explicitly: + put_unaligned_le16(0x0002, &sctpg[0]); /* SCT_ACT_WRITE_SAME */ + put_unaligned_le16(0x0101, &sctpg[1]); /* WRITE PTRN FG */ + put_unaligned_le64(lba, &sctpg[2]); + put_unaligned_le64(num, &sctpg[6]); + put_unaligned_le32(0u, &sctpg[10]); What I doubted is, if you don't memset (zero-fill) the buffer first, will other bytes have indeterministic value that causes random unexpected behavior? On 25 August 2016 at 06:04, Shaun Tancheff [off-list ref] wrote:
On Wed, Aug 24, 2016 at 1:10 AM, Tom Yan [off-list ref] wrote:quoted
Btw, I wonder if you need to memset your buffer with 0 first, like what is done in ata_scsi_rbuf_get.It is not necessary as the defined buffer is completely filled out here. Are you thinking as a sort of future proofing? Ex: In the unlikely event that the SCT Write Same command descriptor is expanded in a future ACS? It is more likely to see the command deprecated and replaced with a new SCT feature. Regardless of how unlikely I would consider a memset here to clear the remainder of the payload.