Re: [PATCH 07/13] sd: Translate data lifetime information

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/2/23 06:11, Avri Altman wrote:
sd_setup_read_write_cmnd(struct scsi_cmnd *cmd)
                 ret = sd_setup_rw16_cmnd(cmd, write, lba, nr_blocks,
                                          protect | fua, dld);
         } else if ((nr_blocks > 0xff) || (lba > 0x1fffff) ||
-                  sdp->use_10_for_rw || protect) {
+                  sdp->use_10_for_rw || protect ||
+                  rq->write_hint != WRITE_LIFE_NOT_SET) {

Is this a typo?

I don't see a typo? Am I perhaps overlooking something?

+static void sd_read_io_hints(struct scsi_disk *sdkp, unsigned char *buffer)
+{
+       struct scsi_device *sdp = sdkp->device;
+       const struct scsi_io_group_descriptor *desc, *start, *end;
+       struct scsi_sense_hdr sshdr;
+       struct scsi_mode_data data;
+       int res;
+
+       res = scsi_mode_sense(sdp, /*dbd=*/0x8, /*modepage=*/0x0a,
+                             /*subpage=*/0x05, buffer, SD_BUF_SIZE,
+                             SD_TIMEOUT, sdkp->max_retries, &data, &sshdr);
+       if (res < 0)
+               return;
+       start = (void *)buffer + data.header_length + 16;
+       end = (void *)buffer + ((data.header_length + data.length)
+                               & ~(sizeof(*end) - 1));
+       /*
+        * From "SBC-5 Constrained Streams with Data Lifetimes": Device severs
+        * should assign the lowest numbered stream identifiers to permanent
+        * streams.
+        */
+       for (desc = start; desc < end; desc++)
+               if (!desc->st_enble)
+                       break;
I don't see how you can conclude that the stream is permanent,
without reading the perm bit from the stream status descriptor.

I will add code that retrieves the stream status and that checks the PERM bit.

diff --git a/drivers/scsi/sd.h b/drivers/scsi/sd.h
index 84685168b6e0..1863de5ebae4 100644
--- a/drivers/scsi/sd.h
+++ b/drivers/scsi/sd.h
@@ -125,6 +125,7 @@ struct scsi_disk {
         unsigned int    physical_block_size;
         unsigned int    max_medium_access_timeouts;
         unsigned int    medium_access_timed_out;
+       u16             permanent_stream_count; /* maximum number of streams
*/

This comment is a bit misleading:
The Block Limits Extension VPD page has a "maximum number of streams" field.
Maybe avoid the unnecessary confusion?

I will change that comment or leave it out.

Thanks,

Bart.




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux