public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs: fix buffer index in wait_eb_writebacks()
@ 2025-08-11 22:58 Naohiro Aota
  2025-08-11 23:11 ` Qu Wenruo
  2025-08-11 23:13 ` Boris Burkov
  0 siblings, 2 replies; 3+ messages in thread
From: Naohiro Aota @ 2025-08-11 22:58 UTC (permalink / raw)
  To: linux-btrfs; +Cc: dlemoal, Naohiro Aota

The commit f2cb97ee964a ("btrfs: index buffer_tree using node size")
changed the index of buffer_tree from "start >> sectorsize_bits" to "start
>> nodesize_bits". However, the change is not applied for
wait_eb_writebacks() and caused IO failures by writing in a full zone. Use
the index properly.

Fixes: f2cb97ee964a ("btrfs: index buffer_tree using node size")
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
---
 fs/btrfs/zoned.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c
index d9b26a48cb48..e264310b8d6b 100644
--- a/fs/btrfs/zoned.c
+++ b/fs/btrfs/zoned.c
@@ -2260,7 +2260,7 @@ static void wait_eb_writebacks(struct btrfs_block_group *block_group)
 	struct btrfs_fs_info *fs_info = block_group->fs_info;
 	const u64 end = block_group->start + block_group->length;
 	struct extent_buffer *eb;
-	unsigned long index, start = (block_group->start >> fs_info->sectorsize_bits);
+	unsigned long index, start = (block_group->start >> fs_info->nodesize_bits);
 
 	rcu_read_lock();
 	xa_for_each_start(&fs_info->buffer_tree, index, eb, start) {
-- 
2.50.1


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

* Re: [PATCH] btrfs: fix buffer index in wait_eb_writebacks()
  2025-08-11 22:58 [PATCH] btrfs: fix buffer index in wait_eb_writebacks() Naohiro Aota
@ 2025-08-11 23:11 ` Qu Wenruo
  2025-08-11 23:13 ` Boris Burkov
  1 sibling, 0 replies; 3+ messages in thread
From: Qu Wenruo @ 2025-08-11 23:11 UTC (permalink / raw)
  To: Naohiro Aota, linux-btrfs; +Cc: dlemoal



在 2025/8/12 08:28, Naohiro Aota 写道:
> The commit f2cb97ee964a ("btrfs: index buffer_tree using node size")
> changed the index of buffer_tree from "start >> sectorsize_bits" to "start
>>> nodesize_bits". However, the change is not applied for
> wait_eb_writebacks() and caused IO failures by writing in a full zone. Use
> the index properly.
> 
> Fixes: f2cb97ee964a ("btrfs: index buffer_tree using node size")
> Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>

Reviewed-by: Qu Wenruo <wqu@suse.com>

Thanks,
Qu

> ---
>   fs/btrfs/zoned.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c
> index d9b26a48cb48..e264310b8d6b 100644
> --- a/fs/btrfs/zoned.c
> +++ b/fs/btrfs/zoned.c
> @@ -2260,7 +2260,7 @@ static void wait_eb_writebacks(struct btrfs_block_group *block_group)
>   	struct btrfs_fs_info *fs_info = block_group->fs_info;
>   	const u64 end = block_group->start + block_group->length;
>   	struct extent_buffer *eb;
> -	unsigned long index, start = (block_group->start >> fs_info->sectorsize_bits);
> +	unsigned long index, start = (block_group->start >> fs_info->nodesize_bits);
>   
>   	rcu_read_lock();
>   	xa_for_each_start(&fs_info->buffer_tree, index, eb, start) {


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

* Re: [PATCH] btrfs: fix buffer index in wait_eb_writebacks()
  2025-08-11 22:58 [PATCH] btrfs: fix buffer index in wait_eb_writebacks() Naohiro Aota
  2025-08-11 23:11 ` Qu Wenruo
@ 2025-08-11 23:13 ` Boris Burkov
  1 sibling, 0 replies; 3+ messages in thread
From: Boris Burkov @ 2025-08-11 23:13 UTC (permalink / raw)
  To: Naohiro Aota; +Cc: linux-btrfs, dlemoal

On Tue, Aug 12, 2025 at 07:58:40AM +0900, Naohiro Aota wrote:
> The commit f2cb97ee964a ("btrfs: index buffer_tree using node size")
> changed the index of buffer_tree from "start >> sectorsize_bits" to "start
> >> nodesize_bits". However, the change is not applied for
> wait_eb_writebacks() and caused IO failures by writing in a full zone. Use
> the index properly.
> 
> Fixes: f2cb97ee964a ("btrfs: index buffer_tree using node size")
> Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Reviewed-by: Boris Burkov <boris@bur.io>
> ---
>  fs/btrfs/zoned.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c
> index d9b26a48cb48..e264310b8d6b 100644
> --- a/fs/btrfs/zoned.c
> +++ b/fs/btrfs/zoned.c
> @@ -2260,7 +2260,7 @@ static void wait_eb_writebacks(struct btrfs_block_group *block_group)
>  	struct btrfs_fs_info *fs_info = block_group->fs_info;
>  	const u64 end = block_group->start + block_group->length;
>  	struct extent_buffer *eb;
> -	unsigned long index, start = (block_group->start >> fs_info->sectorsize_bits);
> +	unsigned long index, start = (block_group->start >> fs_info->nodesize_bits);
>  
>  	rcu_read_lock();
>  	xa_for_each_start(&fs_info->buffer_tree, index, eb, start) {
> -- 
> 2.50.1
> 

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

end of thread, other threads:[~2025-08-11 23:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-11 22:58 [PATCH] btrfs: fix buffer index in wait_eb_writebacks() Naohiro Aota
2025-08-11 23:11 ` Qu Wenruo
2025-08-11 23:13 ` Boris Burkov

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