diff options
author | Dave Chinner <dchinner@redhat.com> | 2014-06-06 01:04:05 -0400 |
---|---|---|
committer | Dave Chinner <david@fromorbit.com> | 2014-06-06 01:04:05 -0400 |
commit | 892e3f342f9888066f1ce56f3683572f0ca9b8e9 (patch) | |
tree | 508f81ba0ec6727315dd4bd91e4754668ca7589c /fs/xfs/xfs_da_format.h | |
parent | 0650b55497ef583c43d6afc80e11a39e92d9a525 (diff) |
xfs: move directory block translatiosn to xfs_dir2_priv.h
Because they aren't actually part of the on-disk format, and so
shouldn't be in xfs_da_format.h.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/xfs/xfs_da_format.h')
-rw-r--r-- | fs/xfs/xfs_da_format.h | 138 |
1 files changed, 0 insertions, 138 deletions
diff --git a/fs/xfs/xfs_da_format.h b/fs/xfs/xfs_da_format.h index 1432b576b4a7..32b415ce7798 100644 --- a/fs/xfs/xfs_da_format.h +++ b/fs/xfs/xfs_da_format.h | |||
@@ -514,17 +514,6 @@ struct xfs_dir3_leaf { | |||
514 | #define XFS_DIR3_LEAF_CRC_OFF offsetof(struct xfs_dir3_leaf_hdr, info.crc) | 514 | #define XFS_DIR3_LEAF_CRC_OFF offsetof(struct xfs_dir3_leaf_hdr, info.crc) |
515 | 515 | ||
516 | /* | 516 | /* |
517 | * Get address of the bestcount field in the single-leaf block. | ||
518 | */ | ||
519 | static inline struct xfs_dir2_leaf_tail * | ||
520 | xfs_dir2_leaf_tail_p(struct xfs_mount *mp, struct xfs_dir2_leaf *lp) | ||
521 | { | ||
522 | return (struct xfs_dir2_leaf_tail *) | ||
523 | ((char *)lp + mp->m_dirblksize - | ||
524 | sizeof(struct xfs_dir2_leaf_tail)); | ||
525 | } | ||
526 | |||
527 | /* | ||
528 | * Get address of the bests array in the single-leaf block. | 517 | * Get address of the bests array in the single-leaf block. |
529 | */ | 518 | */ |
530 | static inline __be16 * | 519 | static inline __be16 * |
@@ -534,123 +523,6 @@ xfs_dir2_leaf_bests_p(struct xfs_dir2_leaf_tail *ltp) | |||
534 | } | 523 | } |
535 | 524 | ||
536 | /* | 525 | /* |
537 | * DB blocks here are logical directory block numbers, not filesystem blocks. | ||
538 | */ | ||
539 | |||
540 | /* | ||
541 | * Convert dataptr to byte in file space | ||
542 | */ | ||
543 | static inline xfs_dir2_off_t | ||
544 | xfs_dir2_dataptr_to_byte(xfs_dir2_dataptr_t dp) | ||
545 | { | ||
546 | return (xfs_dir2_off_t)dp << XFS_DIR2_DATA_ALIGN_LOG; | ||
547 | } | ||
548 | |||
549 | /* | ||
550 | * Convert byte in file space to dataptr. It had better be aligned. | ||
551 | */ | ||
552 | static inline xfs_dir2_dataptr_t | ||
553 | xfs_dir2_byte_to_dataptr(xfs_dir2_off_t by) | ||
554 | { | ||
555 | return (xfs_dir2_dataptr_t)(by >> XFS_DIR2_DATA_ALIGN_LOG); | ||
556 | } | ||
557 | |||
558 | /* | ||
559 | * Convert byte in space to (DB) block | ||
560 | */ | ||
561 | static inline xfs_dir2_db_t | ||
562 | xfs_dir2_byte_to_db(struct xfs_mount *mp, xfs_dir2_off_t by) | ||
563 | { | ||
564 | return (xfs_dir2_db_t) | ||
565 | (by >> (mp->m_sb.sb_blocklog + mp->m_sb.sb_dirblklog)); | ||
566 | } | ||
567 | |||
568 | /* | ||
569 | * Convert dataptr to a block number | ||
570 | */ | ||
571 | static inline xfs_dir2_db_t | ||
572 | xfs_dir2_dataptr_to_db(struct xfs_mount *mp, xfs_dir2_dataptr_t dp) | ||
573 | { | ||
574 | return xfs_dir2_byte_to_db(mp, xfs_dir2_dataptr_to_byte(dp)); | ||
575 | } | ||
576 | |||
577 | /* | ||
578 | * Convert byte in space to offset in a block | ||
579 | */ | ||
580 | static inline xfs_dir2_data_aoff_t | ||
581 | xfs_dir2_byte_to_off(struct xfs_mount *mp, xfs_dir2_off_t by) | ||
582 | { | ||
583 | return (xfs_dir2_data_aoff_t)(by & | ||
584 | ((1 << (mp->m_sb.sb_blocklog + mp->m_sb.sb_dirblklog)) - 1)); | ||
585 | } | ||
586 | |||
587 | /* | ||
588 | * Convert dataptr to a byte offset in a block | ||
589 | */ | ||
590 | static inline xfs_dir2_data_aoff_t | ||
591 | xfs_dir2_dataptr_to_off(struct xfs_mount *mp, xfs_dir2_dataptr_t dp) | ||
592 | { | ||
593 | return xfs_dir2_byte_to_off(mp, xfs_dir2_dataptr_to_byte(dp)); | ||
594 | } | ||
595 | |||
596 | /* | ||
597 | * Convert block and offset to byte in space | ||
598 | */ | ||
599 | static inline xfs_dir2_off_t | ||
600 | xfs_dir2_db_off_to_byte(struct xfs_mount *mp, xfs_dir2_db_t db, | ||
601 | xfs_dir2_data_aoff_t o) | ||
602 | { | ||
603 | return ((xfs_dir2_off_t)db << | ||
604 | (mp->m_sb.sb_blocklog + mp->m_sb.sb_dirblklog)) + o; | ||
605 | } | ||
606 | |||
607 | /* | ||
608 | * Convert block (DB) to block (dablk) | ||
609 | */ | ||
610 | static inline xfs_dablk_t | ||
611 | xfs_dir2_db_to_da(struct xfs_mount *mp, xfs_dir2_db_t db) | ||
612 | { | ||
613 | return (xfs_dablk_t)(db << mp->m_sb.sb_dirblklog); | ||
614 | } | ||
615 | |||
616 | /* | ||
617 | * Convert byte in space to (DA) block | ||
618 | */ | ||
619 | static inline xfs_dablk_t | ||
620 | xfs_dir2_byte_to_da(struct xfs_mount *mp, xfs_dir2_off_t by) | ||
621 | { | ||
622 | return xfs_dir2_db_to_da(mp, xfs_dir2_byte_to_db(mp, by)); | ||
623 | } | ||
624 | |||
625 | /* | ||
626 | * Convert block and offset to dataptr | ||
627 | */ | ||
628 | static inline xfs_dir2_dataptr_t | ||
629 | xfs_dir2_db_off_to_dataptr(struct xfs_mount *mp, xfs_dir2_db_t db, | ||
630 | xfs_dir2_data_aoff_t o) | ||
631 | { | ||
632 | return xfs_dir2_byte_to_dataptr(xfs_dir2_db_off_to_byte(mp, db, o)); | ||
633 | } | ||
634 | |||
635 | /* | ||
636 | * Convert block (dablk) to block (DB) | ||
637 | */ | ||
638 | static inline xfs_dir2_db_t | ||
639 | xfs_dir2_da_to_db(struct xfs_mount *mp, xfs_dablk_t da) | ||
640 | { | ||
641 | return (xfs_dir2_db_t)(da >> mp->m_sb.sb_dirblklog); | ||
642 | } | ||
643 | |||
644 | /* | ||
645 | * Convert block (dablk) to byte offset in space | ||
646 | */ | ||
647 | static inline xfs_dir2_off_t | ||
648 | xfs_dir2_da_to_byte(struct xfs_mount *mp, xfs_dablk_t da) | ||
649 | { | ||
650 | return xfs_dir2_db_off_to_byte(mp, xfs_dir2_da_to_db(mp, da), 0); | ||
651 | } | ||
652 | |||
653 | /* | ||
654 | * Free space block defintions for the node format. | 526 | * Free space block defintions for the node format. |
655 | */ | 527 | */ |
656 | 528 | ||
@@ -736,16 +608,6 @@ typedef struct xfs_dir2_block_tail { | |||
736 | } xfs_dir2_block_tail_t; | 608 | } xfs_dir2_block_tail_t; |
737 | 609 | ||
738 | /* | 610 | /* |
739 | * Pointer to the leaf header embedded in a data block (1-block format) | ||
740 | */ | ||
741 | static inline struct xfs_dir2_block_tail * | ||
742 | xfs_dir2_block_tail_p(struct xfs_mount *mp, struct xfs_dir2_data_hdr *hdr) | ||
743 | { | ||
744 | return ((struct xfs_dir2_block_tail *) | ||
745 | ((char *)hdr + mp->m_dirblksize)) - 1; | ||
746 | } | ||
747 | |||
748 | /* | ||
749 | * Pointer to the leaf entries embedded in a data block (1-block format) | 611 | * Pointer to the leaf entries embedded in a data block (1-block format) |
750 | */ | 612 | */ |
751 | static inline struct xfs_dir2_leaf_entry * | 613 | static inline struct xfs_dir2_leaf_entry * |