From: Li Xi Date: Tue, 4 Feb 2014 13:41:49 +0000 (-0500) Subject: LU-4199 libcfs: add CPU table functions for uniprocessor X-Git-Tag: 2.5.58~48 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=68106aefc23551d7ac5d03d2f1144581a9d5cbf3;ds=sidebyside LU-4199 libcfs: add CPU table functions for uniprocessor Some CPU table functions for uniprocessor architecture is missing. Signed-off-by: Li Xi Signed-off-by: James Simmons Change-Id: I2b41af63ebb5e4a1362e026d75b87855c1e7e2fa Reviewed-on: http://review.whamcloud.com/8873 Tested-by: Jenkins Reviewed-by: Bob Glossman Reviewed-by: Dmitry Eremin Tested-by: Maloo Reviewed-by: Liang Zhen Reviewed-by: Oleg Drokin --- diff --git a/libcfs/include/libcfs/libcfs_cpu.h b/libcfs/include/libcfs/libcfs_cpu.h index ef15297..50aca83 100644 --- a/libcfs/include/libcfs/libcfs_cpu.h +++ b/libcfs/include/libcfs/libcfs_cpu.h @@ -77,8 +77,10 @@ #ifndef HAVE_LIBCFS_CPT +#ifndef __KERNEL__ typedef unsigned long cpumask_t; typedef unsigned long nodemask_t; +#endif struct cfs_cpt_table { /* # of CPU partitions */ @@ -195,6 +197,11 @@ void cfs_cpt_clear(struct cfs_cpt_table *cptab, int cpt); int cfs_cpt_spread_node(struct cfs_cpt_table *cptab, int cpt); /** + * return number of HTs in the same core of \a cpu + */ +int cfs_cpu_ht_nsiblings(int cpu); + +/** * iterate over all CPU partitions in \a cptab */ #define cfs_cpt_for_each(i, cptab) \ diff --git a/libcfs/include/libcfs/linux/linux-mem.h b/libcfs/include/libcfs/linux/linux-mem.h index c8861d0..6109645 100644 --- a/libcfs/include/libcfs/linux/linux-mem.h +++ b/libcfs/include/libcfs/linux/linux-mem.h @@ -57,6 +57,11 @@ # include #endif +#ifndef HAVE_LIBCFS_CPT +/* Need this for cfs_cpt_table */ +#include +#endif + #define CFS_PAGE_MASK (~((__u64)PAGE_CACHE_SIZE-1)) #define page_index(p) ((p)->index) diff --git a/libcfs/libcfs/libcfs_cpu.c b/libcfs/libcfs/libcfs_cpu.c index 87dec68..1fa5d65 100644 --- a/libcfs/libcfs/libcfs_cpu.c +++ b/libcfs/libcfs/libcfs_cpu.c @@ -76,6 +76,20 @@ cfs_cpt_table_free(struct cfs_cpt_table *cptab) EXPORT_SYMBOL(cfs_cpt_table_free); int +cfs_cpt_table_print(struct cfs_cpt_table *cptab, char *buf, int len) +{ + int rc = 0; + + rc = snprintf(buf, len, "%d\t: %d\n", 0, 0); + len -= rc; + if (len <= 0) + return -EFBIG; + + return rc; +} +EXPORT_SYMBOL(cfs_cpt_table_print); + +int cfs_cpt_number(struct cfs_cpt_table *cptab) { return 1; @@ -169,6 +183,13 @@ cfs_cpt_spread_node(struct cfs_cpt_table *cptab, int cpt) EXPORT_SYMBOL(cfs_cpt_spread_node); int +cfs_cpu_ht_nsiblings(int cpu) +{ + return 1; +} +EXPORT_SYMBOL(cfs_cpu_ht_nsiblings); + +int cfs_cpt_current(struct cfs_cpt_table *cptab, int remap) { return 0;