Thread (10 messages) 10 messages, 5 authors, 2021-10-27

Re: [PATCH] btrfs: sysfs: set / query btrfs stripe size

From: Stefan Roesch <hidden>
Date: 2021-10-27 07:19:28


On 10/27/21 12:09 AM, Johannes Thumshirn wrote:
On 27/10/2021 08:59, Stefan Roesch wrote:
[...]
quoted
quoted
quoted
static ssize_t btrfs_stripe_size_show(struct kobject *kobj,
				struct kobj_attribute *a, char *buf)

{
	struct btrfs_space_info *sinfo = to_space_info(kobj);
	struct btrfs_fs_info *fs_info = to_fs_info(get_btrfs_kobj(kobj));
	u64 max_stripe_size;

	spin_lock(&sinfo->lock);
	if (btrfs_is_zoned(fs_info))
		max_stripe_size = fs_info->zone_size;
	else
		max_stripe_size = sinfo->max_stripe_size;
	spin_unlock(&sinfo->lock);
This will not work once we have stripped zoned volume though, won't it ?
Why is not max_stripe_size set to zone size for a simple zoned btrfs volume ?
My intention was to not support zoned volumes with this patch. However I missed 
the correct check in the function btrfs_stripe_size_show. The intent was to return
-EINVAL for zoned volumes. 

Any thoughts?
Hi Stefan,

struct btrfs_fs_info *fs_info = to_fs_info(get_btrfs_kobj(kobj));

if (btrfs_is_zoned(fs_info))
	return -EINVAL;

But why not just set the correct values for a zoned dev and show them?
You can still not allow setting new values.
The code you proposed above is what I already have in my local commit.
I can change the code to initialize the stripe size to use the zone size
for zoned volumes. Then we don't need the above if clause. 

Damien mentioned that this should only be done for simple zoned btrfs volumes.
How do I find out if this is a simple zoned volume?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help