From: Miao Xie Date: Thu, 27 Feb 2014 05:58:04 +0000 (+0800) Subject: Btrfs: fix wrong lock range and write size in check_can_nocow() X-Git-Tag: v3.15-rc1~96^2~50 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c933956ddf80bc455d33cbcf39d35d935daf45a9;p=pandora-kernel.git Btrfs: fix wrong lock range and write size in check_can_nocow() The write range may not be sector-aligned, for example: |--------|--------| <- write range, sector-unaligned, size: 2blocks |--------|--------|--------| <- correct lock range, size: 3blocks But according to the old code, we used the size of write range to calculate the lock range directly, not considered the offset, we would get a wrong lock range: |--------|--------| <- write range, sector-unaligned, size: 2blocks |--------|--------| <- wrong lock range, size: 2blocks And besides that, the old code also had the same problem when calculating the real write size. Correct them. Signed-off-by: Miao Xie Signed-off-by: Josef Bacik --- Reading git-diff-tree failed