- Patch from Krzysztof Blaszkowski: move SGV cache /proc support in the scst_mem.c

- Minor doc fix


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@191 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Vladislav Bolkhovitin
2007-09-25 09:11:08 +00:00
parent d2799ea8fa
commit 205bf6c973
4 changed files with 48 additions and 48 deletions

View File

@@ -660,7 +660,7 @@ Thanks to:
* Terry Greeniaus <tgreeniaus@yottayotta.com> for fixes.
* Jianxi Chen <pacers@users.sourceforge.net> for fixing problems with
* Jianxi Chen <pacers@users.sourceforge.net> for fixing problem with
devices >2TB in size
Vladislav Bolkhovitin <vst@vlnb.net>, http://scst.sourceforge.net

View File

@@ -62,10 +62,9 @@ similar functionality.
static int sgv_max_local_order, sgv_max_trans_order;
atomic_t sgv_other_total_alloc;
DEFINE_MUTEX(scst_sgv_pool_mutex);
LIST_HEAD(scst_sgv_pool_list);
static atomic_t sgv_other_total_alloc;
static DEFINE_MUTEX(scst_sgv_pool_mutex);
static LIST_HEAD(scst_sgv_pool_list);
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22))
static void sgv_dtor(void *data, struct kmem_cache *k, unsigned long f);
@@ -817,3 +816,43 @@ void scst_sgv_pools_deinit(struct scst_sgv_pools *pools)
TRACE_EXIT();
return;
}
static void scst_do_sgv_read(struct seq_file *seq, const struct sgv_pool *pool)
{
int i;
seq_printf(seq, "\n%-30s %-11d %-11d\n", pool->name,
atomic_read(&pool->acc.hit_alloc),
atomic_read(&pool->acc.total_alloc));
for (i = 0; i < SGV_POOL_ELEMENTS; i++) {
seq_printf(seq, " %-28s %-11d %-11d\n", pool->cache_names[i],
atomic_read(&pool->cache_acc[i].hit_alloc),
atomic_read(&pool->cache_acc[i].total_alloc));
}
seq_printf(seq, " %-28s %-11d %-11d\n", "big/other", atomic_read(&pool->big_alloc),
atomic_read(&pool->other_alloc));
return;
}
int sgv_pool_procinfo_show(struct seq_file *seq, void *v)
{
struct sgv_pool *pool;
TRACE_ENTRY();
seq_printf(seq, "%-30s %-11s %-11s", "Name", "Hit", "Total");
mutex_lock(&scst_sgv_pool_mutex);
list_for_each_entry(pool, &scst_sgv_pool_list, sgv_pool_list_entry) {
scst_do_sgv_read(seq, pool);
}
mutex_unlock(&scst_sgv_pool_mutex);
seq_printf(seq, "\n%-42s %-11d\n", "other", atomic_read(&sgv_other_total_alloc));
TRACE_EXIT();
return 0;
}

View File

@@ -15,6 +15,7 @@
*/
#include <asm/scatterlist.h>
#include <linux/seq_file.h>
#define SGV_POOL_ELEMENTS 11
@@ -85,9 +86,6 @@ struct scst_sgv_pools
#endif
};
extern atomic_t sgv_other_total_alloc;
extern struct mutex scst_sgv_pool_mutex;
extern struct list_head scst_sgv_pool_list;
int sgv_pool_init(struct sgv_pool *pool, const char *name,
int clustered);
@@ -100,3 +98,5 @@ static inline struct scatterlist *sgv_pool_sg(struct sgv_pool_obj *obj)
extern int scst_sgv_pools_init(struct scst_sgv_pools *pools);
extern void scst_sgv_pools_deinit(struct scst_sgv_pools *pools);
extern int sgv_pool_procinfo_show(struct seq_file *seq, void *v);

View File

@@ -1719,49 +1719,10 @@ static struct scst_proc_data scst_sessions_proc_data = {
.show = scst_sessions_info_show,
};
static void scst_do_sgv_read(struct seq_file *seq, const struct sgv_pool *pool)
{
int i;
seq_printf(seq, "\n%-30s %-11d %-11d\n", pool->name,
atomic_read(&pool->acc.hit_alloc),
atomic_read(&pool->acc.total_alloc));
for (i = 0; i < SGV_POOL_ELEMENTS; i++) {
seq_printf(seq, " %-28s %-11d %-11d\n", pool->cache_names[i],
atomic_read(&pool->cache_acc[i].hit_alloc),
atomic_read(&pool->cache_acc[i].total_alloc));
}
seq_printf(seq, " %-28s %-11d %-11d\n", "big/other", atomic_read(&pool->big_alloc),
atomic_read(&pool->other_alloc));
return;
}
static int scst_sgv_info_show(struct seq_file *seq, void *v)
{
struct sgv_pool *pool;
TRACE_ENTRY();
seq_printf(seq, "%-30s %-11s %-11s", "Name", "Hit", "Total");
mutex_lock(&scst_sgv_pool_mutex);
list_for_each_entry(pool, &scst_sgv_pool_list, sgv_pool_list_entry) {
scst_do_sgv_read(seq, pool);
}
mutex_unlock(&scst_sgv_pool_mutex);
seq_printf(seq, "\n%-42s %-11d\n", "other", atomic_read(&sgv_other_total_alloc));
TRACE_EXIT();
return 0;
}
static struct scst_proc_data scst_sgv_proc_data = {
SCST_DEF_RW_SEQ_OP(NULL)
.show = scst_sgv_info_show,
.show = sgv_pool_procinfo_show,
};
static int scst_groups_names_show(struct seq_file *seq, void *v)