On 2018/11/13 下午5:48, Nikolay Borisov wrote:
>
>
> On 13.11.18 г. 8:09 ч., Qu Wenruo wrote:
>> These two flags are only used to set btrfs_qgroup::rsv_rfer/excl number,
>> but then are never used.
>>
>> Nor these flags are really used by btrfs-progs, so it's pretty safe just
>> to deprecate them in next kernel release.
>>
>> This patch will mark these two flags deprecated and output warning
>> messages, but still handle them.
>>
>> These two flags will be completely removed in next kernel release.
>>
>> Signed-off-by: Qu Wenruo <wqu@xxxxxxxx>
>> ---
>> fs/btrfs/qgroup.c | 16 ++++++++++------
>> include/uapi/linux/btrfs.h | 12 ++++++------
>> 2 files changed, 16 insertions(+), 12 deletions(-)
>>
>> diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
>> index 9afad8c14220..d4a52dbad044 100644
>> --- a/fs/btrfs/qgroup.c
>> +++ b/fs/btrfs/qgroup.c
>> @@ -1385,21 +1385,25 @@ int btrfs_limit_qgroup(struct btrfs_trans_handle *trans,
>> qgroup->max_excl = limit->max_excl;
>> }
>> }
>> - if (limit->flags & BTRFS_QGROUP_LIMIT_RSV_RFER) {
>> + if (limit->flags & __BTRFS_QGROUP_LIMIT_RSV_RFER) {
>> if (limit->rsv_rfer == CLEAR_VALUE) {
>> - qgroup->lim_flags &= ~BTRFS_QGROUP_LIMIT_RSV_RFER;
>> - limit->flags &= ~BTRFS_QGROUP_LIMIT_RSV_RFER;
>> + qgroup->lim_flags &= ~__BTRFS_QGROUP_LIMIT_RSV_RFER;
>> + limit->flags &= ~__BTRFS_QGROUP_LIMIT_RSV_RFER;
>> qgroup->rsv_rfer = 0;
>> } else {
>> + btrfs_warn_rl(fs_info,
>> +"BTRFS_QGROUP_LIMIT_RSV_RFER flag is deprecated, will not be supported in v5.1");
>> qgroup->rsv_rfer = limit->rsv_rfer;
>> }
>> }
>> - if (limit->flags & BTRFS_QGROUP_LIMIT_RSV_EXCL) {
>> + if (limit->flags & __BTRFS_QGROUP_LIMIT_RSV_EXCL) {
>> if (limit->rsv_excl == CLEAR_VALUE) {
>> - qgroup->lim_flags &= ~BTRFS_QGROUP_LIMIT_RSV_EXCL;
>> - limit->flags &= ~BTRFS_QGROUP_LIMIT_RSV_EXCL;
>> + qgroup->lim_flags &= ~__BTRFS_QGROUP_LIMIT_RSV_EXCL;
>> + limit->flags &= ~__BTRFS_QGROUP_LIMIT_RSV_EXCL;
>> qgroup->rsv_excl = 0;
>> } else {
>> + btrfs_warn_rl(fs_info,
>> +"BTRFS_QGROUP_LIMIT_RSV_EXCL flag is deprecated, will not be supported in v5.1");
>> qgroup->rsv_excl = limit->rsv_excl;
>> }
>> }
>> diff --git a/include/uapi/linux/btrfs.h b/include/uapi/linux/btrfs.h
>> index db4c253f8011..ec79ab781ee0 100644
>> --- a/include/uapi/linux/btrfs.h
>> +++ b/include/uapi/linux/btrfs.h
>> @@ -53,12 +53,12 @@ struct btrfs_ioctl_vol_args {
>> * struct btrfs_qgroup_limit.flags
>> * struct btrfs_qgroup_limit_item.flags
>> */
>> -#define BTRFS_QGROUP_LIMIT_MAX_RFER (1ULL << 0)
>> -#define BTRFS_QGROUP_LIMIT_MAX_EXCL (1ULL << 1)
>> -#define BTRFS_QGROUP_LIMIT_RSV_RFER (1ULL << 2)
>> -#define BTRFS_QGROUP_LIMIT_RSV_EXCL (1ULL << 3)
>> -#define BTRFS_QGROUP_LIMIT_RFER_CMPR (1ULL << 4)
>> -#define BTRFS_QGROUP_LIMIT_EXCL_CMPR (1ULL << 5)
>> +#define BTRFS_QGROUP_LIMIT_MAX_RFER (1ULL << 0) /* reference (rfer) limit */
>> +#define BTRFS_QGROUP_LIMIT_MAX_EXCL (1ULL << 1) /* exclusive (excl) limit */
>> +#define __BTRFS_QGROUP_LIMIT_RSV_RFER (1ULL << 2) /* deprecated */
>> +#define __BTRFS_QGROUP_LIMIT_RSV_EXCL (1ULL << 3) /* deprecated */
>
> We gain absolutely nothing by prepending the __, drop it. What's
> sufficient for this patch is to introduce only the warnings, nothing else.
IMHO, there are 2 problems if we don't rename it:
1) Later user can still use it without checking the header.
This is particularly common for anyone using completion tool, like
ctags or clang completion.
For these case, without checking the header careless user won't
really know these flags are deprecated.
2) To show that there are really no existing users of these 2 flags
It's much more clearly shown in the patch, than without modifying it.
3) To let us know whether there is any real user of these flags
After such renaming, if we really have some users of these flags,
they will mostly come and complain to the mail list.
Such noise would help us to know the usage (if there is any).
So, I still prefer to rename them.
This also applies to user space counter part.
Thanks,
Qu
>
>> +#define BTRFS_QGROUP_LIMIT_RFER_CMPR (1ULL << 4) /* compressed rfer limit */
>> +#define BTRFS_QGROUP_LIMIT_EXCL_CMPR (1ULL << 5) /* compressed excl limit */
>>
>> struct btrfs_qgroup_limit {
>> __u64 flags;
>>