Skip to contentSkip to conversation

btrfs: correct the assert for subpage case

PATCH In review Daniel Vacek 3 participants 4 messages May 12, 2025 – May 13, 2025 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 btrfs: correct the assert for subpage case

The assert is only true in !subpage case. We can either fix it this way or completely remove it.

This fixes and should be folded into:
btrfs: fix broken drop_caches on extent buffer folios

---
 fs/btrfs/extent_io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/extent_io.c +1 -1
index 80a8563a25add..3b3f73894ffe2 100644
@@ -3411,7 +3411,7 @@ struct extent_buffer *alloc_extent_buffer(struct btrfs_fs_info *fs_info,
 			continue;
 		}
 
-		ASSERT(!folio_test_private(folio));
+		ASSERT(!btrfs_meta_is_subpage(fs_info) && !folio_test_private(folio));
 		folio_put(folio);
 		eb->folios[i] = NULL;
 	}
Signature · 1 line
2.47.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Daniel Vacek

The assert is only true in !subpage case. We can either fix it this way or completely remove it.

This fixes and should be folded into:
btrfs: fix broken drop_caches on extent buffer folios

I would lean towards removing it, personally. But LGTM, thanks.

Quoted 20 lines
---
 fs/btrfs/extent_io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/extent_io.c +1 -1
index 80a8563a25add..3b3f73894ffe2 100644
@@ -3411,7 +3411,7 @@ struct extent_buffer *alloc_extent_buffer(struct btrfs_fs_info *fs_info,
 			continue;
 		}
 
-		ASSERT(!folio_test_private(folio));
+		ASSERT(!btrfs_meta_is_subpage(fs_info) && !folio_test_private(folio));
 		folio_put(folio);
 		eb->folios[i] = NULL;
 	}
Signature · 1 line
2.47.2
#2 lore raw
Quoted 11 lines · Boris Burkov
Quoted 7 lines · Daniel Vacek

The assert is only true in !subpage case. We can either fix it this way or completely remove it.

This fixes and should be folded into:
btrfs: fix broken drop_caches on extent buffer folios

I would lean towards removing it, personally. But LGTM, thanks.

Good. Let's remove it then. Will you amend your patch?

Quoted 22 lines
Quoted 20 lines
---
 fs/btrfs/extent_io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/extent_io.c +1 -2
index 80a8563a25add..3b3f73894ffe2 100644
@@ -3411,7 +3411,7 @@ struct extent_buffer *alloc_extent_buffer(struct btrfs_fs_info *fs_info,
                      continue;
              }
 
-             ASSERT(!folio_test_private(folio));
+             ASSERT(!btrfs_meta_is_subpage(fs_info) && !folio_test_private(folio));
              folio_put(folio);
              eb->folios[i] = NULL;
      }
--

2.47.2

Reviewed-by on v1 1/1
#3 lore raw
In reply to Daniel Vacek
Quoted 7 lines · Daniel Vacek

The assert is only true in !subpage case. We can either fix it this way or completely remove it.

This fixes and should be folded into:
btrfs: fix broken drop_caches on extent buffer folios

Looks good to me.

Although I agree with Boris, it's better to remove the ASSERT().
Subpage is no longer a corner/minor usage anymore, we shouldn't treat subpage and normal cases differently when possible.

Thanks,
Qu

Quoted 17 lines
---
  fs/btrfs/extent_io.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/extent_io.c +1 -1
index 80a8563a25add..3b3f73894ffe2 100644
@@ -3411,7 +3411,7 @@ struct extent_buffer *alloc_extent_buffer(struct btrfs_fs_info *fs_info,
  			continue;
  		}
 
-		ASSERT(!folio_test_private(folio));
+		ASSERT(!btrfs_meta_is_subpage(fs_info) && !folio_test_private(folio));
  		folio_put(folio);
  		eb->folios[i] = NULL;
  	}