Skip to content

Commit

Permalink
quota: reclaim least recently used dquots
Browse files Browse the repository at this point in the history
The dquots in the free_dquots list are not reclaimed in LRU way.
put_dquot_last() puts entries to the tail and dqcache_shrink_scan()
frees from the tail. Free unreferenced dquots in LRU order because it
seems more reasonable than freeing most recently used.

Signed-off-by: Greg Thelen <[email protected]>
Signed-off-by: Shakeel Butt <[email protected]>
Signed-off-by: Jan Kara <[email protected]>
  • Loading branch information
gthelen authored and jankara committed Jun 20, 2018
1 parent 81e97f0 commit 9560ba3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fs/quota/dquot.c
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,7 @@ dqcache_shrink_scan(struct shrinker *shrink, struct shrink_control *sc)
unsigned long freed = 0;

spin_lock(&dq_list_lock);
head = free_dquots.prev;
head = free_dquots.next;
while (head != &free_dquots && sc->nr_to_scan) {
dquot = list_entry(head, struct dquot, dq_free);
remove_dquot_hash(dquot);
Expand All @@ -725,7 +725,7 @@ dqcache_shrink_scan(struct shrinker *shrink, struct shrink_control *sc)
do_destroy_dquot(dquot);
sc->nr_to_scan--;
freed++;
head = free_dquots.prev;
head = free_dquots.next;
}
spin_unlock(&dq_list_lock);
return freed;
Expand Down

0 comments on commit 9560ba3

Please sign in to comment.