Re: [PATCH v4 3/4] btrfs: add force_chunk_alloc sysfs entry to force allocation
From: Stefan Roesch <hidden>
Date: 2021-11-09 01:14:58
On 11/5/21 3:04 AM, Nikolay Borisov wrote:
On 29.10.21 г. 21:39, Stefan Roesch wrote:quoted
This adds the force_chunk_alloc sysfs entry to be able to force a storage allocation. This is a debugging and test feature and is enabled with the CONFIG_BTRFS_DEBUG configuration option. It is stored at /sys/fs/btrfs/<uuid>/allocation/<block_type>/force_chunk_alloc. --- fs/btrfs/sysfs.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+)diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c index 3b0bcbc2ed2e..983c53b76aa6 100644 --- a/fs/btrfs/sysfs.c +++ b/fs/btrfs/sysfs.c@@ -771,6 +771,64 @@ static ssize_t btrfs_chunk_size_store(struct kobject *kobj, return val; } +#ifdef CONFIG_BTRFS_DEBUG +/* + * Return if space info force allocation chunk flag is set.nit: Well this is a dummy function which simply returns 0. I guess what makes sense is to simply make the show op a NULL, i wonder if sysfs can handle this gracefully though. <snip>
This is possible however I need to also change the file mask, so the user can only write to the file. I'll make the change.