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>
if (plist->pl_nr == 0)
RETURN(0);
if (plist->pl_nr == 0)
RETURN(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);
+ }
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"