Whamcloud - gitweb
LU-9859 libcfs: rename CFS_TCD_TYPE_MAX to CFS_TCD_TYPE_CNT 76/39276/2
authorMr NeilBrown <neilb@suse.de>
Tue, 30 Jun 2020 14:37:14 +0000 (08:37 -0600)
committerOleg Drokin <green@whamcloud.com>
Thu, 13 Aug 2020 06:03:55 +0000 (06:03 +0000)
The possible TCD types are 0, 1, 2.
So the MAX is 2.
The count of the number of types is 3.

CFS_TCD_TYPE_MAX is 3 - obviously wrong.

So rename it to CFS_TCD_TYPE_CNT.

Also there are 2 places where "3" is used rather
than the macro - fix them.

Test-Parameters: trivial
Signed-off-by: Mr NeilBrown <neilb@suse.de>
Change-Id: Ia4ce5fdb3225494f93d1eebd9fddfc15eb2b8316
Reviewed-on: https://review.whamcloud.com/39276
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Yang Sheng <ys@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
libcfs/libcfs/tracefile.c

index 8cca867..f026ec1 100644 (file)
@@ -55,12 +55,12 @@ enum cfs_trace_buf_type {
        CFS_TCD_TYPE_PROC = 0,
        CFS_TCD_TYPE_SOFTIRQ,
        CFS_TCD_TYPE_IRQ,
        CFS_TCD_TYPE_PROC = 0,
        CFS_TCD_TYPE_SOFTIRQ,
        CFS_TCD_TYPE_IRQ,
-       CFS_TCD_TYPE_MAX
+       CFS_TCD_TYPE_CNT
 };
 
 union cfs_trace_data_union (*cfs_trace_data[TCD_MAX_TYPES])[NR_CPUS] __cacheline_aligned;
 
 };
 
 union cfs_trace_data_union (*cfs_trace_data[TCD_MAX_TYPES])[NR_CPUS] __cacheline_aligned;
 
-char *cfs_trace_console_buffers[NR_CPUS][CFS_TCD_TYPE_MAX];
+char *cfs_trace_console_buffers[NR_CPUS][CFS_TCD_TYPE_CNT];
 char cfs_tracefile[TRACEFILE_NAME_SIZE];
 long long cfs_tracefile_size = CFS_TRACEFILE_SIZE;
 static struct tracefiled_ctl trace_tctl;
 char cfs_tracefile[TRACEFILE_NAME_SIZE];
 long long cfs_tracefile_size = CFS_TRACEFILE_SIZE;
 static struct tracefiled_ctl trace_tctl;
@@ -82,7 +82,7 @@ static void put_pages_on_tcd_daemon_list(struct page_collection *pc,
 int cfs_trace_lock_tcd(struct cfs_trace_cpu_data *tcd, int walking)
        __acquires(&tcd->tcd_lock)
 {
 int cfs_trace_lock_tcd(struct cfs_trace_cpu_data *tcd, int walking)
        __acquires(&tcd->tcd_lock)
 {
-       __LASSERT(tcd->tcd_type < CFS_TCD_TYPE_MAX);
+       __LASSERT(tcd->tcd_type < CFS_TCD_TYPE_CNT);
        if (tcd->tcd_type == CFS_TCD_TYPE_IRQ)
                spin_lock_irqsave(&tcd->tcd_lock, tcd->tcd_lock_flags);
        else if (tcd->tcd_type == CFS_TCD_TYPE_SOFTIRQ)
        if (tcd->tcd_type == CFS_TCD_TYPE_IRQ)
                spin_lock_irqsave(&tcd->tcd_lock, tcd->tcd_lock_flags);
        else if (tcd->tcd_type == CFS_TCD_TYPE_SOFTIRQ)
@@ -97,7 +97,7 @@ int cfs_trace_lock_tcd(struct cfs_trace_cpu_data *tcd, int walking)
 void cfs_trace_unlock_tcd(struct cfs_trace_cpu_data *tcd, int walking)
        __releases(&tcd->tcd_lock)
 {
 void cfs_trace_unlock_tcd(struct cfs_trace_cpu_data *tcd, int walking)
        __releases(&tcd->tcd_lock)
 {
-       __LASSERT(tcd->tcd_type < CFS_TCD_TYPE_MAX);
+       __LASSERT(tcd->tcd_type < CFS_TCD_TYPE_CNT);
        if (tcd->tcd_type == CFS_TCD_TYPE_IRQ)
                spin_unlock_irqrestore(&tcd->tcd_lock, tcd->tcd_lock_flags);
        else if (tcd->tcd_type == CFS_TCD_TYPE_SOFTIRQ)
        if (tcd->tcd_type == CFS_TCD_TYPE_IRQ)
                spin_unlock_irqrestore(&tcd->tcd_lock, tcd->tcd_lock_flags);
        else if (tcd->tcd_type == CFS_TCD_TYPE_SOFTIRQ)
@@ -1216,7 +1216,7 @@ void cfs_trace_stop_thread(void)
 }
 
 /* percents to share the total debug memory for each type */
 }
 
 /* percents to share the total debug memory for each type */
-static unsigned int pages_factor[CFS_TCD_TYPE_MAX] = {
+static unsigned int pages_factor[CFS_TCD_TYPE_CNT] = {
        80, /* 80% pages for CFS_TCD_TYPE_PROC */
        10, /* 10% pages for CFS_TCD_TYPE_SOFTIRQ */
        10  /* 10% pages for CFS_TCD_TYPE_IRQ */
        80, /* 80% pages for CFS_TCD_TYPE_PROC */
        10, /* 10% pages for CFS_TCD_TYPE_SOFTIRQ */
        10  /* 10% pages for CFS_TCD_TYPE_IRQ */
@@ -1230,7 +1230,7 @@ int cfs_tracefile_init(int max_pages)
 
        /* initialize trace_data */
        memset(cfs_trace_data, 0, sizeof(cfs_trace_data));
 
        /* initialize trace_data */
        memset(cfs_trace_data, 0, sizeof(cfs_trace_data));
-       for (i = 0; i < CFS_TCD_TYPE_MAX; i++) {
+       for (i = 0; i < CFS_TCD_TYPE_CNT; i++) {
                cfs_trace_data[i] =
                        kmalloc_array(num_possible_cpus(),
                                      sizeof(union cfs_trace_data_union),
                cfs_trace_data[i] =
                        kmalloc_array(num_possible_cpus(),
                                      sizeof(union cfs_trace_data_union),