public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* LEAFN node level is N -- bogus warning
@ 2006-09-12 16:22 Roger Willcocks
  2006-10-17  1:25 ` Barry Naujok
  0 siblings, 1 reply; 2+ messages in thread
From: Roger Willcocks @ 2006-09-12 16:22 UTC (permalink / raw)
  To: xfs


[-- Attachment #1.1: Type: text/plain, Size: 510 bytes --]

In xfs_repair / dir2.c there's a check for the 'level' of a directory leaf node within the btree hierarchy. A warning 'LEAFN node level is N' is generated if the level >= 1.

But leaf nodes don't have a /level/ member, although internal nodes do (compare xfs_dir2_leaf_hdr_t and xfs_da_intnode_t). xfs_repair is actually testing leaf->hdr.stale - so the warning is bogus.

The attached patch removes the test and make the relationship between magic numbers and pointer types more explicit.

--
Roger


[-- Attachment #1.2: Type: text/html, Size: 1314 bytes --]

[-- Attachment #2: dir2.patch --]
[-- Type: application/octet-stream, Size: 2637 bytes --]

--- dir2.c.~1.19.~      2006-06-30 15:38:12.000000000 +0100
+++ dir2.c      2006-09-12 17:04:44.000000000 +0100
@@ -258,5 +258,6 @@
        xfs_dabuf_t             *bp;
        int                     i;
        int                     nex;
+       xfs_da_blkinfo_t        *info;
        xfs_da_intnode_t        *node;
        bmap_ext_t              lbmp;

@@ -268,5 +269,5 @@
         */
        bno = mp->m_dirleafblk;
        i = -1;
-       node = NULL;
+       info = NULL;
        da_cursor->active = 0;

        do {
@@ -291,2 +292,2 @@
                        goto error_out;
                }

-               node = bp->data;
+               info = bp->data;

-               if (INT_GET(node->hdr.info.magic, ARCH_CONVERT) ==
+               if (INT_GET(info->magic, ARCH_CONVERT) ==
                                        XFS_DIR2_LEAFN_MAGIC)  {
                        if ( i != -1 ) {
                                do_warn(_("found non-root LEAFN node in inode "
                                          "%llu bno = %u\n"),
                                        da_cursor->ino, bno);
                        }
-                       if (INT_GET(node->hdr.level, ARCH_CONVERT) >= 1) {
-                               do_warn(_("LEAFN node level is %d inode %llu "
-                                         "bno = %u\n"),
-                                       INT_GET(node->hdr.level, ARCH_CONVERT),
-                                               da_cursor->ino, bno);
-                       }
                        *rbno = 0;
                        da_brelse(bp);
                        return(1);
-               } else if (INT_GET(node->hdr.info.magic, ARCH_CONVERT) !=
+               } else if (INT_GET(info->magic, ARCH_CONVERT) !=
                                        XFS_DA_NODE_MAGIC)  {
                        da_brelse(bp);
                        do_warn(_("bad dir magic number 0x%x in inode %llu "
                                  "bno = %u\n"),
-                               INT_GET(node->hdr.info.magic, ARCH_CONVERT),
+                               INT_GET(info->magic, ARCH_CONVERT),
                                        da_cursor->ino, bno);
                        goto error_out;
                }
+               node = bp->data;
+               ASSERT(INT_GET(node->hdr.info.magic, ARCH_CONVERT) ==
+                      XFS_DA_NODE_MAGIC);
                if (INT_GET(node->hdr.count, ARCH_CONVERT) >
                                                mp->m_dir_node_ents)  {
                        da_brelse(bp);

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

end of thread, other threads:[~2006-10-17  1:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-12 16:22 LEAFN node level is N -- bogus warning Roger Willcocks
2006-10-17  1:25 ` Barry Naujok

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