aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJinshan Xiong <[email protected]>2016-03-30 19:48:42 -0400
committerGreg Kroah-Hartman <[email protected]>2016-03-30 21:38:13 -0700
commitc11599b8d52d353f45b2dc05d58c48f9812ce6e9 (patch)
treee618f737ae202d03317ab5ba28d57151d3c901ad
parent71a96a0539a8ebd8273bf627222e260968b82a16 (diff)
staging/lustre/llite: clip page correctly for vvp_io_commit_sync
The original code was wrong which clipped page incorrectly for partial pages started with zero. Signed-off-by: Jinshan Xiong <[email protected]> Reviewed-on: http://review.whamcloud.com/8531 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4201 Reviewed-by: Andreas Dilger <[email protected]> Reviewed-by: wangdi <[email protected]> Signed-off-by: Oleg Drokin <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
-rw-r--r--drivers/staging/lustre/lustre/llite/vvp_io.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/staging/lustre/lustre/llite/vvp_io.c b/drivers/staging/lustre/lustre/llite/vvp_io.c
index fb6f93225b99..e44ef21b795e 100644
--- a/drivers/staging/lustre/lustre/llite/vvp_io.c
+++ b/drivers/staging/lustre/lustre/llite/vvp_io.c
@@ -595,15 +595,17 @@ static int vvp_io_commit_sync(const struct lu_env *env, struct cl_io *io,
if (plist->pl_nr == 0)
return 0;
- if (from != 0) {
+ if (from > 0 || to != PAGE_SIZE) {
page = cl_page_list_first(plist);
- cl_page_clip(env, page, from,
- plist->pl_nr == 1 ? to : PAGE_SIZE);
- }
- if (to != PAGE_SIZE && plist->pl_nr > 1) {
+ if (plist->pl_nr == 1) {
+ cl_page_clip(env, page, from, to);
+ } else if (from > 0) {
+ cl_page_clip(env, page, from, PAGE_SIZE);
+ } else {
page = cl_page_list_last(plist);
cl_page_clip(env, page, 0, to);
}
+ }
cl_2queue_init(queue);
cl_page_list_splice(plist, &queue->c2_qin);