* [PATCH] quota: Cleanup list iteration in dqcache_shrink_scan()
@ 2018-06-11 10:20 Jan Kara
2018-06-11 11:16 ` Matthew Wilcox
0 siblings, 1 reply; 3+ messages in thread
From: Jan Kara @ 2018-06-11 10:20 UTC (permalink / raw)
To: linux-fsdevel; +Cc: Jan Kara
Use list_first_entry() and list_empty() instead of opencoded variants.
Signed-off-by: Jan Kara <jack@suse.cz>
---
fs/quota/dquot.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
I plan to add this patch to my tree. Review is welcome.
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;
--
2.13.7
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] quota: Cleanup list iteration in dqcache_shrink_scan()
2018-06-11 10:20 [PATCH] quota: Cleanup list iteration in dqcache_shrink_scan() Jan Kara
@ 2018-06-11 11:16 ` Matthew Wilcox
2018-06-11 11:27 ` Jan Kara
0 siblings, 1 reply; 3+ messages in thread
From: Matthew Wilcox @ 2018-06-11 11:16 UTC (permalink / raw)
To: Jan Kara; +Cc: linux-fsdevel
On Mon, Jun 11, 2018 at 12:20:02PM +0200, Jan Kara wrote:
> Use list_first_entry() and list_empty() instead of opencoded variants.
>
> Signed-off-by: Jan Kara <jack@suse.cz>
Reviewed-by: Matthew Wilcox <mawilcox@microsoft.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] quota: Cleanup list iteration in dqcache_shrink_scan()
2018-06-11 11:16 ` Matthew Wilcox
@ 2018-06-11 11:27 ` Jan Kara
0 siblings, 0 replies; 3+ messages in thread
From: Jan Kara @ 2018-06-11 11:27 UTC (permalink / raw)
To: Matthew Wilcox; +Cc: Jan Kara, linux-fsdevel
On Mon 11-06-18 04:16:58, Matthew Wilcox wrote:
> On Mon, Jun 11, 2018 at 12:20:02PM +0200, Jan Kara wrote:
> > Use list_first_entry() and list_empty() instead of opencoded variants.
> >
> > Signed-off-by: Jan Kara <jack@suse.cz>
>
> Reviewed-by: Matthew Wilcox <mawilcox@microsoft.com>
Thanks for review!
Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-06-11 11:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-11 10:20 [PATCH] quota: Cleanup list iteration in dqcache_shrink_scan() Jan Kara
2018-06-11 11:16 ` Matthew Wilcox
2018-06-11 11:27 ` Jan Kara
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.