Commit 74e2d065 authored by Dave Chinner's avatar Dave Chinner Committed by Felix Blyakher

Long btree pointers are still 64 bit on disk

[XFS] Long btree pointers are still 64 bit on disk

On 32 bit machines with CONFIG_LBD=n, XFS reduces the
in memory size of xfs_fsblock_t to 32 bits so that it
will fit within 32 bit addressing. However, the disk format
for long btree pointers are still 64 bits in size.

The recent btree rewrite failed to take this into account
when initialising new btree blocks, setting sibling pointers
to NULL and checking if they are NULL. Hence checking whether
a 64 bit NULL was the same as a 32 bit NULL was failingi
resulting in NULL sibling pointers failing to be detected
correctly. This showed up as WANT_CORRUPTED_GOTO shutdowns
in xfs_btree_delrec.

Fix this by making all the comparisons and setting of long
pointer btree NULL blocks to the disk format, not the
in memory format. i.e. use NULLDFSBNO.
Reported-by: default avatarAlexander Beregalov <a.beregalov@gmail.com>
Reported-by: default avatarJacek Luczak <difrost.kernel@gmail.com>
Reported-by: default avatarDanny ter Haar <dth@dth.net>
Tested-by: default avatarJacek Luczak <difrost.kernel@gmail.com>
Reviewed-by: default avatarChristoph Hellwig <hch@infradead.org>
Signed-off-by: default avatarDave Chinner <david@fromorbit.com>
Signed-off-by: default avatarFelix Blyakher <felixb@sgi.com>
parent b6e32227
...@@ -843,7 +843,7 @@ xfs_btree_ptr_is_null( ...@@ -843,7 +843,7 @@ xfs_btree_ptr_is_null(
union xfs_btree_ptr *ptr) union xfs_btree_ptr *ptr)
{ {
if (cur->bc_flags & XFS_BTREE_LONG_PTRS) if (cur->bc_flags & XFS_BTREE_LONG_PTRS)
return be64_to_cpu(ptr->l) == NULLFSBLOCK; return be64_to_cpu(ptr->l) == NULLDFSBNO;
else else
return be32_to_cpu(ptr->s) == NULLAGBLOCK; return be32_to_cpu(ptr->s) == NULLAGBLOCK;
} }
...@@ -854,7 +854,7 @@ xfs_btree_set_ptr_null( ...@@ -854,7 +854,7 @@ xfs_btree_set_ptr_null(
union xfs_btree_ptr *ptr) union xfs_btree_ptr *ptr)
{ {
if (cur->bc_flags & XFS_BTREE_LONG_PTRS) if (cur->bc_flags & XFS_BTREE_LONG_PTRS)
ptr->l = cpu_to_be64(NULLFSBLOCK); ptr->l = cpu_to_be64(NULLDFSBNO);
else else
ptr->s = cpu_to_be32(NULLAGBLOCK); ptr->s = cpu_to_be32(NULLAGBLOCK);
} }
...@@ -918,8 +918,8 @@ xfs_btree_init_block( ...@@ -918,8 +918,8 @@ xfs_btree_init_block(
new->bb_numrecs = cpu_to_be16(numrecs); new->bb_numrecs = cpu_to_be16(numrecs);
if (cur->bc_flags & XFS_BTREE_LONG_PTRS) { if (cur->bc_flags & XFS_BTREE_LONG_PTRS) {
new->bb_u.l.bb_leftsib = cpu_to_be64(NULLFSBLOCK); new->bb_u.l.bb_leftsib = cpu_to_be64(NULLDFSBNO);
new->bb_u.l.bb_rightsib = cpu_to_be64(NULLFSBLOCK); new->bb_u.l.bb_rightsib = cpu_to_be64(NULLDFSBNO);
} else { } else {
new->bb_u.s.bb_leftsib = cpu_to_be32(NULLAGBLOCK); new->bb_u.s.bb_leftsib = cpu_to_be32(NULLAGBLOCK);
new->bb_u.s.bb_rightsib = cpu_to_be32(NULLAGBLOCK); new->bb_u.s.bb_rightsib = cpu_to_be32(NULLAGBLOCK);
...@@ -971,7 +971,7 @@ xfs_btree_ptr_to_daddr( ...@@ -971,7 +971,7 @@ xfs_btree_ptr_to_daddr(
union xfs_btree_ptr *ptr) union xfs_btree_ptr *ptr)
{ {
if (cur->bc_flags & XFS_BTREE_LONG_PTRS) { if (cur->bc_flags & XFS_BTREE_LONG_PTRS) {
ASSERT(be64_to_cpu(ptr->l) != NULLFSBLOCK); ASSERT(be64_to_cpu(ptr->l) != NULLDFSBNO);
return XFS_FSB_TO_DADDR(cur->bc_mp, be64_to_cpu(ptr->l)); return XFS_FSB_TO_DADDR(cur->bc_mp, be64_to_cpu(ptr->l));
} else { } else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment