From 1817cb6dc6f7226757d19ef6ec9108e8c8b0808f Mon Sep 17 00:00:00 2001 From: Tim Chase Date: Thu, 18 Dec 2014 10:08:47 -0600 Subject: [PATCH] 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 Signed-off-by: Brian Behlendorf Closes #2975 --- module/zfs/zfs_vfsops.c | 8 ++++++-- module/zfs/zpl_super.c | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/module/zfs/zfs_vfsops.c b/module/zfs/zfs_vfsops.c index a27ac694d5..d6de195479 100644 --- a/module/zfs/zfs_vfsops.c +++ b/module/zfs/zfs_vfsops.c @@ -1073,7 +1073,7 @@ zfs_root(zfs_sb_t *zsb, struct inode **ipp) } EXPORT_SYMBOL(zfs_root); -#ifdef HAVE_SHRINK +#if defined(HAVE_SHRINK) || defined(HAVE_SPLIT_SHRINKER_CALLBACK) int zfs_sb_prune(struct super_block *sb, unsigned long nr_to_scan, int *objects) { @@ -1085,13 +1085,17 @@ zfs_sb_prune(struct super_block *sb, unsigned long nr_to_scan, int *objects) }; ZFS_ENTER(zsb); +#ifdef HAVE_SPLIT_SHRINKER_CALLBACK + *objects = (*shrinker->scan_objects)(shrinker, &sc); +#else *objects = (*shrinker->shrink)(shrinker, &sc); +#endif ZFS_EXIT(zsb); return (0); } EXPORT_SYMBOL(zfs_sb_prune); -#endif /* HAVE_SHRINK */ +#endif /* defined(HAVE_SHRINK) || defined(HAVE_SPLIT_SHRINKER_CALLBACK) */ /* * Teardown the zfs_sb_t. diff --git a/module/zfs/zpl_super.c b/module/zfs/zpl_super.c index 45639a6dd5..8b1c704b6c 100644 --- a/module/zfs/zpl_super.c +++ b/module/zfs/zpl_super.c @@ -268,7 +268,7 @@ zpl_kill_sb(struct super_block *sb) #endif /* HAVE_S_INSTANCES_LIST_HEAD */ } -#ifdef HAVE_SHRINK +#if defined(HAVE_SHRINK) || defined(HAVE_SPLIT_SHRINKER_CALLBACK) /* * Linux 3.1 - 3.x API *