diff options
author | Jan Kara <jack@suse.cz> | 2018-06-11 12:14:45 +0200 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2018-06-20 11:04:26 +0200 |
commit | 1822193b5d4fd5d9800e6a7ed141375b8e8e68eb (patch) | |
tree | aa47e9c9c33903f9037a8ff24a547e95632414b2 /fs/quota/dquot.c | |
parent | 9560ba306df3e46b4b1037d101e2e4ca68610f55 (diff) | |
download | linux-1822193b5d4fd5d9800e6a7ed141375b8e8e68eb.tar.bz2 |
quota: Cleanup list iteration in dqcache_shrink_scan()
Use list_first_entry() and list_empty() instead of opencoded variants.
Reviewed-by: Matthew Wilcox <mawilcox@microsoft.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/quota/dquot.c')
-rw-r--r-- | fs/quota/dquot.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c index 241b00f835b9..fc20e06c56ba 100644 --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c @@ -711,21 +711,18 @@ EXPORT_SYMBOL(dquot_quota_sync); static unsigned long dqcache_shrink_scan(struct shrinker *shrink, struct shrink_control *sc) { - struct list_head *head; struct dquot *dquot; unsigned long freed = 0; spin_lock(&dq_list_lock); - head = free_dquots.next; - while (head != &free_dquots && sc->nr_to_scan) { - dquot = list_entry(head, struct dquot, dq_free); + while (!list_empty(&free_dquots) && sc->nr_to_scan) { + dquot = list_first_entry(&free_dquots, struct dquot, dq_free); remove_dquot_hash(dquot); remove_free_dquot(dquot); remove_inuse(dquot); do_destroy_dquot(dquot); sc->nr_to_scan--; freed++; - head = free_dquots.next; } spin_unlock(&dq_list_lock); return freed; |