X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Fobdecho%2Fecho_client.c;h=68e4318b9ebe861ad8170296472c791d34fbd61a;hp=e435f5d60f28df33bb0315fbaf26cf1c7b6969ae;hb=e533c7c6d1eb2bbdc4818f688f76fab1d03bc2c8;hpb=c3ddfae1b795385aa14db61df1a416ab57bfc066 diff --git a/lustre/obdecho/echo_client.c b/lustre/obdecho/echo_client.c index e435f5d..68e4318 100644 --- 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; - u64 npages, tot_pages; + u64 npages, tot_pages, apc; int i, ret = 0, brw_flags = 0; - ENTRY; + ENTRY; 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; - OBD_ALLOC(lnb, npages * sizeof(struct niobuf_local)); + OBD_ALLOC(lnb, apc * sizeof(struct niobuf_local)); if (lnb == NULL) - GOTO(out, ret = -ENOMEM); + RETURN(-ENOMEM); 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; - lpages = npages; + lpages = npages; 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; @@ -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); - if (ret != 0) - GOTO(out, ret); + if (ret != 0) + break; /* 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: - if (lnb) - OBD_FREE(lnb, npages * sizeof(struct niobuf_local)); + OBD_FREE(lnb, apc * sizeof(struct niobuf_local)); + RETURN(ret); }