diff options
author | Dave Chinner <dchinner@redhat.com> | 2014-06-06 01:06:53 -0400 |
---|---|---|
committer | Dave Chinner <david@fromorbit.com> | 2014-06-06 01:06:53 -0400 |
commit | 9b3b5522d3f55215ce51c87b0467926c57a6f182 (patch) | |
tree | df132e36493de332a7435211d5b982fcc9049445 /fs/xfs | |
parent | 8c44a28561625d36591cc1540eb5f9033a9d1815 (diff) |
xfs: convert dir byte/off conversion to xfs_da_geometry
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')
-rw-r--r-- | fs/xfs/xfs_dir2.c | 2 | ||||
-rw-r--r-- | fs/xfs/xfs_dir2_priv.h | 18 | ||||
-rw-r--r-- | fs/xfs/xfs_dir2_readdir.c | 7 |
3 files changed, 14 insertions, 13 deletions
diff --git a/fs/xfs/xfs_dir2.c b/fs/xfs/xfs_dir2.c index 08dfcd1e5e00..2047ef1ce8d2 100644 --- a/fs/xfs/xfs_dir2.c +++ b/fs/xfs/xfs_dir2.c | |||
@@ -749,7 +749,7 @@ xfs_dir2_shrink_inode( | |||
749 | /* | 749 | /* |
750 | * If the block isn't the last one in the directory, we're done. | 750 | * If the block isn't the last one in the directory, we're done. |
751 | */ | 751 | */ |
752 | if (dp->i_d.di_size > xfs_dir2_db_off_to_byte(mp, db + 1, 0)) | 752 | if (dp->i_d.di_size > xfs_dir2_db_off_to_byte(args->geo, db + 1, 0)) |
753 | return 0; | 753 | return 0; |
754 | bno = da; | 754 | bno = da; |
755 | if ((error = xfs_bmap_last_before(tp, dp, &bno, XFS_DATA_FORK))) { | 755 | if ((error = xfs_bmap_last_before(tp, dp, &bno, XFS_DATA_FORK))) { |
diff --git a/fs/xfs/xfs_dir2_priv.h b/fs/xfs/xfs_dir2_priv.h index 492edb6e07a7..683828942de1 100644 --- a/fs/xfs/xfs_dir2_priv.h +++ b/fs/xfs/xfs_dir2_priv.h | |||
@@ -67,10 +67,9 @@ xfs_dir2_dataptr_to_db(struct xfs_mount *mp, xfs_dir2_dataptr_t dp) | |||
67 | * Convert byte in space to offset in a block | 67 | * Convert byte in space to offset in a block |
68 | */ | 68 | */ |
69 | static inline xfs_dir2_data_aoff_t | 69 | static inline xfs_dir2_data_aoff_t |
70 | xfs_dir2_byte_to_off(struct xfs_mount *mp, xfs_dir2_off_t by) | 70 | xfs_dir2_byte_to_off(struct xfs_da_geometry *geo, xfs_dir2_off_t by) |
71 | { | 71 | { |
72 | return (xfs_dir2_data_aoff_t)(by & | 72 | return (xfs_dir2_data_aoff_t)(by & (geo->blksize - 1)); |
73 | ((1 << (mp->m_sb.sb_blocklog + mp->m_sb.sb_dirblklog)) - 1)); | ||
74 | } | 73 | } |
75 | 74 | ||
76 | /* | 75 | /* |
@@ -79,18 +78,17 @@ xfs_dir2_byte_to_off(struct xfs_mount *mp, xfs_dir2_off_t by) | |||
79 | static inline xfs_dir2_data_aoff_t | 78 | static inline xfs_dir2_data_aoff_t |
80 | xfs_dir2_dataptr_to_off(struct xfs_mount *mp, xfs_dir2_dataptr_t dp) | 79 | xfs_dir2_dataptr_to_off(struct xfs_mount *mp, xfs_dir2_dataptr_t dp) |
81 | { | 80 | { |
82 | return xfs_dir2_byte_to_off(mp, xfs_dir2_dataptr_to_byte(dp)); | 81 | return xfs_dir2_byte_to_off(mp->m_dir_geo, xfs_dir2_dataptr_to_byte(dp)); |
83 | } | 82 | } |
84 | 83 | ||
85 | /* | 84 | /* |
86 | * Convert block and offset to byte in space | 85 | * Convert block and offset to byte in space |
87 | */ | 86 | */ |
88 | static inline xfs_dir2_off_t | 87 | static inline xfs_dir2_off_t |
89 | xfs_dir2_db_off_to_byte(struct xfs_mount *mp, xfs_dir2_db_t db, | 88 | xfs_dir2_db_off_to_byte(struct xfs_da_geometry *geo, xfs_dir2_db_t db, |
90 | xfs_dir2_data_aoff_t o) | 89 | xfs_dir2_data_aoff_t o) |
91 | { | 90 | { |
92 | return ((xfs_dir2_off_t)db << | 91 | return ((xfs_dir2_off_t)db << geo->blklog) + o; |
93 | (mp->m_sb.sb_blocklog + mp->m_sb.sb_dirblklog)) + o; | ||
94 | } | 92 | } |
95 | 93 | ||
96 | /* | 94 | /* |
@@ -118,7 +116,8 @@ static inline xfs_dir2_dataptr_t | |||
118 | xfs_dir2_db_off_to_dataptr(struct xfs_mount *mp, xfs_dir2_db_t db, | 116 | xfs_dir2_db_off_to_dataptr(struct xfs_mount *mp, xfs_dir2_db_t db, |
119 | xfs_dir2_data_aoff_t o) | 117 | xfs_dir2_data_aoff_t o) |
120 | { | 118 | { |
121 | return xfs_dir2_byte_to_dataptr(xfs_dir2_db_off_to_byte(mp, db, o)); | 119 | return xfs_dir2_byte_to_dataptr( |
120 | xfs_dir2_db_off_to_byte(mp->m_dir_geo, db, o)); | ||
122 | } | 121 | } |
123 | 122 | ||
124 | /* | 123 | /* |
@@ -136,7 +135,8 @@ xfs_dir2_da_to_db(struct xfs_mount *mp, xfs_dablk_t da) | |||
136 | static inline xfs_dir2_off_t | 135 | static inline xfs_dir2_off_t |
137 | xfs_dir2_da_to_byte(struct xfs_mount *mp, xfs_dablk_t da) | 136 | xfs_dir2_da_to_byte(struct xfs_mount *mp, xfs_dablk_t da) |
138 | { | 137 | { |
139 | return xfs_dir2_db_off_to_byte(mp, xfs_dir2_da_to_db(mp, da), 0); | 138 | return xfs_dir2_db_off_to_byte(mp->m_dir_geo, |
139 | xfs_dir2_da_to_db(mp, da), 0); | ||
140 | } | 140 | } |
141 | 141 | ||
142 | /* | 142 | /* |
diff --git a/fs/xfs/xfs_dir2_readdir.c b/fs/xfs/xfs_dir2_readdir.c index bf7a5cee7adc..ec912c8f1891 100644 --- a/fs/xfs/xfs_dir2_readdir.c +++ b/fs/xfs/xfs_dir2_readdir.c | |||
@@ -560,7 +560,8 @@ xfs_dir2_leaf_getdents( | |||
560 | /* | 560 | /* |
561 | * Having done a read, we need to set a new offset. | 561 | * Having done a read, we need to set a new offset. |
562 | */ | 562 | */ |
563 | newoff = xfs_dir2_db_off_to_byte(mp, map_info->curdb, 0); | 563 | newoff = xfs_dir2_db_off_to_byte(mp->m_dir_geo, |
564 | map_info->curdb, 0); | ||
564 | /* | 565 | /* |
565 | * Start of the current block. | 566 | * Start of the current block. |
566 | */ | 567 | */ |
@@ -578,7 +579,7 @@ xfs_dir2_leaf_getdents( | |||
578 | * Find our position in the block. | 579 | * Find our position in the block. |
579 | */ | 580 | */ |
580 | ptr = (char *)dp->d_ops->data_entry_p(hdr); | 581 | ptr = (char *)dp->d_ops->data_entry_p(hdr); |
581 | byteoff = xfs_dir2_byte_to_off(mp, curoff); | 582 | byteoff = xfs_dir2_byte_to_off(mp->m_dir_geo, curoff); |
582 | /* | 583 | /* |
583 | * Skip past the header. | 584 | * Skip past the header. |
584 | */ | 585 | */ |
@@ -607,7 +608,7 @@ xfs_dir2_leaf_getdents( | |||
607 | * Now set our real offset. | 608 | * Now set our real offset. |
608 | */ | 609 | */ |
609 | curoff = | 610 | curoff = |
610 | xfs_dir2_db_off_to_byte(mp, | 611 | xfs_dir2_db_off_to_byte(mp->m_dir_geo, |
611 | xfs_dir2_byte_to_db(mp, curoff), | 612 | xfs_dir2_byte_to_db(mp, curoff), |
612 | (char *)ptr - (char *)hdr); | 613 | (char *)ptr - (char *)hdr); |
613 | if (ptr >= (char *)hdr + mp->m_dirblksize) { | 614 | if (ptr >= (char *)hdr + mp->m_dirblksize) { |