Re: [PATCH 1/5] btrfs: sysfs: introduce qgroup global attribute groups
From: David Sterba <hidden>
Date: 2021-09-03 14:04:03
On Fri, Sep 03, 2021 at 06:30:36AM +0800, Qu Wenruo wrote:
On 2021/9/3 上午12:28, David Sterba wrote:quoted
On Tue, Aug 31, 2021 at 05:48:59PM +0800, Qu Wenruo wrote:quoted
Although we already have info kobject for each qgroup, we don't have global qgroup info attributes to show things like qgroup flags. Add this qgroups attribute groups, and the first member is qgroup_flags, which is a read-only attribute to show human readable qgroup flags. The path is: /sys/fs/btrfs/<uuid>/qgroups/qgroup_flags The output would look like: ON | INCONSISTENTSo that's another format of sysfs file, we should try to keep them consistent or follow common practices. The recommended way for sysfs is to have one file per value, and here it follows the known states. So eg /sys/fs/.../qgroups/enabled -> 0 or 1 /sys/fs/.../qgroups/inconsistent -> 0 or 1 ... The files can be also writable so rescan can be triggered from sysfs, or quotas disabled eventually. For the start exporting the state would be sufficient though.OK, that sounds indeed better than the current solution. Although there may be a small window that one reading 3 attributes could get inconsistent view, as it's no longer atomic. Would that be a problem?
I hope not, the status can change after reading the sysfs files anyway.