From: Namjae Jeon Date: Tue, 29 Jul 2014 14:45:31 +0000 (-0400) Subject: ext4: fix COLLAPSE RANGE test for bigalloc file systems X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ee98fa3a8b148a234600a20f7cdc2b4b37f38083;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git ext4: fix COLLAPSE RANGE test for bigalloc file systems Blocks in collapse range should be collapsed per cluster unit when bigalloc is enable. If bigalloc is not enable, EXT4_CLUSTER_SIZE will be same with EXT4_BLOCK_SIZE. With this bug fixed, patch enables COLLAPSE_RANGE for bigalloc, which fixes a large number of xfstest failures which use fsx. Signed-off-by: Namjae Jeon Signed-off-by: Ashish Sangwan Signed-off-by: Theodore Ts'o --- diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index 6950babecde7..76c2df382b7d 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c @@ -5404,16 +5404,13 @@ int ext4_collapse_range(struct inode *inode, loff_t offset, loff_t len) int ret; /* Collapse range works only on fs block size aligned offsets. */ - if (offset & (EXT4_BLOCK_SIZE(sb) - 1) || - len & (EXT4_BLOCK_SIZE(sb) - 1)) + if (offset & (EXT4_CLUSTER_SIZE(sb) - 1) || + len & (EXT4_CLUSTER_SIZE(sb) - 1)) return -EINVAL; if (!S_ISREG(inode->i_mode)) return -EINVAL; - if (EXT4_SB(inode->i_sb)->s_cluster_ratio > 1) - return -EOPNOTSUPP; - trace_ext4_collapse_range(inode, offset, len); punch_start = offset >> EXT4_BLOCK_SIZE_BITS(sb);