Whamcloud - gitweb
LU-5552 llite: make sure we do cl_page_clip on the last page
[fs/lustre-release.git] / lustre / llite / vvp_io.c
index fff352f..df42e28 100644 (file)
@@ -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);
+                       }
                }
        }