diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/xfs/xfs_log_recover.c | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c index 2813a6ef15bb..0e51bdd910a7 100644 --- a/fs/xfs/xfs_log_recover.c +++ b/fs/xfs/xfs_log_recover.c | |||
@@ -56,7 +56,6 @@ STATIC void xlog_recover_check_summary(xlog_t *); | |||
56 | #define xlog_recover_check_summary(log) | 56 | #define xlog_recover_check_summary(log) |
57 | #endif | 57 | #endif |
58 | 58 | ||
59 | |||
60 | /* | 59 | /* |
61 | * Sector aligned buffer routines for buffer create/read/write/access | 60 | * Sector aligned buffer routines for buffer create/read/write/access |
62 | */ | 61 | */ |
@@ -64,10 +63,6 @@ STATIC void xlog_recover_check_summary(xlog_t *); | |||
64 | /* Number of basic blocks in a log sector */ | 63 | /* Number of basic blocks in a log sector */ |
65 | #define xlog_sectbb(log) (1 << (log)->l_sectbb_log) | 64 | #define xlog_sectbb(log) (1 << (log)->l_sectbb_log) |
66 | 65 | ||
67 | #define XLOG_SECTOR_ROUNDUP_BBCOUNT(log, bbs) round_up((bbs), xlog_sectbb(log)) | ||
68 | #define XLOG_SECTOR_ROUNDDOWN_BLKNO(log, bno) \ | ||
69 | round_down((bno), xlog_sectbb(log)) | ||
70 | |||
71 | STATIC xfs_buf_t * | 66 | STATIC xfs_buf_t * |
72 | xlog_get_bp( | 67 | xlog_get_bp( |
73 | xlog_t *log, | 68 | xlog_t *log, |
@@ -82,8 +77,8 @@ xlog_get_bp( | |||
82 | 77 | ||
83 | if (log->l_sectbb_log) { | 78 | if (log->l_sectbb_log) { |
84 | if (nbblks > 1) | 79 | if (nbblks > 1) |
85 | nbblks += XLOG_SECTOR_ROUNDUP_BBCOUNT(log, 1); | 80 | nbblks += xlog_sectbb(log); |
86 | nbblks = XLOG_SECTOR_ROUNDUP_BBCOUNT(log, nbblks); | 81 | nbblks = round_up(nbblks, xlog_sectbb(log)); |
87 | } | 82 | } |
88 | return xfs_buf_get_noaddr(BBTOB(nbblks), log->l_mp->m_logdev_targp); | 83 | return xfs_buf_get_noaddr(BBTOB(nbblks), log->l_mp->m_logdev_targp); |
89 | } | 84 | } |
@@ -134,8 +129,8 @@ xlog_bread_noalign( | |||
134 | } | 129 | } |
135 | 130 | ||
136 | if (log->l_sectbb_log) { | 131 | if (log->l_sectbb_log) { |
137 | blk_no = XLOG_SECTOR_ROUNDDOWN_BLKNO(log, blk_no); | 132 | blk_no = round_down(blk_no, xlog_sectbb(log)); |
138 | nbblks = XLOG_SECTOR_ROUNDUP_BBCOUNT(log, nbblks); | 133 | nbblks = round_up(nbblks, xlog_sectbb(log)); |
139 | } | 134 | } |
140 | 135 | ||
141 | ASSERT(nbblks > 0); | 136 | ASSERT(nbblks > 0); |
@@ -196,8 +191,8 @@ xlog_bwrite( | |||
196 | } | 191 | } |
197 | 192 | ||
198 | if (log->l_sectbb_log) { | 193 | if (log->l_sectbb_log) { |
199 | blk_no = XLOG_SECTOR_ROUNDDOWN_BLKNO(log, blk_no); | 194 | blk_no = round_down(blk_no, xlog_sectbb(log)); |
200 | nbblks = XLOG_SECTOR_ROUNDUP_BBCOUNT(log, nbblks); | 195 | nbblks = round_up(nbblks, xlog_sectbb(log)); |
201 | } | 196 | } |
202 | 197 | ||
203 | ASSERT(nbblks > 0); | 198 | ASSERT(nbblks > 0); |
@@ -1158,7 +1153,7 @@ xlog_write_log_records( | |||
1158 | xfs_caddr_t offset; | 1153 | xfs_caddr_t offset; |
1159 | xfs_buf_t *bp; | 1154 | xfs_buf_t *bp; |
1160 | int balign, ealign; | 1155 | int balign, ealign; |
1161 | int sectbb = XLOG_SECTOR_ROUNDUP_BBCOUNT(log, 1); | 1156 | int sectbb = xlog_sectbb(log); |
1162 | int end_block = start_block + blocks; | 1157 | int end_block = start_block + blocks; |
1163 | int bufblks; | 1158 | int bufblks; |
1164 | int error = 0; | 1159 | int error = 0; |
@@ -1181,7 +1176,7 @@ xlog_write_log_records( | |||
1181 | * the buffer in the starting sector not covered by the first | 1176 | * the buffer in the starting sector not covered by the first |
1182 | * write below. | 1177 | * write below. |
1183 | */ | 1178 | */ |
1184 | balign = XLOG_SECTOR_ROUNDDOWN_BLKNO(log, start_block); | 1179 | balign = round_down(start_block, sectbb); |
1185 | if (balign != start_block) { | 1180 | if (balign != start_block) { |
1186 | error = xlog_bread_noalign(log, start_block, 1, bp); | 1181 | error = xlog_bread_noalign(log, start_block, 1, bp); |
1187 | if (error) | 1182 | if (error) |
@@ -1200,7 +1195,7 @@ xlog_write_log_records( | |||
1200 | * the buffer in the final sector not covered by the write. | 1195 | * the buffer in the final sector not covered by the write. |
1201 | * If this is the same sector as the above read, skip it. | 1196 | * If this is the same sector as the above read, skip it. |
1202 | */ | 1197 | */ |
1203 | ealign = XLOG_SECTOR_ROUNDDOWN_BLKNO(log, end_block); | 1198 | ealign = round_down(end_block, sectbb); |
1204 | if (j == 0 && (start_block + endcount > ealign)) { | 1199 | if (j == 0 && (start_block + endcount > ealign)) { |
1205 | offset = XFS_BUF_PTR(bp); | 1200 | offset = XFS_BUF_PTR(bp); |
1206 | balign = BBTOB(ealign - start_block); | 1201 | balign = BBTOB(ealign - start_block); |