From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: Nikolay Borisov <nborisov@suse.com>, Qu Wenruo <wqu@suse.com>,
linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs: qgroups: Prepare to deprecate BTRFS_QGROUP_LIMIT_RSV_RFER/EXCL flags
Date: Tue, 13 Nov 2018 18:07:55 +0800 [thread overview]
Message-ID: <db7371db-a893-1ab7-8b97-359aa78da715@gmx.com> (raw)
In-Reply-To: <5123074e-c78d-5324-c6be-91a5a25d4426@suse.com>
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@suse.com>
>> ---
>> 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;
>>
prev parent reply other threads:[~2018-11-13 10:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-13 6:09 [PATCH] btrfs: qgroups: Prepare to deprecate BTRFS_QGROUP_LIMIT_RSV_RFER/EXCL flags Qu Wenruo
2018-11-13 9:48 ` Nikolay Borisov
2018-11-13 10:07 ` Qu Wenruo [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=db7371db-a893-1ab7-8b97-359aa78da715@gmx.com \
--to=quwenruo.btrfs@gmx.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=nborisov@suse.com \
--cc=wqu@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).