Commit 832bd710 authored by Alex Zhuravlev's avatar Alex Zhuravlev Committed by Greg Kroah-Hartman

staging: lustre: echo: request pages in batches

rather than fetch them one by one.
Signed-off-by: default avatarAlex Zhuravlev <alexey.zhuravlev@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5278
Reviewed-on: http://review.whamcloud.com/13612Reviewed-by: default avatarNathaniel Clark <nathaniel.l.clark@intel.com>
Reviewed-by: default avatarAndreas Dilger <andreas.dilger@intel.com>
Signed-off-by: default avatarJames Simmons <jsimmons@infradead.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e10a431b
...@@ -1335,7 +1335,7 @@ static int echo_client_prep_commit(const struct lu_env *env, ...@@ -1335,7 +1335,7 @@ static int echo_client_prep_commit(const struct lu_env *env,
{ {
struct obd_ioobj ioo; struct obd_ioobj ioo;
struct niobuf_local *lnb; struct niobuf_local *lnb;
struct niobuf_remote *rnb; struct niobuf_remote rnb;
u64 off; u64 off;
u64 npages, tot_pages; u64 npages, tot_pages;
int i, ret = 0, brw_flags = 0; int i, ret = 0, brw_flags = 0;
...@@ -1347,9 +1347,7 @@ static int echo_client_prep_commit(const struct lu_env *env, ...@@ -1347,9 +1347,7 @@ static int echo_client_prep_commit(const struct lu_env *env,
tot_pages = count >> PAGE_SHIFT; tot_pages = count >> PAGE_SHIFT;
lnb = kcalloc(npages, sizeof(struct niobuf_local), GFP_NOFS); lnb = kcalloc(npages, sizeof(struct niobuf_local), GFP_NOFS);
rnb = kcalloc(npages, sizeof(struct niobuf_remote), GFP_NOFS); if (!lnb) {
if (!lnb || !rnb) {
ret = -ENOMEM; ret = -ENOMEM;
goto out; goto out;
} }
...@@ -1361,25 +1359,22 @@ static int echo_client_prep_commit(const struct lu_env *env, ...@@ -1361,25 +1359,22 @@ static int echo_client_prep_commit(const struct lu_env *env,
off = offset; off = offset;
for (; tot_pages; tot_pages -= npages) { for (; tot_pages > 0; tot_pages -= npages) {
int lpages; int lpages;
if (tot_pages < npages) if (tot_pages < npages)
npages = tot_pages; npages = tot_pages;
for (i = 0; i < npages; i++, off += PAGE_SIZE) { rnb.rnb_offset = off;
rnb[i].rnb_offset = off; rnb.rnb_len = npages * PAGE_SIZE;
rnb[i].rnb_len = PAGE_SIZE; rnb.rnb_flags = brw_flags;
rnb[i].rnb_flags = brw_flags; ioo.ioo_bufcnt = 1;
} off += npages * PAGE_SIZE;
ioo.ioo_bufcnt = npages;
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) if (ret != 0)
goto out; goto out;
LASSERT(lpages == npages);
for (i = 0; i < lpages; i++) { for (i = 0; i < lpages; i++) {
struct page *page = lnb[i].lnb_page; struct page *page = lnb[i].lnb_page;
...@@ -1399,16 +1394,16 @@ static int echo_client_prep_commit(const struct lu_env *env, ...@@ -1399,16 +1394,16 @@ static int echo_client_prep_commit(const struct lu_env *env,
if (rw == OBD_BRW_WRITE) if (rw == OBD_BRW_WRITE)
echo_client_page_debug_setup(page, rw, echo_client_page_debug_setup(page, rw,
ostid_id(&oa->o_oi), ostid_id(&oa->o_oi),
rnb[i].rnb_offset, lnb[i].lnb_file_offset,
rnb[i].rnb_len); lnb[i].lnb_len);
else else
echo_client_page_debug_check(page, echo_client_page_debug_check(page,
ostid_id(&oa->o_oi), ostid_id(&oa->o_oi),
rnb[i].rnb_offset, lnb[i].lnb_file_offset,
rnb[i].rnb_len); lnb[i].lnb_len);
} }
ret = obd_commitrw(env, rw, exp, oa, 1, &ioo, rnb, npages, lnb, ret = obd_commitrw(env, rw, exp, oa, 1, &ioo, &rnb, npages, lnb,
ret); ret);
if (ret != 0) if (ret != 0)
goto out; goto out;
...@@ -1420,7 +1415,6 @@ static int echo_client_prep_commit(const struct lu_env *env, ...@@ -1420,7 +1415,6 @@ static int echo_client_prep_commit(const struct lu_env *env,
out: out:
kfree(lnb); kfree(lnb);
kfree(rnb);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment