From: Christoph Hellwig <hch@lst.de>
To: Jens Axboe <axboe@kernel.dk>
Cc: Lennart Poettering <mzxreary@0pointer.de>, linux-block@vger.kernel.org
Subject: [PATCH 2/2] block: add a partscan sysfs attribute for disks
Date: Thu, 2 May 2024 15:00:33 +0200 [thread overview]
Message-ID: <20240502130033.1958492-3-hch@lst.de> (raw)
In-Reply-To: <20240502130033.1958492-1-hch@lst.de>
This attribute reports if partition scanning is enabled for a given disk.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
Documentation/ABI/stable/sysfs-block | 10 ++++++++++
block/genhd.c | 8 ++++++++
2 files changed, 18 insertions(+)
diff --git a/Documentation/ABI/stable/sysfs-block b/Documentation/ABI/stable/sysfs-block
index 1fe9a553c37b71..f0025d1c3d5acd 100644
--- a/Documentation/ABI/stable/sysfs-block
+++ b/Documentation/ABI/stable/sysfs-block
@@ -101,6 +101,16 @@ Description:
devices that support receiving integrity metadata.
+What: /sys/block/<disk>/partscan
+Date: May 2024
+Contact: Christoph Hellwig <hch@lst.de>
+Description:
+ The /sys/block/<disk>/partscan files reports if partition
+ scanning is enabled for the disk. It returns "1" if partition
+ scanning is enabled, or "0" if not. The value type is a 32-bit
+ unsigned integer, but only "0" and "1" are valid values.
+
+
What: /sys/block/<disk>/<partition>/alignment_offset
Date: April 2009
Contact: Martin K. Petersen <martin.petersen@oracle.com>
diff --git a/block/genhd.c b/block/genhd.c
index 4b85963d09dbb4..dec2ee338fb44a 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -1044,6 +1044,12 @@ static ssize_t diskseq_show(struct device *dev,
return sprintf(buf, "%llu\n", disk->diskseq);
}
+static ssize_t partscan_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ return sprintf(buf, "%u\n", disk_has_partscan(dev_to_disk(dev)));
+}
+
static DEVICE_ATTR(range, 0444, disk_range_show, NULL);
static DEVICE_ATTR(ext_range, 0444, disk_ext_range_show, NULL);
static DEVICE_ATTR(removable, 0444, disk_removable_show, NULL);
@@ -1057,6 +1063,7 @@ static DEVICE_ATTR(stat, 0444, part_stat_show, NULL);
static DEVICE_ATTR(inflight, 0444, part_inflight_show, NULL);
static DEVICE_ATTR(badblocks, 0644, disk_badblocks_show, disk_badblocks_store);
static DEVICE_ATTR(diskseq, 0444, diskseq_show, NULL);
+static DEVICE_ATTR(partscan, 0444, partscan_show, NULL);
#ifdef CONFIG_FAIL_MAKE_REQUEST
ssize_t part_fail_show(struct device *dev,
@@ -1103,6 +1110,7 @@ static struct attribute *disk_attrs[] = {
&dev_attr_events_async.attr,
&dev_attr_events_poll_msecs.attr,
&dev_attr_diskseq.attr,
+ &dev_attr_partscan.attr,
#ifdef CONFIG_FAIL_MAKE_REQUEST
&dev_attr_fail.attr,
#endif
--
2.39.2
next prev parent reply other threads:[~2024-05-02 13:00 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-02 13:00 add a partscan sysfs attribute v2 Christoph Hellwig
2024-05-02 13:00 ` [PATCH 1/2] block: add a disk_has_partscan helper Christoph Hellwig
2024-05-02 13:00 ` Christoph Hellwig [this message]
2024-05-02 17:05 ` [PATCH 2/2] block: add a partscan sysfs attribute for disks Jens Axboe
2024-05-03 8:16 ` Christoph Hellwig
2024-05-03 9:12 ` Keith Busch
2024-05-03 14:59 ` Jens Axboe
2024-05-03 14:57 ` Jens Axboe
2024-05-03 15:01 ` add a partscan sysfs attribute v2 Jens Axboe
-- strict thread matches above, loose matches on Subject: below --
2024-04-29 17:48 add a partscan sysfs attribute Christoph Hellwig
2024-04-29 17:49 ` [PATCH 2/2] block: add a partscan sysfs attribute for disks Christoph Hellwig
2024-04-30 14:10 ` John Garry
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=20240502130033.1958492-3-hch@lst.de \
--to=hch@lst.de \
--cc=axboe@kernel.dk \
--cc=linux-block@vger.kernel.org \
--cc=mzxreary@0pointer.de \
/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