Whamcloud - gitweb
git://git.whamcloud.com
/
fs
/
lustre-release.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
LU-7084 mem: code cleanup for memory allocation
[fs/lustre-release.git]
/
lustre
/
obdecho
/
echo_client.c
diff --git
a/lustre/obdecho/echo_client.c
b/lustre/obdecho/echo_client.c
index
e435f5d
..
68e4318
100644
(file)
--- a/
lustre/obdecho/echo_client.c
+++ b/
lustre/obdecho/echo_client.c
@@
-2414,20
+2414,20
@@
static int echo_client_prep_commit(const struct lu_env *env,
struct niobuf_local *lnb;
struct niobuf_remote rnb;
u64 off;
struct niobuf_local *lnb;
struct niobuf_remote rnb;
u64 off;
- u64 npages, tot_pages;
+ u64 npages, tot_pages
, apc
;
int i, ret = 0, brw_flags = 0;
int i, ret = 0, brw_flags = 0;
-
ENTRY;
+ ENTRY;
if (count <= 0 || (count & ~PAGE_CACHE_MASK) != 0)
RETURN(-EINVAL);
if (count <= 0 || (count & ~PAGE_CACHE_MASK) != 0)
RETURN(-EINVAL);
- npages = batch >> PAGE_CACHE_SHIFT;
+
apc =
npages = batch >> PAGE_CACHE_SHIFT;
tot_pages = count >> PAGE_CACHE_SHIFT;
tot_pages = count >> PAGE_CACHE_SHIFT;
- OBD_ALLOC(lnb,
npages
* sizeof(struct niobuf_local));
+ OBD_ALLOC(lnb,
apc
* sizeof(struct niobuf_local));
if (lnb == NULL)
if (lnb == NULL)
-
GOTO(out, ret =
-ENOMEM);
+
RETURN(
-ENOMEM);
if (rw == OBD_BRW_WRITE && async)
brw_flags |= OBD_BRW_ASYNC;
if (rw == OBD_BRW_WRITE && async)
brw_flags |= OBD_BRW_ASYNC;
@@
-2448,10
+2448,10
@@
static int echo_client_prep_commit(const struct lu_env *env,
ioo.ioo_bufcnt = 1;
off += npages * PAGE_CACHE_SIZE;
ioo.ioo_bufcnt = 1;
off += npages * PAGE_CACHE_SIZE;
-
lpages = npages;
+ lpages = npages;
ret = obd_preprw(env, rw, exp, oa, 1, &ioo, &rnb, &lpages, lnb);
ret = obd_preprw(env, rw, exp, oa, 1, &ioo, &rnb, &lpages, lnb);
-
if (ret != 0)
-
GOTO(out, ret);
+ if (ret != 0)
+ GOTO(out, ret);
for (i = 0; i < lpages; i++) {
struct page *page = lnb[i].lnb_page;
for (i = 0; i < lpages; i++) {
struct page *page = lnb[i].lnb_page;
@@
-2482,8
+2482,8
@@
static int echo_client_prep_commit(const struct lu_env *env,
ret = obd_commitrw(env, rw, exp, oa, 1, &ioo, &rnb, npages, lnb,
ret);
ret = obd_commitrw(env, rw, exp, oa, 1, &ioo, &rnb, npages, lnb,
ret);
-
if (ret != 0)
-
GOTO(out, ret)
;
+ if (ret != 0)
+
break
;
/* Reuse env context. */
lu_context_exit((struct lu_context *)&env->le_ctx);
/* Reuse env context. */
lu_context_exit((struct lu_context *)&env->le_ctx);
@@
-2491,8
+2491,8
@@
static int echo_client_prep_commit(const struct lu_env *env,
}
out:
}
out:
- if (lnb)
- OBD_FREE(lnb, npages * sizeof(struct niobuf_local));
+ OBD_FREE(lnb, apc * sizeof(struct niobuf_local));
+
RETURN(ret);
}
RETURN(ret);
}