quota: simplify drop_dquot_ref()
authorBaokun Li <libaokun1@huawei.com>
Fri, 30 Jun 2023 11:08:22 +0000 (19:08 +0800)
committerJan Kara <jack@suse.cz>
Mon, 3 Jul 2023 17:00:19 +0000 (19:00 +0200)
commit7bce48f0fec602b3b6c335963b26d9eefa417788
treed92a3e7c9e3c67d6d6b4b2b42edc1eadb19154d7
parentdabc8b20756601b9e1cc85a81d47d3f98ed4d13a
quota: simplify drop_dquot_ref()

As Honza said, remove_inode_dquot_ref() currently does not release the
last dquot reference but instead adds the dquot to tofree_head list. This
is because dqput() can sleep while dropping of the last dquot reference
(writing back the dquot and calling ->release_dquot()) and that must not
happen under dq_list_lock. Now that dqput() queues the final dquot cleanup
into a workqueue, remove_inode_dquot_ref() can call dqput() unconditionally
and we can significantly simplify it.

Here we open code the simplified code of remove_inode_dquot_ref() into
remove_dquot_ref() and remove the function put_dquot_list() which is no
longer used.

Signed-off-by: Baokun Li <libaokun1@huawei.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Message-Id: <20230630110822.3881712-6-libaokun1@huawei.com>
fs/quota/dquot.c