2023-06-28 13:31:02

by Baokun Li

[permalink] [raw]
Subject: [PATCH v2 3/7] quota: rename dquot_active() to inode_dquot_active()

Now we have a helper function dquot_dirty() to determine if dquot has
DQ_MOD_B bit. dquot_active() can easily be misunderstood as a helper
function to determine if dquot has DQ_ACTIVE_B bit. So we avoid this by
adding the "inode_" prefix and later on we will add the helper function
dquot_active() to determine if dquot has DQ_ACTIVE_B bit.

Signed-off-by: Baokun Li <[email protected]>
---
fs/quota/dquot.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index a8b43b5b5623..b21f5e888482 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -1435,7 +1435,7 @@ static int info_bdq_free(struct dquot *dquot, qsize_t space)
return QUOTA_NL_NOWARN;
}

-static int dquot_active(const struct inode *inode)
+static int inode_dquot_active(const struct inode *inode)
{
struct super_block *sb = inode->i_sb;

@@ -1458,7 +1458,7 @@ static int __dquot_initialize(struct inode *inode, int type)
qsize_t rsv;
int ret = 0;

- if (!dquot_active(inode))
+ if (!inode_dquot_active(inode))
return 0;

dquots = i_dquot(inode);
@@ -1566,7 +1566,7 @@ bool dquot_initialize_needed(struct inode *inode)
struct dquot **dquots;
int i;

- if (!dquot_active(inode))
+ if (!inode_dquot_active(inode))
return false;

dquots = i_dquot(inode);
@@ -1677,7 +1677,7 @@ int __dquot_alloc_space(struct inode *inode, qsize_t number, int flags)
int reserve = flags & DQUOT_SPACE_RESERVE;
struct dquot **dquots;

- if (!dquot_active(inode)) {
+ if (!inode_dquot_active(inode)) {
if (reserve) {
spin_lock(&inode->i_lock);
*inode_reserved_space(inode) += number;
@@ -1747,7 +1747,7 @@ int dquot_alloc_inode(struct inode *inode)
struct dquot_warn warn[MAXQUOTAS];
struct dquot * const *dquots;

- if (!dquot_active(inode))
+ if (!inode_dquot_active(inode))
return 0;
for (cnt = 0; cnt < MAXQUOTAS; cnt++)
warn[cnt].w_type = QUOTA_NL_NOWARN;
@@ -1790,7 +1790,7 @@ int dquot_claim_space_nodirty(struct inode *inode, qsize_t number)
struct dquot **dquots;
int cnt, index;

- if (!dquot_active(inode)) {
+ if (!inode_dquot_active(inode)) {
spin_lock(&inode->i_lock);
*inode_reserved_space(inode) -= number;
__inode_add_bytes(inode, number);
@@ -1832,7 +1832,7 @@ void dquot_reclaim_space_nodirty(struct inode *inode, qsize_t number)
struct dquot **dquots;
int cnt, index;

- if (!dquot_active(inode)) {
+ if (!inode_dquot_active(inode)) {
spin_lock(&inode->i_lock);
*inode_reserved_space(inode) += number;
__inode_sub_bytes(inode, number);
@@ -1876,7 +1876,7 @@ void __dquot_free_space(struct inode *inode, qsize_t number, int flags)
struct dquot **dquots;
int reserve = flags & DQUOT_SPACE_RESERVE, index;

- if (!dquot_active(inode)) {
+ if (!inode_dquot_active(inode)) {
if (reserve) {
spin_lock(&inode->i_lock);
*inode_reserved_space(inode) -= number;
@@ -1931,7 +1931,7 @@ void dquot_free_inode(struct inode *inode)
struct dquot * const *dquots;
int index;

- if (!dquot_active(inode))
+ if (!inode_dquot_active(inode))
return;

dquots = i_dquot(inode);
@@ -2103,7 +2103,7 @@ int dquot_transfer(struct mnt_idmap *idmap, struct inode *inode,
struct super_block *sb = inode->i_sb;
int ret;

- if (!dquot_active(inode))
+ if (!inode_dquot_active(inode))
return 0;

if (i_uid_needs_update(idmap, iattr, inode)) {
--
2.31.1



2023-06-29 10:30:26

by Jan Kara

[permalink] [raw]
Subject: Re: [PATCH v2 3/7] quota: rename dquot_active() to inode_dquot_active()

On Wed 28-06-23 21:21:51, Baokun Li wrote:
> Now we have a helper function dquot_dirty() to determine if dquot has
> DQ_MOD_B bit. dquot_active() can easily be misunderstood as a helper
> function to determine if dquot has DQ_ACTIVE_B bit. So we avoid this by
> adding the "inode_" prefix and later on we will add the helper function
> dquot_active() to determine if dquot has DQ_ACTIVE_B bit.
>
> Signed-off-by: Baokun Li <[email protected]>

Maybe inode_quota_active() will be a better name what you are already
renaming it?

Honza

> ---
> fs/quota/dquot.c | 20 ++++++++++----------
> 1 file changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
> index a8b43b5b5623..b21f5e888482 100644
> --- a/fs/quota/dquot.c
> +++ b/fs/quota/dquot.c
> @@ -1435,7 +1435,7 @@ static int info_bdq_free(struct dquot *dquot, qsize_t space)
> return QUOTA_NL_NOWARN;
> }
>
> -static int dquot_active(const struct inode *inode)
> +static int inode_dquot_active(const struct inode *inode)
> {
> struct super_block *sb = inode->i_sb;
>
> @@ -1458,7 +1458,7 @@ static int __dquot_initialize(struct inode *inode, int type)
> qsize_t rsv;
> int ret = 0;
>
> - if (!dquot_active(inode))
> + if (!inode_dquot_active(inode))
> return 0;
>
> dquots = i_dquot(inode);
> @@ -1566,7 +1566,7 @@ bool dquot_initialize_needed(struct inode *inode)
> struct dquot **dquots;
> int i;
>
> - if (!dquot_active(inode))
> + if (!inode_dquot_active(inode))
> return false;
>
> dquots = i_dquot(inode);
> @@ -1677,7 +1677,7 @@ int __dquot_alloc_space(struct inode *inode, qsize_t number, int flags)
> int reserve = flags & DQUOT_SPACE_RESERVE;
> struct dquot **dquots;
>
> - if (!dquot_active(inode)) {
> + if (!inode_dquot_active(inode)) {
> if (reserve) {
> spin_lock(&inode->i_lock);
> *inode_reserved_space(inode) += number;
> @@ -1747,7 +1747,7 @@ int dquot_alloc_inode(struct inode *inode)
> struct dquot_warn warn[MAXQUOTAS];
> struct dquot * const *dquots;
>
> - if (!dquot_active(inode))
> + if (!inode_dquot_active(inode))
> return 0;
> for (cnt = 0; cnt < MAXQUOTAS; cnt++)
> warn[cnt].w_type = QUOTA_NL_NOWARN;
> @@ -1790,7 +1790,7 @@ int dquot_claim_space_nodirty(struct inode *inode, qsize_t number)
> struct dquot **dquots;
> int cnt, index;
>
> - if (!dquot_active(inode)) {
> + if (!inode_dquot_active(inode)) {
> spin_lock(&inode->i_lock);
> *inode_reserved_space(inode) -= number;
> __inode_add_bytes(inode, number);
> @@ -1832,7 +1832,7 @@ void dquot_reclaim_space_nodirty(struct inode *inode, qsize_t number)
> struct dquot **dquots;
> int cnt, index;
>
> - if (!dquot_active(inode)) {
> + if (!inode_dquot_active(inode)) {
> spin_lock(&inode->i_lock);
> *inode_reserved_space(inode) += number;
> __inode_sub_bytes(inode, number);
> @@ -1876,7 +1876,7 @@ void __dquot_free_space(struct inode *inode, qsize_t number, int flags)
> struct dquot **dquots;
> int reserve = flags & DQUOT_SPACE_RESERVE, index;
>
> - if (!dquot_active(inode)) {
> + if (!inode_dquot_active(inode)) {
> if (reserve) {
> spin_lock(&inode->i_lock);
> *inode_reserved_space(inode) -= number;
> @@ -1931,7 +1931,7 @@ void dquot_free_inode(struct inode *inode)
> struct dquot * const *dquots;
> int index;
>
> - if (!dquot_active(inode))
> + if (!inode_dquot_active(inode))
> return;
>
> dquots = i_dquot(inode);
> @@ -2103,7 +2103,7 @@ int dquot_transfer(struct mnt_idmap *idmap, struct inode *inode,
> struct super_block *sb = inode->i_sb;
> int ret;
>
> - if (!dquot_active(inode))
> + if (!inode_dquot_active(inode))
> return 0;
>
> if (i_uid_needs_update(idmap, iattr, inode)) {
> --
> 2.31.1
>
--
Jan Kara <[email protected]>
SUSE Labs, CR

2023-06-29 11:32:57

by Baokun Li

[permalink] [raw]
Subject: Re: [PATCH v2 3/7] quota: rename dquot_active() to inode_dquot_active()

On 2023/6/29 18:24, Jan Kara wrote:
> On Wed 28-06-23 21:21:51, Baokun Li wrote:
>> Now we have a helper function dquot_dirty() to determine if dquot has
>> DQ_MOD_B bit. dquot_active() can easily be misunderstood as a helper
>> function to determine if dquot has DQ_ACTIVE_B bit. So we avoid this by
>> adding the "inode_" prefix and later on we will add the helper function
>> dquot_active() to determine if dquot has DQ_ACTIVE_B bit.
>>
>> Signed-off-by: Baokun Li <[email protected]>
> Maybe inode_quota_active() will be a better name what you are already
> renaming it?
>
> Honza
Indeed! I will rename it to inode_quota_active() in the next version.
>
>> ---
>> fs/quota/dquot.c | 20 ++++++++++----------
>> 1 file changed, 10 insertions(+), 10 deletions(-)
>>
>> diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
>> index a8b43b5b5623..b21f5e888482 100644
>> --- a/fs/quota/dquot.c
>> +++ b/fs/quota/dquot.c
>> @@ -1435,7 +1435,7 @@ static int info_bdq_free(struct dquot *dquot, qsize_t space)
>> return QUOTA_NL_NOWARN;
>> }
>>
>> -static int dquot_active(const struct inode *inode)
>> +static int inode_dquot_active(const struct inode *inode)
>> {
>> struct super_block *sb = inode->i_sb;
>>
>> @@ -1458,7 +1458,7 @@ static int __dquot_initialize(struct inode *inode, int type)
>> qsize_t rsv;
>> int ret = 0;
>>
>> - if (!dquot_active(inode))
>> + if (!inode_dquot_active(inode))
>> return 0;
>>
>> dquots = i_dquot(inode);
>> @@ -1566,7 +1566,7 @@ bool dquot_initialize_needed(struct inode *inode)
>> struct dquot **dquots;
>> int i;
>>
>> - if (!dquot_active(inode))
>> + if (!inode_dquot_active(inode))
>> return false;
>>
>> dquots = i_dquot(inode);
>> @@ -1677,7 +1677,7 @@ int __dquot_alloc_space(struct inode *inode, qsize_t number, int flags)
>> int reserve = flags & DQUOT_SPACE_RESERVE;
>> struct dquot **dquots;
>>
>> - if (!dquot_active(inode)) {
>> + if (!inode_dquot_active(inode)) {
>> if (reserve) {
>> spin_lock(&inode->i_lock);
>> *inode_reserved_space(inode) += number;
>> @@ -1747,7 +1747,7 @@ int dquot_alloc_inode(struct inode *inode)
>> struct dquot_warn warn[MAXQUOTAS];
>> struct dquot * const *dquots;
>>
>> - if (!dquot_active(inode))
>> + if (!inode_dquot_active(inode))
>> return 0;
>> for (cnt = 0; cnt < MAXQUOTAS; cnt++)
>> warn[cnt].w_type = QUOTA_NL_NOWARN;
>> @@ -1790,7 +1790,7 @@ int dquot_claim_space_nodirty(struct inode *inode, qsize_t number)
>> struct dquot **dquots;
>> int cnt, index;
>>
>> - if (!dquot_active(inode)) {
>> + if (!inode_dquot_active(inode)) {
>> spin_lock(&inode->i_lock);
>> *inode_reserved_space(inode) -= number;
>> __inode_add_bytes(inode, number);
>> @@ -1832,7 +1832,7 @@ void dquot_reclaim_space_nodirty(struct inode *inode, qsize_t number)
>> struct dquot **dquots;
>> int cnt, index;
>>
>> - if (!dquot_active(inode)) {
>> + if (!inode_dquot_active(inode)) {
>> spin_lock(&inode->i_lock);
>> *inode_reserved_space(inode) += number;
>> __inode_sub_bytes(inode, number);
>> @@ -1876,7 +1876,7 @@ void __dquot_free_space(struct inode *inode, qsize_t number, int flags)
>> struct dquot **dquots;
>> int reserve = flags & DQUOT_SPACE_RESERVE, index;
>>
>> - if (!dquot_active(inode)) {
>> + if (!inode_dquot_active(inode)) {
>> if (reserve) {
>> spin_lock(&inode->i_lock);
>> *inode_reserved_space(inode) -= number;
>> @@ -1931,7 +1931,7 @@ void dquot_free_inode(struct inode *inode)
>> struct dquot * const *dquots;
>> int index;
>>
>> - if (!dquot_active(inode))
>> + if (!inode_dquot_active(inode))
>> return;
>>
>> dquots = i_dquot(inode);
>> @@ -2103,7 +2103,7 @@ int dquot_transfer(struct mnt_idmap *idmap, struct inode *inode,
>> struct super_block *sb = inode->i_sb;
>> int ret;
>>
>> - if (!dquot_active(inode))
>> + if (!inode_dquot_active(inode))
>> return 0;
>>
>> if (i_uid_needs_update(idmap, iattr, inode)) {
>> --
>> 2.31.1
>>

Thanks!
--
With Best Regards,
Baokun Li
.