dcache.c (5bdfdfeed5eed599a3ddc455f7c254a209ceae8d) dcache.c (1495f230fa7750479c79e3656286b9183d662077)
1/*
2 * fs/dcache.c
3 *
4 * Complete reimplementation
5 * (C) 1997 Thomas Schoebel-Theuer,
6 * with heavy changes by Linus Torvalds
7 */
8

--- 1206 unchanged lines hidden (view full) ---

1215 int found;
1216
1217 while ((found = select_parent(parent)) != 0)
1218 __shrink_dcache_sb(sb, &found, 0);
1219}
1220EXPORT_SYMBOL(shrink_dcache_parent);
1221
1222/*
1/*
2 * fs/dcache.c
3 *
4 * Complete reimplementation
5 * (C) 1997 Thomas Schoebel-Theuer,
6 * with heavy changes by Linus Torvalds
7 */
8

--- 1206 unchanged lines hidden (view full) ---

1215 int found;
1216
1217 while ((found = select_parent(parent)) != 0)
1218 __shrink_dcache_sb(sb, &found, 0);
1219}
1220EXPORT_SYMBOL(shrink_dcache_parent);
1221
1222/*
1223 * Scan `nr' dentries and return the number which remain.
1223 * Scan `sc->nr_slab_to_reclaim' dentries and return the number which remain.
1224 *
1225 * We need to avoid reentering the filesystem if the caller is performing a
1226 * GFP_NOFS allocation attempt. One example deadlock is:
1227 *
1228 * ext2_new_block->getblk->GFP->shrink_dcache_memory->prune_dcache->
1229 * prune_one_dentry->dput->dentry_iput->iput->inode->i_sb->s_op->put_inode->
1230 * ext2_discard_prealloc->ext2_free_blocks->lock_super->DEADLOCK.
1231 *
1232 * In this case we return -1 to tell the caller that we baled.
1233 */
1224 *
1225 * We need to avoid reentering the filesystem if the caller is performing a
1226 * GFP_NOFS allocation attempt. One example deadlock is:
1227 *
1228 * ext2_new_block->getblk->GFP->shrink_dcache_memory->prune_dcache->
1229 * prune_one_dentry->dput->dentry_iput->iput->inode->i_sb->s_op->put_inode->
1230 * ext2_discard_prealloc->ext2_free_blocks->lock_super->DEADLOCK.
1231 *
1232 * In this case we return -1 to tell the caller that we baled.
1233 */
1234static int shrink_dcache_memory(struct shrinker *shrink, int nr, gfp_t gfp_mask)
1234static int shrink_dcache_memory(struct shrinker *shrink,
1235 struct shrink_control *sc)
1235{
1236{
1237 int nr = sc->nr_to_scan;
1238 gfp_t gfp_mask = sc->gfp_mask;
1239
1236 if (nr) {
1237 if (!(gfp_mask & __GFP_FS))
1238 return -1;
1239 prune_dcache(nr);
1240 }
1241
1242 return (dentry_stat.nr_unused / 100) * sysctl_vfs_cache_pressure;
1243}

--- 1838 unchanged lines hidden ---
1240 if (nr) {
1241 if (!(gfp_mask & __GFP_FS))
1242 return -1;
1243 prune_dcache(nr);
1244 }
1245
1246 return (dentry_stat.nr_unused / 100) * sysctl_vfs_cache_pressure;
1247}

--- 1838 unchanged lines hidden ---