btrfs: fix wrong sizeof in btrfs_do_encoded_write
PATCH 1/1 btrfs: fix wrong sizeof in btrfs_do_encoded_write
btrfs_do_encoded_write was converted to use folios in 400b172b8cdc, but we're still allocating based on sizeof(struct page *) rather than sizeof(struct folio *).
Signed-off-by Mark Harmstone <[email protected]>
--- fs/btrfs/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/inode.c +1 -1
@@ -9495,7 +9495,7 @@ ssize_t btrfs_do_encoded_write(struct kiocb *iocb, struct iov_iter *from,*/ disk_num_bytes =ALIGN (orig_count, fs_info->sectorsize); nr_folios =DIV_ROUND_UP (disk_num_bytes,PAGE_SIZE ); - folios =kvcalloc (nr_folios,sizeof (struct page *),GFP_KERNEL_ACCOUNT ); + folios =kvcalloc (nr_folios,sizeof (struct folio *),GFP_KERNEL_ACCOUNT );if (!folios)return -ENOMEM ;for (i =0 ; i < nr_folios; i++) {
Signature · 1 line
2.44.2
Quoted 5 lines · Mark Harmstone
btrfs_do_encoded_writewas converted to use folios in400b172b8cdc, but we're still allocating based onsizeof(struct page *)rather thansizeof(struct folio *).Signed-off-by Mark Harmstone <[email protected]>
Reviewed-by Boris Burkov <[email protected]>
Quoted 20 lines
--- fs/btrfs/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/btrfs/inode.c +1
-1@@ -9495,7 +9495,7 @@ ssize_t btrfs_do_encoded_write(struct kiocb *iocb, struct iov_iter *from,*/ disk_num_bytes =ALIGN (orig_count, fs_info->sectorsize); nr_folios =DIV_ROUND_UP (disk_num_bytes,PAGE_SIZE ); - folios =kvcalloc (nr_folios,sizeof (struct page *),GFP_KERNEL_ACCOUNT ); + folios =kvcalloc (nr_folios,sizeof (struct folio *),GFP_KERNEL_ACCOUNT );if (!folios)return -ENOMEM ;for (i =0 ; i < nr_folios; i++) {Signature · 1 line
2.44.2
Quoted 3 lines · Mark Harmstone
btrfs_do_encoded_writewas converted to use folios in400b172b8cdc, but we're still allocating based onsizeof(struct page *)rather thansizeof(struct folio *).
It's wrong that we should use folio, but both are a sizeof of a pointer, so it's not wrong in the functionality sense.
Quoted 1 line
Signed-off-by Mark Harmstone <[email protected]>
Reviewed-by David Sterba <[email protected]>