Skip to content

Commit

Permalink
staging/lustre/libcfs: add CPU table functions for uniprocessor
Browse files Browse the repository at this point in the history
Some CPU table functions for uniprocessor architecture is
missing.

Signed-off-by: Li Xi <[email protected]>
Signed-off-by: James Simmons <[email protected]>
Reviewed-on: http://review.whamcloud.com/8873
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4199
Reviewed-by: Bob Glossman <[email protected]>
Reviewed-by: Dmitry Eremin <[email protected]>
Reviewed-by: Liang Zhen <[email protected]>
Reviewed-by: Oleg Drokin <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
LiXi-storage authored and gregkh committed Apr 27, 2014
1 parent 20c53d8 commit 5426ba6
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/staging/lustre/include/linux/libcfs/libcfs_cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,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
*/
Expand Down
5 changes: 5 additions & 0 deletions drivers/staging/lustre/include/linux/libcfs/linux/linux-mem.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@
#include <linux/memcontrol.h>
#include <linux/mm_inline.h>

#ifndef HAVE_LIBCFS_CPT
/* Need this for cfs_cpt_table */
#include <libcfs/libcfs_cpu.h>
#endif

#define CFS_PAGE_MASK (~((__u64)PAGE_CACHE_SIZE-1))
#define page_index(p) ((p)->index)

Expand Down
21 changes: 21 additions & 0 deletions drivers/staging/lustre/lustre/libcfs/libcfs_cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,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)
{
Expand Down Expand Up @@ -160,6 +174,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)
{
Expand Down

0 comments on commit 5426ba6

Please sign in to comment.