summaryrefslogtreecommitdiffstats
path: root/mm/zpool.c
diff options
context:
space:
mode:
authorDan Streetman <ddstreet@ieee.org>2015-06-25 18:00:40 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-06-25 20:00:37 -0400
commit479305fd7172503772575997eb6f1b0a2bb4a107 (patch)
tree134e5910aa691a12002a95b47c5ea2ee2b148123 /mm/zpool.c
parentcf41f5f496d68f2ced1fc77871c63d1c526fa100 (diff)
zpool: remove zpool_evict()
Remove zpool_evict() helper function. As zbud is currently the only zpool implementation that supports eviction, add zpool and zpool_ops references to struct zbud_pool and directly call zpool_ops->evict(zpool, handle) on eviction. Currently zpool provides the zpool_evict helper which locks the zpool list lock and searches through all pools to find the specific one matching the caller, and call the corresponding zpool_ops->evict function. However, this is unnecessary, as the zbud pool can simply keep a reference to the zpool that created it, as well as the zpool_ops, and directly call the zpool_ops->evict function, when it needs to evict a page. This avoids a spinlock and list search in zpool for each eviction. Signed-off-by: Dan Streetman <ddstreet@ieee.org> Cc: Seth Jennings <sjennings@variantweb.net> Cc: Minchan Kim <minchan@kernel.org> Cc: Nitin Gupta <ngupta@vflare.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/zpool.c')
-rw-r--r--mm/zpool.c29
1 files changed, 1 insertions, 28 deletions
diff --git a/mm/zpool.c b/mm/zpool.c
index 6b1f1035cd99..722a4f60e90b 100644
--- a/mm/zpool.c
+++ b/mm/zpool.c
@@ -73,33 +73,6 @@ int zpool_unregister_driver(struct zpool_driver *driver)
73} 73}
74EXPORT_SYMBOL(zpool_unregister_driver); 74EXPORT_SYMBOL(zpool_unregister_driver);
75 75
76/**
77 * zpool_evict() - evict callback from a zpool implementation.
78 * @pool: pool to evict from.
79 * @handle: handle to evict.
80 *
81 * This can be used by zpool implementations to call the
82 * user's evict zpool_ops struct evict callback.
83 */
84int zpool_evict(void *pool, unsigned long handle)
85{
86 struct zpool *zpool;
87
88 spin_lock(&pools_lock);
89 list_for_each_entry(zpool, &pools_head, list) {
90 if (zpool->pool == pool) {
91 spin_unlock(&pools_lock);
92 if (!zpool->ops || !zpool->ops->evict)
93 return -EINVAL;
94 return zpool->ops->evict(zpool, handle);
95 }
96 }
97 spin_unlock(&pools_lock);
98
99 return -ENOENT;
100}
101EXPORT_SYMBOL(zpool_evict);
102
103static struct zpool_driver *zpool_get_driver(char *type) 76static struct zpool_driver *zpool_get_driver(char *type)
104{ 77{
105 struct zpool_driver *driver; 78 struct zpool_driver *driver;
@@ -170,7 +143,7 @@ struct zpool *zpool_create_pool(char *type, char *name, gfp_t gfp,
170 143
171 zpool->type = driver->type; 144 zpool->type = driver->type;
172 zpool->driver = driver; 145 zpool->driver = driver;
173 zpool->pool = driver->create(name, gfp, ops); 146 zpool->pool = driver->create(name, gfp, ops, zpool);
174 zpool->ops = ops; 147 zpool->ops = ops;
175 148
176 if (!zpool->pool) { 149 if (!zpool->pool) {