Skip to content

Commit 34ed0e4

Browse files
kakrakreijack
andcommitted
btrfs: export dev_item.type in /sys/fs/btrfs/<uuid>/devinfo/<devid>/type
Co-authored-by: Goffredo Baroncelli <kreijack@inwind.it> Signed-off-by: Kai Krakow <kai@kaishome.de>
1 parent 9b28489 commit 34ed0e4

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

fs/btrfs/sysfs.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2140,6 +2140,18 @@ static ssize_t btrfs_devinfo_error_stats_show(struct kobject *kobj,
21402140
}
21412141
BTRFS_ATTR(devid, error_stats, btrfs_devinfo_error_stats_show);
21422142

2143+
#ifdef CONFIG_BTRFS_ALLOCATOR_HINTS
2144+
static ssize_t btrfs_devinfo_type_show(struct kobject *kobj,
2145+
struct kobj_attribute *a, char *buf)
2146+
{
2147+
struct btrfs_device *device = container_of(kobj, struct btrfs_device,
2148+
devid_kobj);
2149+
2150+
return scnprintf(buf, PAGE_SIZE, "0x%08llx\n", device->type);
2151+
}
2152+
BTRFS_ATTR(devid, type, btrfs_devinfo_type_show);
2153+
#endif
2154+
21432155
/*
21442156
* Information about one device.
21452157
*
@@ -2153,6 +2165,9 @@ static struct attribute *devid_attrs[] = {
21532165
BTRFS_ATTR_PTR(devid, replace_target),
21542166
BTRFS_ATTR_PTR(devid, scrub_speed_max),
21552167
BTRFS_ATTR_PTR(devid, writeable),
2168+
#ifdef CONFIG_BTRFS_ALLOCATOR_HINTS
2169+
BTRFS_ATTR_PTR(devid, type),
2170+
#endif
21562171
NULL
21572172
};
21582173
ATTRIBUTE_GROUPS(devid);

0 commit comments

Comments
 (0)