From ea008e09e53a8e71bdbbd326c062f64d59678095 Mon Sep 17 00:00:00 2001 From: Li Dongyang Date: Thu, 28 Aug 2014 12:17:33 +1000 Subject: [PATCH] LU-5552 llite: make sure we do cl_page_clip on the last page When we are doing a partial IO on both first and last page, the logic currently only call cl_page_clip on the first page, which will end up with a incorrect i_size. Signed-off-by: Li Dongyang Change-Id: Ia7be3d71e535d583cb424bb816c14015d3141cdb Reviewed-on: http://review.whamcloud.com/11630 Reviewed-by: Ian Costello Tested-by: Jenkins Reviewed-by: Niu Yawei Reviewed-by: Li Xi Reviewed-by: Jinshan Xiong Tested-by: Maloo Reviewed-by: Oleg Drokin --- lustre/llite/vvp_io.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lustre/llite/vvp_io.c b/lustre/llite/vvp_io.c index fff352f..df42e28 100644 --- a/lustre/llite/vvp_io.c +++ b/lustre/llite/vvp_io.c @@ -606,11 +606,13 @@ static int vvp_io_commit_sync(const struct lu_env *env, struct cl_io *io, page = cl_page_list_first(plist); 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); + if (from > 0) + cl_page_clip(env, page, from, PAGE_SIZE); + if (to != PAGE_SIZE) { + page = cl_page_list_last(plist); + cl_page_clip(env, page, 0, to); + } } } -- 1.8.3.1