Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 207591
b: refs/heads/master
c: e566d48
h: refs/heads/master
i:
  207589: fc58d2b
  207587: c62710c
  207583: 42f1651
v: v3
  • Loading branch information
Andreas Gruenbacher authored and Al Viro committed Aug 9, 2010
1 parent 2c232b7 commit caebb83
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 18 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2aec7c523291621ebb68ba8e0bd9b52a26bb76ee
refs/heads/master: e566d48c9bd56f57e25e855a21e06ca2c2525795
27 changes: 10 additions & 17 deletions trunk/fs/mbcache.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,35 +176,28 @@ static int
mb_cache_shrink_fn(struct shrinker *shrink, int nr_to_scan, gfp_t gfp_mask)
{
LIST_HEAD(free_list);
struct list_head *l, *ltmp;
struct mb_cache *cache;
struct mb_cache_entry *entry, *tmp;
int count = 0;

spin_lock(&mb_cache_spinlock);
list_for_each(l, &mb_cache_list) {
struct mb_cache *cache =
list_entry(l, struct mb_cache, c_cache_list);
mb_debug("cache %s (%d)", cache->c_name,
atomic_read(&cache->c_entry_count));
count += atomic_read(&cache->c_entry_count);
}
mb_debug("trying to free %d entries", nr_to_scan);
if (nr_to_scan == 0) {
spin_unlock(&mb_cache_spinlock);
goto out;
}
spin_lock(&mb_cache_spinlock);
while (nr_to_scan-- && !list_empty(&mb_cache_lru_list)) {
struct mb_cache_entry *ce =
list_entry(mb_cache_lru_list.next,
struct mb_cache_entry, e_lru_list);
list_move_tail(&ce->e_lru_list, &free_list);
__mb_cache_entry_unhash(ce);
}
list_for_each_entry(cache, &mb_cache_list, c_cache_list) {
mb_debug("cache %s (%d)", cache->c_name,
atomic_read(&cache->c_entry_count));
count += atomic_read(&cache->c_entry_count);
}
spin_unlock(&mb_cache_spinlock);
list_for_each_safe(l, ltmp, &free_list) {
__mb_cache_entry_forget(list_entry(l, struct mb_cache_entry,
e_lru_list), gfp_mask);
list_for_each_entry_safe(entry, tmp, &free_list, e_lru_list) {
__mb_cache_entry_forget(entry, gfp_mask);
}
out:
return (count / 100) * sysctl_vfs_cache_pressure;
}

Expand Down

0 comments on commit caebb83

Please sign in to comment.