Linux Btrfs filesystem development
 help / color / mirror / Atom feed
* [PATCH] btrfs: fix wrong sizeof in btrfs_do_encoded_write
@ 2024-10-15 11:37 Mark Harmstone
  2024-10-15 20:57 ` Boris Burkov
  2024-10-16  0:27 ` David Sterba
  0 siblings, 2 replies; 3+ messages in thread
From: Mark Harmstone @ 2024-10-15 11:37 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Mark Harmstone

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 <maharmstone@fb.com>
---
 fs/btrfs/inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 5618ca02934a..5bffc2c77718 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -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++) {
-- 
2.44.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] btrfs: fix wrong sizeof in btrfs_do_encoded_write
  2024-10-15 11:37 [PATCH] btrfs: fix wrong sizeof in btrfs_do_encoded_write Mark Harmstone
@ 2024-10-15 20:57 ` Boris Burkov
  2024-10-16  0:27 ` David Sterba
  1 sibling, 0 replies; 3+ messages in thread
From: Boris Burkov @ 2024-10-15 20:57 UTC (permalink / raw)
  To: Mark Harmstone; +Cc: linux-btrfs

On Tue, Oct 15, 2024 at 12:37:29PM +0100, Mark Harmstone wrote:
> 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 <maharmstone@fb.com>
Reviewed-by: Boris Burkov <boris@bur.io>
> ---
>  fs/btrfs/inode.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
> index 5618ca02934a..5bffc2c77718 100644
> --- a/fs/btrfs/inode.c
> +++ b/fs/btrfs/inode.c
> @@ -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++) {
> -- 
> 2.44.2
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] btrfs: fix wrong sizeof in btrfs_do_encoded_write
  2024-10-15 11:37 [PATCH] btrfs: fix wrong sizeof in btrfs_do_encoded_write Mark Harmstone
  2024-10-15 20:57 ` Boris Burkov
@ 2024-10-16  0:27 ` David Sterba
  1 sibling, 0 replies; 3+ messages in thread
From: David Sterba @ 2024-10-16  0:27 UTC (permalink / raw)
  To: Mark Harmstone; +Cc: linux-btrfs

On Tue, Oct 15, 2024 at 12:37:29PM +0100, Mark Harmstone wrote:
> 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 *).

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.

> Signed-off-by: Mark Harmstone <maharmstone@fb.com>

Reviewed-by: David Sterba <dsterba@suse.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-10-16  0:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-15 11:37 [PATCH] btrfs: fix wrong sizeof in btrfs_do_encoded_write Mark Harmstone
2024-10-15 20:57 ` Boris Burkov
2024-10-16  0:27 ` David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox