@@ -380,6 +380,6 @@ static inline void lov_lsm2layout(struct lov_stripe_md *lsm,
}
}
-extern const struct rhashtable_params pools_hash_params;
-extern void lov_pool_putref(struct pool_desc *pool);
+struct pool_desc *lov_pool_find(struct obd_device *obd, char *poolname);
+void lov_pool_putref(struct pool_desc *pool);
#endif
@@ -1235,13 +1235,7 @@ static int lov_quotactl(struct obd_device *obd, struct obd_export *exp,
}
if (oqctl->qc_cmd == LUSTRE_Q_GETQUOTAPOOL) {
- rcu_read_lock();
- pool = rhashtable_lookup(&lov->lov_pools_hash_body,
- oqctl->qc_poolname,
- pools_hash_params);
- if (pool && !atomic_inc_not_zero(&pool->pool_refcount))
- pool = NULL;
- rcu_read_unlock();
+ pool = lov_pool_find(obd, oqctl->qc_poolname);
if (!pool)
return -ENOENT;
/* Set Q_GETOQUOTA back as targets report it's own
@@ -63,7 +63,7 @@ static int pool_cmpfn(struct rhashtable_compare_arg *arg, const void *obj)
return strcmp(pool_name, pool->pool_name);
}
-const struct rhashtable_params pools_hash_params = {
+static const struct rhashtable_params pools_hash_params = {
.key_len = 1, /* actually variable */
.key_offset = offsetof(struct pool_desc, pool_name),
.head_offset = offsetof(struct pool_desc, pool_hash),
@@ -317,6 +317,22 @@ int lov_pool_new(struct obd_device *obd, char *poolname)
return rc;
}
+struct pool_desc *lov_pool_find(struct obd_device *obd, char *poolname)
+{
+ struct pool_desc *pool;
+ struct lov_obd *lov = &obd->u.lov;
+
+ rcu_read_lock();
+ pool = rhashtable_lookup(&lov->lov_pools_hash_body,
+ poolname,
+ pools_hash_params);
+ if (pool && !atomic_inc_not_zero(&pool->pool_refcount))
+ pool = NULL;
+ rcu_read_unlock();
+
+ return pool;
+}
+
int lov_pool_del(struct obd_device *obd, char *poolname)
{
struct lov_obd *lov;