diff options
Diffstat (limited to 'fs/xfs/libxfs/xfs_ialloc.c')
-rw-r--r-- | fs/xfs/libxfs/xfs_ialloc.c | 90 |
1 files changed, 0 insertions, 90 deletions
diff --git a/fs/xfs/libxfs/xfs_ialloc.c b/fs/xfs/libxfs/xfs_ialloc.c index 3f551eb29157..8ec39dad62d7 100644 --- a/fs/xfs/libxfs/xfs_ialloc.c +++ b/fs/xfs/libxfs/xfs_ialloc.c | |||
@@ -2674,96 +2674,6 @@ xfs_ialloc_pagi_init( | |||
2674 | return 0; | 2674 | return 0; |
2675 | } | 2675 | } |
2676 | 2676 | ||
2677 | /* Calculate the first and last possible inode number in an AG. */ | ||
2678 | void | ||
2679 | xfs_ialloc_agino_range( | ||
2680 | struct xfs_mount *mp, | ||
2681 | xfs_agnumber_t agno, | ||
2682 | xfs_agino_t *first, | ||
2683 | xfs_agino_t *last) | ||
2684 | { | ||
2685 | xfs_agblock_t bno; | ||
2686 | xfs_agblock_t eoag; | ||
2687 | |||
2688 | eoag = xfs_ag_block_count(mp, agno); | ||
2689 | |||
2690 | /* | ||
2691 | * Calculate the first inode, which will be in the first | ||
2692 | * cluster-aligned block after the AGFL. | ||
2693 | */ | ||
2694 | bno = round_up(XFS_AGFL_BLOCK(mp) + 1, | ||
2695 | xfs_ialloc_cluster_alignment(mp)); | ||
2696 | *first = XFS_OFFBNO_TO_AGINO(mp, bno, 0); | ||
2697 | |||
2698 | /* | ||
2699 | * Calculate the last inode, which will be at the end of the | ||
2700 | * last (aligned) cluster that can be allocated in the AG. | ||
2701 | */ | ||
2702 | bno = round_down(eoag, xfs_ialloc_cluster_alignment(mp)); | ||
2703 | *last = XFS_OFFBNO_TO_AGINO(mp, bno, 0) - 1; | ||
2704 | } | ||
2705 | |||
2706 | /* | ||
2707 | * Verify that an AG inode number pointer neither points outside the AG | ||
2708 | * nor points at static metadata. | ||
2709 | */ | ||
2710 | bool | ||
2711 | xfs_verify_agino( | ||
2712 | struct xfs_mount *mp, | ||
2713 | xfs_agnumber_t agno, | ||
2714 | xfs_agino_t agino) | ||
2715 | { | ||
2716 | xfs_agino_t first; | ||
2717 | xfs_agino_t last; | ||
2718 | |||
2719 | xfs_ialloc_agino_range(mp, agno, &first, &last); | ||
2720 | return agino >= first && agino <= last; | ||
2721 | } | ||
2722 | |||
2723 | /* | ||
2724 | * Verify that an FS inode number pointer neither points outside the | ||
2725 | * filesystem nor points at static AG metadata. | ||
2726 | */ | ||
2727 | bool | ||
2728 | xfs_verify_ino( | ||
2729 | struct xfs_mount *mp, | ||
2730 | xfs_ino_t ino) | ||
2731 | { | ||
2732 | xfs_agnumber_t agno = XFS_INO_TO_AGNO(mp, ino); | ||
2733 | xfs_agino_t agino = XFS_INO_TO_AGINO(mp, ino); | ||
2734 | |||
2735 | if (agno >= mp->m_sb.sb_agcount) | ||
2736 | return false; | ||
2737 | if (XFS_AGINO_TO_INO(mp, agno, agino) != ino) | ||
2738 | return false; | ||
2739 | return xfs_verify_agino(mp, agno, agino); | ||
2740 | } | ||
2741 | |||
2742 | /* Is this an internal inode number? */ | ||
2743 | bool | ||
2744 | xfs_internal_inum( | ||
2745 | struct xfs_mount *mp, | ||
2746 | xfs_ino_t ino) | ||
2747 | { | ||
2748 | return ino == mp->m_sb.sb_rbmino || ino == mp->m_sb.sb_rsumino || | ||
2749 | (xfs_sb_version_hasquota(&mp->m_sb) && | ||
2750 | xfs_is_quota_inode(&mp->m_sb, ino)); | ||
2751 | } | ||
2752 | |||
2753 | /* | ||
2754 | * Verify that a directory entry's inode number doesn't point at an internal | ||
2755 | * inode, empty space, or static AG metadata. | ||
2756 | */ | ||
2757 | bool | ||
2758 | xfs_verify_dir_ino( | ||
2759 | struct xfs_mount *mp, | ||
2760 | xfs_ino_t ino) | ||
2761 | { | ||
2762 | if (xfs_internal_inum(mp, ino)) | ||
2763 | return false; | ||
2764 | return xfs_verify_ino(mp, ino); | ||
2765 | } | ||
2766 | |||
2767 | /* Is there an inode record covering a given range of inode numbers? */ | 2677 | /* Is there an inode record covering a given range of inode numbers? */ |
2768 | int | 2678 | int |
2769 | xfs_ialloc_has_inode_record( | 2679 | xfs_ialloc_has_inode_record( |