Btrfs: fix off-by-one in cow_file_range_inline()
authorWang Shilong <wangsl.fnst@cn.fujitsu.com>
Thu, 17 Jul 2014 03:44:11 +0000 (11:44 +0800)
committerChris Mason <clm@fb.com>
Wed, 17 Sep 2014 20:37:39 +0000 (13:37 -0700)
Btrfs could still inline file data if its size is same as
page size, so don't skip max value here.

Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
Reviewed-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <clm@fb.com>
fs/btrfs/inode.c

index d1c69beb054f4692eeead80275a3ac509511cb48..75c6de26405cd561420e951c7a6608bd27b5e158 100644 (file)
@@ -249,8 +249,8 @@ static noinline int cow_file_range_inline(struct btrfs_root *root,
                data_len = compressed_size;
 
        if (start > 0 ||
-           actual_end >= PAGE_CACHE_SIZE ||
-           data_len >= BTRFS_MAX_INLINE_DATA_SIZE(root) ||
+           actual_end > PAGE_CACHE_SIZE ||
+           data_len > BTRFS_MAX_INLINE_DATA_SIZE(root) ||
            (!compressed_size &&
            (actual_end & (root->sectorsize - 1)) == 0) ||
            end + 1 < isize ||