xfs: pass proper leaf argument from xfs_rtrefcountbt_broot_realloc()
PATCH 1/1 xfs: pass proper leaf argument from xfs_rtrefcountbt_broot_realloc()
xfs_rtrefcountbt_maxrecs() takes a third boolean "leaf" argument, but the caller in xfs_rtrefcountbt_broot_realloc() passes level directly, rather than "level == 0" as is done correctly in xfs_rtrefcountbt_get_minrecs and xfs_rtrefcountbt_get_maxrecs.
Fix that.
--- fs/xfs/libxfs/xfs_rtrefcount_btree.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/xfs/libxfs/xfs_rtrefcount_btree.c +2 -1
@@ -237,7 +237,8 @@ xfs_rtrefcountbt_broot_realloc(* realloc it and possibly move the node block pointers because * those are not butted up against the btree block header. */ - old_numrecs =xfs_rtrefcountbt_maxrecs (mp, old_size, level); + old_numrecs =xfs_rtrefcountbt_maxrecs (mp, old_size, + level ==0 ); broot =xfs_broot_realloc (ifp, new_size);if (level >0 ) xfs_rtrefcountbt_move_ptrs(mp, broot, old_size,
Signature · 1 line
2.56.1
Quoted 4 lines · Eric Sandeen
xfs_rtrefcountbt_maxrecs()takes a third boolean "leaf" argument, but the caller inxfs_rtrefcountbt_broot_realloc()passes level directly, rather than "level == 0" as is done correctly inxfs_rtrefcountbt_get_minrecsandxfs_rtrefcountbt_get_maxrecs.
So we basically get the wrong maxrecs here. I assume you found this by code inspection and not by testing?
Quoted 10 lines · Christoph Hellwig
Quoted 4 lines · Eric Sandeen
xfs_rtrefcountbt_maxrecs()takes a third boolean "leaf" argument, but the caller inxfs_rtrefcountbt_broot_realloc()passes level directly, rather than "level == 0" as is done correctly inxfs_rtrefcountbt_get_minrecsandxfs_rtrefcountbt_get_maxrecs.So we basically get the wrong maxrecs here. I assume you found this by code inspection and not by testing?
Reviewed-by Christoph Hellwig <[email protected]>
Yes. (with the help of an LLM doing other review)
There are actually other cases where we got a factor of two wrong in this code when it was copied in, and some of it affects disk format. I need to grok that a bit better and can send a patch, but the patch will probably just be "document it in a comment" because trying to change the disk format now is probably not worth it.
(tl;dr, the problem splits root nodes too soon due to the error, IIRC.)
-Eric
Quoted 8 lines · Eric Sandeen
xfs_rtrefcountbt_maxrecs()takes a third boolean "leaf" argument, but the caller inxfs_rtrefcountbt_broot_realloc()passes level directly, rather than "level == 0" as is done correctly inxfs_rtrefcountbt_get_minrecsandxfs_rtrefcountbt_get_maxrecs.Fix that.
[...]
Applied to for-next, thanks!
[1/1] xfs: pass proper leaf argument from xfs_rtrefcountbt_broot_realloc()
commit: ba7d05f4078051e9b68a08c213eefae0edbc8a0a
Best regards,
Signature · 1 line
Carlos Maiolino <[email protected]>