From: Li Dongyang Date: Thu, 28 Aug 2014 02:17:33 +0000 (+1000) Subject: LU-5552 llite: make sure we do cl_page_clip on the last page X-Git-Tag: 2.6.53~99 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=ea008e09e53a8e71bdbbd326c062f64d59678095;p=fs%2Flustre-release.git 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 --- 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); + } } }