]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blobdiff - db/frag.c
misc: fix libxfs api violations
[thirdparty/xfsprogs-dev.git] / db / frag.c
index 3beb4168b8e8287168b39249d930d15ac506bc25..8005e45dfbaf8ada66e3d5555728af7b6ec9dcfc 100644 (file)
--- a/db/frag.c
+++ b/db/frag.c
@@ -172,6 +172,10 @@ frag_f(
                answer = 0.0;
        dbprintf(_("actual %llu, ideal %llu, fragmentation factor %.2f%%\n"),
                extcount_actual, extcount_ideal, answer);
+       dbprintf(_("Note, this number is largely meaningless.\n"));
+       answer = (double)extcount_actual / (double)extcount_ideal;
+       dbprintf(_("Files on this filesystem average %.2f extents per file\n"),
+               answer);
        return 0;
 }
 
@@ -256,10 +260,10 @@ process_btinode(
                return;
        }
        pp = XFS_BMDR_PTR_ADDR(dib, 1,
-               xfs_bmdr_maxrecs(XFS_DFORK_SIZE(dip, mp, whichfork), 0));
+               libxfs_bmdr_maxrecs(XFS_DFORK_SIZE(dip, mp, whichfork), 0));
        for (i = 0; i < be16_to_cpu(dib->bb_numrecs); i++)
-               scan_lbtree(be64_to_cpu(pp[i]), be16_to_cpu(dib->bb_level),
-                       scanfunc_bmap, extmapp,
+               scan_lbtree(get_unaligned_be64(&pp[i]),
+                        be16_to_cpu(dib->bb_level), scanfunc_bmap, extmapp,
                        whichfork == XFS_DATA_FORK ? TYP_BMAPBTD : TYP_BMAPBTA);
 }