Btrfs: Allow creation of inline extent whose size is equal to blocksize.
PATCH 1/1 Btrfs: Allow creation of inline extent whose size is equal to blocksize.
With the current code, the following command (executed on a filesystem with 4k as the block size) creates a file with a regular extent:
$ xfs_io -f -c "pwrite 0 4096" /mnt/file-0.bin; sync;
This commit fixes the issue by checking if 'actual_end - 1' is on a file offset which is a multiple of block size.
Signed-off-by Chandan Rajendra <[email protected]>
--- fs/btrfs/inode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/btrfs/inode.c +2 -2
@@ -259,8 +259,8 @@ static noinline int cow_file_range_inline(struct btrfs_root *root,if (start >0 || actual_end >PAGE_CACHE_SIZE || data_len >BTRFS_MAX_INLINE_DATA_SIZE (root) || - (!compressed_size && - (actual_end & (root->sectorsize -1 )) ==0 ) || + (!compressed_size && (actual_end >1 ) && + ((actual_end -1 ) & (root->sectorsize -1 )) ==0 ) || end +1 < isize || data_len > root->fs_info->max_inline) {return 1 ;
Signature · 1 line
2.1.0