quota: Cleanup list iteration in dqcache_shrink_scan()
Jan Kara
reviewerPATCH 1/1 quota: Cleanup list iteration in dqcache_shrink_scan()
Use list_first_entry() and list_empty() instead of opencoded variants.
Signed-off-by Jan Kara <[email protected]>
--- fs/quota/dquot.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
I plan to add this patch to my tree. Review is welcome.
fs/quota/dquot.c +2 -5
@@ -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;
Signature · 1 line
2.13.7
Quoted 3 lines · Jan Kara
Use
list_first_entry()andlist_empty()instead of opencoded variants.Signed-off-by Jan Kara <[email protected]>
Reviewed-by Matthew Wilcox <[email protected]>
Jan Kara
reviewerQuoted 6 lines · Matthew Wilcox
Quoted 3 lines · Jan Kara
Use
list_first_entry()andlist_empty()instead of opencoded variants.Signed-off-by Jan Kara <[email protected]>Reviewed-by Matthew Wilcox <[email protected]>
Thanks for review!
Honza
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR