@@ -6036,7 +6036,11 @@ next:
if (found_type == BTRFS_FILE_EXTENT_REG ||
found_type == BTRFS_FILE_EXTENT_PREALLOC) {
em->start = extent_start;
- em->len = extent_end - extent_start;
+ if (inode->i_sb->s_blocksize < PAGE_CACHE_SIZE &&
+ em->len < PAGE_CACHE_SIZE)
+ em->len = PAGE_CACHE_SIZE;
+ else
+ em->len = extent_end - extent_start;
em->orig_start = extent_start -
btrfs_file_extent_offset(leaf, item);
em->orig_block_len = btrfs_file_extent_disk_num_bytes(leaf,
@@ -6077,6 +6081,8 @@ next:
extent_offset = page_offset(page) + pg_offset - extent_start;
copy_size = min_t(u64, PAGE_CACHE_SIZE - pg_offset,
size - extent_offset);
+ if (inode->i_sb->s_blocksize < PAGE_CACHE_SIZE)
+ copy_size = max_t(u64, copy_size, PAGE_CACHE_SIZE);
em->start = extent_start + extent_offset;
em->len = ALIGN(copy_size, btrfs_align_size(inode));
em->orig_block_len = em->len;
This patch makes sure that the size extent maps handles are at least PAGE_CACHE_SIZE for the subpagesize-blocksize case. Signed-off-by: Chandra Seetharaman <sekharan@us.ibm.com> --- fs/btrfs/inode.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)