Whamcloud - gitweb
LU-7988 hsm: remove hsd.request_sz from struct hsm_scan_data 78/19578/14
authorFrank Zago <fzago@cray.com>
Thu, 7 Apr 2016 16:57:33 +0000 (12:57 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 1 Aug 2016 02:10:25 +0000 (02:10 +0000)
request_sz is only used in one function, so it doesn't need to be part
of the structure. Instead make it local to mdt_coordinator().

Test-Parameters: trivial testlist=sanity-hsm
Signed-off-by: frank zago <fzago@cray.com>
Change-Id: If58546b9e23281097ed414f863e91b1e6a54c8fb
Reviewed-on: http://review.whamcloud.com/19578
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Vinayak <vinayakswami.hariharmath@seagate.com>
Reviewed-by: Patrick Farrell <paf@cray.com>
Reviewed-by: Ben Evans <bevans@cray.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/mdt/mdt_coordinator.c

index 9669fec..1727a0c 100644 (file)
@@ -134,7 +134,6 @@ struct hsm_scan_data {
        struct mdt_thread_info          *mti;
        char                             fs_name[MTI_NAME_MAXLEN+1];
        /* request to be send to agents */
-       int                              request_sz;    /** allocated size */
        int                              max_requests;  /** vector size */
        int                              request_cnt;   /** used count */
        struct {
@@ -429,6 +428,7 @@ static int mdt_coordinator(void *data)
        struct coordinator      *cdt = &mdt->mdt_coordinator;
        struct hsm_scan_data     hsd = { NULL };
        int                      rc = 0;
+       int                      request_sz;
        ENTRY;
 
        cdt->cdt_thread.t_flags = SVC_RUNNING;
@@ -442,8 +442,8 @@ static int mdt_coordinator(void *data)
         * hsd.request[] vector
         */
        hsd.max_requests = cdt->cdt_max_requests;
-       hsd.request_sz = hsd.max_requests * sizeof(*hsd.request);
-       OBD_ALLOC(hsd.request, hsd.request_sz);
+       request_sz = hsd.max_requests * sizeof(*hsd.request);
+       OBD_ALLOC(hsd.request, request_sz);
        if (!hsd.request)
                GOTO(out, rc = -ENOMEM);
 
@@ -486,11 +486,10 @@ static int mdt_coordinator(void *data)
                        /* cdt_max_requests has changed,
                         * we need to allocate a new buffer
                         */
-                       OBD_FREE(hsd.request, hsd.request_sz);
+                       OBD_FREE(hsd.request, request_sz);
                        hsd.max_requests = cdt->cdt_max_requests;
-                       hsd.request_sz =
-                                  hsd.max_requests * sizeof(*hsd.request);
-                       OBD_ALLOC(hsd.request, hsd.request_sz);
+                       request_sz = hsd.max_requests * sizeof(*hsd.request);
+                       OBD_ALLOC(hsd.request, request_sz);
                        if (!hsd.request) {
                                rc = -ENOMEM;
                                break;
@@ -580,12 +579,12 @@ clean_cb_alloc:
                LASSERT(hsd.request_cnt == 0);
 
                /* reset callback data */
-               memset(hsd.request, 0, hsd.request_sz);
+               memset(hsd.request, 0, request_sz);
        }
        EXIT;
 out:
        if (hsd.request)
-               OBD_FREE(hsd.request, hsd.request_sz);
+               OBD_FREE(hsd.request, request_sz);
 
        if (cdt->cdt_state == CDT_STOPPING) {
                /* request comes from /proc path, so we need to clean cdt