mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2025-04-06 17:49:11 +03:00
Linux 3.12 compat: split shrinker has s_shrink
The split count/scan shrinker callbacks introduced in 3.12 broke the test for HAVE_SHRINK, effectively disabling the per-superblock shrinkers. This patch re-enables the per-superblock shrinkers when the split shrinker callbacks have been detected. Signed-off-by: Tim Chase <tim@chase2k.com> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #2975
This commit is contained in:
parent
6e9710f7c3
commit
3c832b8cc1
@ -1068,7 +1068,7 @@ zfs_root(zfs_sb_t *zsb, struct inode **ipp)
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL(zfs_root);
|
EXPORT_SYMBOL(zfs_root);
|
||||||
|
|
||||||
#ifdef HAVE_SHRINK
|
#if defined(HAVE_SHRINK) || defined(HAVE_SPLIT_SHRINKER_CALLBACK)
|
||||||
int
|
int
|
||||||
zfs_sb_prune(struct super_block *sb, unsigned long nr_to_scan, int *objects)
|
zfs_sb_prune(struct super_block *sb, unsigned long nr_to_scan, int *objects)
|
||||||
{
|
{
|
||||||
@ -1080,13 +1080,17 @@ zfs_sb_prune(struct super_block *sb, unsigned long nr_to_scan, int *objects)
|
|||||||
};
|
};
|
||||||
|
|
||||||
ZFS_ENTER(zsb);
|
ZFS_ENTER(zsb);
|
||||||
|
#ifdef HAVE_SPLIT_SHRINKER_CALLBACK
|
||||||
|
*objects = (*shrinker->scan_objects)(shrinker, &sc);
|
||||||
|
#else
|
||||||
*objects = (*shrinker->shrink)(shrinker, &sc);
|
*objects = (*shrinker->shrink)(shrinker, &sc);
|
||||||
|
#endif
|
||||||
ZFS_EXIT(zsb);
|
ZFS_EXIT(zsb);
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(zfs_sb_prune);
|
EXPORT_SYMBOL(zfs_sb_prune);
|
||||||
#endif /* HAVE_SHRINK */
|
#endif /* defined(HAVE_SHRINK) || defined(HAVE_SPLIT_SHRINKER_CALLBACK) */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Teardown the zfs_sb_t.
|
* Teardown the zfs_sb_t.
|
||||||
|
@ -268,7 +268,7 @@ zpl_kill_sb(struct super_block *sb)
|
|||||||
#endif /* HAVE_S_INSTANCES_LIST_HEAD */
|
#endif /* HAVE_S_INSTANCES_LIST_HEAD */
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_SHRINK
|
#if defined(HAVE_SHRINK) || defined(HAVE_SPLIT_SHRINKER_CALLBACK)
|
||||||
/*
|
/*
|
||||||
* Linux 3.1 - 3.x API
|
* Linux 3.1 - 3.x API
|
||||||
*
|
*
|
||||||
@ -288,17 +288,17 @@ zpl_prune_sb(struct super_block *sb, void *arg)
|
|||||||
error = -zfs_sb_prune(sb, *(unsigned long *)arg, &objects);
|
error = -zfs_sb_prune(sb, *(unsigned long *)arg, &objects);
|
||||||
ASSERT3S(error, <=, 0);
|
ASSERT3S(error, <=, 0);
|
||||||
}
|
}
|
||||||
#endif /* HAVE_SHRINK */
|
#endif /* defined(HAVE_SHRINK) || defined(HAVE_SPLIT_SHRINKER_CALLBACK) */
|
||||||
|
|
||||||
void
|
void
|
||||||
zpl_prune_sbs(int64_t bytes_to_scan, void *private)
|
zpl_prune_sbs(int64_t bytes_to_scan, void *private)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_SHRINK
|
#if defined(HAVE_SHRINK) || defined(HAVE_SPLIT_SHRINKER_CALLBACK)
|
||||||
unsigned long nr_to_scan = (bytes_to_scan / sizeof (znode_t));
|
unsigned long nr_to_scan = (bytes_to_scan / sizeof (znode_t));
|
||||||
|
|
||||||
iterate_supers_type(&zpl_fs_type, zpl_prune_sb, &nr_to_scan);
|
iterate_supers_type(&zpl_fs_type, zpl_prune_sb, &nr_to_scan);
|
||||||
kmem_reap();
|
kmem_reap();
|
||||||
#endif /* HAVE_SHRINK */
|
#endif /* defined(HAVE_SHRINK) || defined(HAVE_SPLIT_SHRINKER_CALLBACK) */
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_NR_CACHED_OBJECTS
|
#ifdef HAVE_NR_CACHED_OBJECTS
|
||||||
|
Loading…
Reference in New Issue
Block a user