Linux EXT4 FS development
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Baokun Li <libaokun1@huawei.com>
Cc: jack@suse.cz, linux-fsdevel@vger.kernel.org,
	linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org,
	yi.zhang@huawei.com, yangerkun@huawei.com,
	chengzhihao1@huawei.com, yukuai3@huawei.com
Subject: Re: [PATCH v2 2/7] quota: add new global dquot list releasing_dquots
Date: Thu, 29 Jun 2023 12:29:52 +0200	[thread overview]
Message-ID: <20230629102952.ifn3qdoh632ybsb5@quack3> (raw)
In-Reply-To: <20230628132155.1560425-3-libaokun1@huawei.com>

On Wed 28-06-23 21:21:50, Baokun Li wrote:
> Add a new global dquot list that obeys the following rules:
> 
>  1). A dquot is added to this list when its last reference count is about
>      to be dropped.
>  2). The reference count of the dquot in the list is greater than or equal
>      to 1 ( due to possible race with dqget()).
>  3). When a dquot is removed from this list, a reference count is always
>      subtracted, and if the reference count is then 0, the dquot is added
>      to the free_dquots list.
> 
> This list is used to safely perform the final cleanup before releasing
> the last reference count, to avoid various contention issues caused by
> performing cleanup directly in dqput(), and to avoid the performance impact
> caused by calling synchronize_srcu(&dquot_srcu) directly in dqput(). Here
> it is just defining the list and implementing the corresponding operation
> function, which we will use later.
> 
> Suggested-by: Jan Kara <jack@suse.cz>
> Signed-off-by: Baokun Li <libaokun1@huawei.com>

I think you can merge this patch with patch 5. It is not like separating
this bit helps in review or anything...

> diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
> index 108ba9f1e420..a8b43b5b5623 100644
> --- a/fs/quota/dquot.c
> +++ b/fs/quota/dquot.c
> @@ -226,12 +226,21 @@ static void put_quota_format(struct quota_format_type *fmt)
>  /*
>   * Dquot List Management:
>   * The quota code uses four lists for dquot management: the inuse_list,
                          ^^^ five now :)

> - * free_dquots, dqi_dirty_list, and dquot_hash[] array. A single dquot
> - * structure may be on some of those lists, depending on its current state.
> + * releasing_dquots, free_dquots, dqi_dirty_list, and dquot_hash[] array.
> + * A single dquot structure may be on some of those lists, depending on
> + * its current state.
>   *
>   * All dquots are placed to the end of inuse_list when first created, and this
>   * list is used for invalidate operation, which must look at every dquot.
>   *
> + * When the last reference of a dquot will be dropped, the dquot will be
> + * added to releasing_dquots. We'd then queue work item which would call
> + * synchronize_srcu() and after that perform the final cleanup of all the
> + * dquots on the list. Both releasing_dquots and free_dquots use the
> + * dq_free list_head in the dquot struct. when a dquot is removed from
					     ^^^ Capital W please

> + * releasing_dquots, a reference count is always subtracted, and if
> + * dq_count == 0 at that point, the dquot will be added to the free_dquots.
> + *

								Honza
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

  reply	other threads:[~2023-06-29 10:30 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-28 13:21 [PATCH v2 0/7] quota: fix race condition between dqput() and dquot_mark_dquot_dirty() Baokun Li
2023-06-28 13:21 ` [PATCH v2 1/7] quota: factor out dquot_write_dquot() Baokun Li
2023-06-28 13:21 ` [PATCH v2 2/7] quota: add new global dquot list releasing_dquots Baokun Li
2023-06-29 10:29   ` Jan Kara [this message]
2023-06-29 11:10     ` Baokun Li
2023-06-28 13:21 ` [PATCH v2 3/7] quota: rename dquot_active() to inode_dquot_active() Baokun Li
2023-06-29 10:24   ` Jan Kara
2023-06-29 11:14     ` Baokun Li
2023-06-28 13:21 ` [PATCH v2 4/7] quota: add new helper dquot_active() Baokun Li
2023-06-28 13:21 ` [PATCH v2 5/7] quota: fix dqput() to follow the guarantees dquot_srcu should provide Baokun Li
2023-06-29 10:59   ` Jan Kara
2023-06-29 11:47     ` Baokun Li
2023-06-29 14:33       ` Jan Kara
2023-06-30  7:45         ` Baokun Li
2023-06-28 13:21 ` [PATCH v2 6/7] quota: simplify drop_dquot_ref() Baokun Li
2023-06-29 11:08   ` Jan Kara
2023-06-29 12:13     ` Baokun Li
2023-06-29 14:09       ` Jan Kara
2023-06-29 14:16         ` Baokun Li
2023-06-28 13:21 ` [PATCH v2 7/7] quota: remove unused function put_dquot_list() Baokun Li
2023-06-29 11:05   ` Jan Kara
2023-06-29 12:18     ` Baokun Li

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=20230629102952.ifn3qdoh632ybsb5@quack3 \
    --to=jack@suse.cz \
    --cc=chengzhihao1@huawei.com \
    --cc=libaokun1@huawei.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yangerkun@huawei.com \
    --cc=yi.zhang@huawei.com \
    --cc=yukuai3@huawei.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