From: Bart Van Assche <bvanassche@acm.org>
To: Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org, linux-scsi@vger.kernel.org,
linux-fsdevel@vger.kernel.org,
"Martin K . Petersen" <martin.petersen@oracle.com>,
Christoph Hellwig <hch@lst.de>,
Niklas Cassel <Niklas.Cassel@wdc.com>,
Avri Altman <Avri.Altman@wdc.com>, Bean Huo <huobean@gmail.com>,
Daejun Park <daejun7.park@samsung.com>,
Bart Van Assche <bvanassche@acm.org>,
Avri Altman <avri.altman@wdc.com>,
"James E.J. Bottomley" <jejb@linux.ibm.com>
Subject: [PATCH v3 05/14] scsi: core: Query the Block Limits Extension VPD page
Date: Tue, 17 Oct 2023 13:47:13 -0700 [thread overview]
Message-ID: <20231017204739.3409052-6-bvanassche@acm.org> (raw)
In-Reply-To: <20231017204739.3409052-1-bvanassche@acm.org>
Parse the Reduced Stream Control Supported (RSCS) bit from the block
limits extension VPD page. The RSCS bit is defined in SBC-5 r05
(https://www.t10.org/cgi-bin/ac.pl?t=f&f=sbc5r05.pdf).
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Reviewed-by: Daejun Park <daejun7.park@samsung.com>
Cc: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/scsi.c | 2 ++
drivers/scsi/scsi_sysfs.c | 10 ++++++++++
drivers/scsi/sd.c | 13 +++++++++++++
drivers/scsi/sd.h | 1 +
include/scsi/scsi_device.h | 1 +
5 files changed, 27 insertions(+)
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index d0911bc28663..5ad291770806 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -499,6 +499,8 @@ void scsi_attach_vpd(struct scsi_device *sdev)
scsi_update_vpd_page(sdev, 0xb1, &sdev->vpd_pgb1);
if (vpd_buf->data[i] == 0xb2)
scsi_update_vpd_page(sdev, 0xb2, &sdev->vpd_pgb2);
+ if (vpd_buf->data[i] == 0xb7)
+ scsi_update_vpd_page(sdev, 0xb7, &sdev->vpd_pgb7);
}
kfree(vpd_buf);
}
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index 24f6eefb6803..93652a786a46 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -449,6 +449,7 @@ static void scsi_device_dev_release(struct device *dev)
struct scsi_vpd *vpd_pg80 = NULL, *vpd_pg83 = NULL;
struct scsi_vpd *vpd_pg0 = NULL, *vpd_pg89 = NULL;
struct scsi_vpd *vpd_pgb0 = NULL, *vpd_pgb1 = NULL, *vpd_pgb2 = NULL;
+ struct scsi_vpd *vpd_pgb7 = NULL;
unsigned long flags;
might_sleep();
@@ -494,6 +495,8 @@ static void scsi_device_dev_release(struct device *dev)
lockdep_is_held(&sdev->inquiry_mutex));
vpd_pgb2 = rcu_replace_pointer(sdev->vpd_pgb2, vpd_pgb2,
lockdep_is_held(&sdev->inquiry_mutex));
+ vpd_pgb7 = rcu_replace_pointer(sdev->vpd_pgb7, vpd_pgb7,
+ lockdep_is_held(&sdev->inquiry_mutex));
mutex_unlock(&sdev->inquiry_mutex);
if (vpd_pg0)
@@ -510,6 +513,8 @@ static void scsi_device_dev_release(struct device *dev)
kfree_rcu(vpd_pgb1, rcu);
if (vpd_pgb2)
kfree_rcu(vpd_pgb2, rcu);
+ if (vpd_pgb7)
+ kfree_rcu(vpd_pgb7, rcu);
kfree(sdev->inquiry);
kfree(sdev);
@@ -921,6 +926,7 @@ sdev_vpd_pg_attr(pg89);
sdev_vpd_pg_attr(pgb0);
sdev_vpd_pg_attr(pgb1);
sdev_vpd_pg_attr(pgb2);
+sdev_vpd_pg_attr(pgb7);
sdev_vpd_pg_attr(pg0);
static ssize_t show_inquiry(struct file *filep, struct kobject *kobj,
@@ -1295,6 +1301,9 @@ static umode_t scsi_sdev_bin_attr_is_visible(struct kobject *kobj,
if (attr == &dev_attr_vpd_pgb2 && !sdev->vpd_pgb2)
return 0;
+ if (attr == &dev_attr_vpd_pgb7 && !sdev->vpd_pgb7)
+ return 0;
+
return S_IRUGO;
}
@@ -1347,6 +1356,7 @@ static struct bin_attribute *scsi_sdev_bin_attrs[] = {
&dev_attr_vpd_pgb0,
&dev_attr_vpd_pgb1,
&dev_attr_vpd_pgb2,
+ &dev_attr_vpd_pgb7,
&dev_attr_inquiry,
NULL
};
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index c92a317ba547..879edbc1a065 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -3019,6 +3019,18 @@ static void sd_read_block_limits(struct scsi_disk *sdkp)
rcu_read_unlock();
}
+/* Parse the Block Limits Extension VPD page (0xb7) */
+static void sd_read_block_limits_ext(struct scsi_disk *sdkp)
+{
+ struct scsi_vpd *vpd;
+
+ rcu_read_lock();
+ vpd = rcu_dereference(sdkp->device->vpd_pgb7);
+ if (vpd && vpd->len >= 2)
+ sdkp->rscs = vpd->data[5] & 1;
+ rcu_read_unlock();
+}
+
/**
* sd_read_block_characteristics - Query block dev. characteristics
* @sdkp: disk to query
@@ -3373,6 +3385,7 @@ static int sd_revalidate_disk(struct gendisk *disk)
if (scsi_device_supports_vpd(sdp)) {
sd_read_block_provisioning(sdkp);
sd_read_block_limits(sdkp);
+ sd_read_block_limits_ext(sdkp);
sd_read_block_characteristics(sdkp);
sd_zbc_read_zones(sdkp, buffer);
sd_read_cpr(sdkp);
diff --git a/drivers/scsi/sd.h b/drivers/scsi/sd.h
index 5eea762f84d1..84685168b6e0 100644
--- a/drivers/scsi/sd.h
+++ b/drivers/scsi/sd.h
@@ -150,6 +150,7 @@ struct scsi_disk {
unsigned urswrz : 1;
unsigned security : 1;
unsigned ignore_medium_access_errors : 1;
+ bool rscs : 1; /* reduced stream control support */
};
#define to_scsi_disk(obj) container_of(obj, struct scsi_disk, disk_dev)
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index b9230b6add04..2dd96ae101e1 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -153,6 +153,7 @@ struct scsi_device {
struct scsi_vpd __rcu *vpd_pgb0;
struct scsi_vpd __rcu *vpd_pgb1;
struct scsi_vpd __rcu *vpd_pgb2;
+ struct scsi_vpd __rcu *vpd_pgb7;
struct scsi_target *sdev_target;
next prev parent reply other threads:[~2023-10-17 20:48 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-17 20:47 [PATCH v3 00/14] Pass data temperature information to SCSI disk devices Bart Van Assche
2023-10-17 20:47 ` [PATCH v3 01/14] fs: Move enum rw_hint into a new header file Bart Van Assche
2023-10-30 11:11 ` Kanchan Joshi
2023-10-30 16:10 ` Bart Van Assche
[not found] ` <CGME20231017204823epcas5p2798d17757d381aaf7ad4dd235f3f0da3@epcms2p1>
2023-11-01 6:39 ` Daejun Park
2023-11-01 16:45 ` (2) " Bart Van Assche
[not found] ` <CGME20231017204823epcas5p2798d17757d381aaf7ad4dd235f3f0da3@epcms2p3>
2023-11-02 7:31 ` Daejun Park
2023-10-17 20:47 ` [PATCH v3 02/14] block: Restore data lifetime support in struct bio and struct request Bart Van Assche
2023-10-17 20:47 ` [PATCH v3 03/14] fs: Restore write hint support Bart Van Assche
2023-10-17 20:47 ` [PATCH v3 04/14] fs/f2fs: Restore data lifetime support Bart Van Assche
2023-10-17 20:47 ` Bart Van Assche [this message]
2023-10-17 20:47 ` [PATCH v3 06/14] scsi_proto: Add structures and constants related to I/O groups and streams Bart Van Assche
2023-10-17 20:47 ` [PATCH v3 07/14] sd: Translate data lifetime information Bart Van Assche
2023-10-17 20:47 ` [PATCH v3 08/14] scsi_debug: Reduce code duplication Bart Van Assche
2023-10-17 20:47 ` [PATCH v3 09/14] scsi_debug: Support the block limits extension VPD page Bart Van Assche
2023-10-17 20:47 ` [PATCH v3 10/14] scsi_debug: Rework page code error handling Bart Van Assche
2023-10-17 20:47 ` [PATCH v3 11/14] scsi_debug: Rework subpage " Bart Van Assche
2023-10-17 20:47 ` [PATCH v3 12/14] scsi_debug: Implement the IO Advice Hints Grouping mode page Bart Van Assche
2023-10-17 20:47 ` [PATCH v3 13/14] scsi_debug: Implement GET STREAM STATUS Bart Van Assche
2023-10-17 20:47 ` [PATCH v3 14/14] scsi_debug: Maintain write statistics per group number Bart Van Assche
2023-10-18 19:09 ` [PATCH v3 00/14] Pass data temperature information to SCSI disk devices Jens Axboe
2023-10-18 19:34 ` Bart Van Assche
2023-10-19 0:33 ` Damien Le Moal
2023-10-19 16:48 ` Bart Van Assche
2023-10-19 22:40 ` Damien Le Moal
2023-10-19 23:00 ` Damien Le Moal
2023-10-20 20:45 ` 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=20231017204739.3409052-6-bvanassche@acm.org \
--to=bvanassche@acm.org \
--cc=Avri.Altman@wdc.com \
--cc=Niklas.Cassel@wdc.com \
--cc=axboe@kernel.dk \
--cc=daejun7.park@samsung.com \
--cc=hch@lst.de \
--cc=huobean@gmail.com \
--cc=jejb@linux.ibm.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.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;
as well as URLs for NNTP newsgroup(s).