diff --git a/scst/README b/scst/README index 6a87e55ab..1a921c341 100644 --- a/scst/README +++ b/scst/README @@ -660,7 +660,7 @@ Thanks to: * Terry Greeniaus for fixes. - * Jianxi Chen for fixing problems with + * Jianxi Chen for fixing problem with devices >2TB in size Vladislav Bolkhovitin , http://scst.sourceforge.net diff --git a/scst/src/scst_mem.c b/scst/src/scst_mem.c index 8f2a64d0f..d22f3e4ce 100644 --- a/scst/src/scst_mem.c +++ b/scst/src/scst_mem.c @@ -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; +} diff --git a/scst/src/scst_mem.h b/scst/src/scst_mem.h index 9a07cd48d..f4efd484b 100644 --- a/scst/src/scst_mem.h +++ b/scst/src/scst_mem.h @@ -15,6 +15,7 @@ */ #include +#include #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); + diff --git a/scst/src/scst_proc.c b/scst/src/scst_proc.c index 78136f41d..6aa66f90f 100644 --- a/scst/src/scst_proc.c +++ b/scst/src/scst_proc.c @@ -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)