From: Frank Zago Date: Thu, 7 Apr 2016 16:57:33 +0000 (-0400) Subject: LU-7988 hsm: remove hsd.request_sz from struct hsm_scan_data X-Git-Tag: 2.8.56~15 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=refs%2Fchanges%2F78%2F19578%2F14;p=fs%2Flustre-release.git LU-7988 hsm: remove hsd.request_sz from struct hsm_scan_data 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 Change-Id: If58546b9e23281097ed414f863e91b1e6a54c8fb Reviewed-on: http://review.whamcloud.com/19578 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Vinayak Reviewed-by: Patrick Farrell Reviewed-by: Ben Evans Reviewed-by: Oleg Drokin --- diff --git a/lustre/mdt/mdt_coordinator.c b/lustre/mdt/mdt_coordinator.c index 9669fec..1727a0c 100644 --- a/lustre/mdt/mdt_coordinator.c +++ b/lustre/mdt/mdt_coordinator.c @@ -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