Whamcloud - gitweb
LU-4201 llite: clip page correctly for vvp_io_commit_sync 31/8531/3
authorJinshan Xiong <jinshan.xiong@intel.com>
Tue, 10 Dec 2013 07:41:26 +0000 (23:41 -0800)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 17 Dec 2013 05:36:32 +0000 (05:36 +0000)
The original code was wrong which clipped page incorrectly for
partial pages started with zero.

Signed-off-by: Jinshan Xiong <jinshan.xiong@intel.com>
Change-Id: I66ec542d5282fdfd68fe59f8056aca292b318c00
Reviewed-on: http://review.whamcloud.com/8531
Tested-by: Jenkins
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: wangdi <di.wang@intel.com>
lustre/llite/vvp_io.c
lustre/tests/sanity.sh

index 7522a48..ceb5ba6 100644 (file)
@@ -622,14 +622,16 @@ static int vvp_io_commit_sync(const struct lu_env *env, struct cl_io *io,
        if (plist->pl_nr == 0)
                RETURN(0);
 
        if (plist->pl_nr == 0)
                RETURN(0);
 
-       if (from != 0) {
+       if (from > 0 || to != PAGE_SIZE) {
                page = cl_page_list_first(plist);
                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) {
-               page = cl_page_list_last(plist);
-               cl_page_clip(env, page, 0, to);
+               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_2queue_init(queue);
index ff16f9b..33919d9 100644 (file)
@@ -11241,6 +11241,10 @@ test_219() {
         dd if=/dev/zero of=$DIR/$tfile bs=4096 count=1 seek=3
         $LCTL set_param fail_loc=0x411
         dd if=/dev/zero of=$DIR/$tfile bs=1024 count=1 seek=2 conv=notrunc
         dd if=/dev/zero of=$DIR/$tfile bs=4096 count=1 seek=3
         $LCTL set_param fail_loc=0x411
         dd if=/dev/zero of=$DIR/$tfile bs=1024 count=1 seek=2 conv=notrunc
+
+       # LU-4201
+       dd if=/dev/zero of=$DIR/$tfile-2 bs=1024 count=1
+       $CHECKSTAT -s 1024 $DIR/$tfile-2 || error "checkstat wrong size"
 }
 run_test 219 "LU-394: Write partial won't cause uncontiguous pages vec at LND"
 
 }
 run_test 219 "LU-394: Write partial won't cause uncontiguous pages vec at LND"