diff options
author | Alex Elder <aelder@sgi.com> | 2010-04-20 03:09:59 -0400 |
---|---|---|
committer | Alex Elder <aelder@sgi.com> | 2010-05-19 10:58:15 -0400 |
commit | 69ce58f08a3c455ff74cfcde90e9ab267d67f636 (patch) | |
tree | 0a5a8be3222d8138f382b492b96888c61041dd76 /fs/xfs/xfs_log_recover.c | |
parent | 1414a6046ab402ac21545522270c32c576327eb9 (diff) |
xfs: record log sector size rather than log2(that)
Change struct log so it keeps track of the size (in basic blocks) of
a log sector in l_sectBBsize rather than the log-base-2 of that
value (previously, l_sectbb_log). The name was chosen for
consistency with the other fields in the structure that represent
a number of basic blocks.
(Updated so that a variable used in computing and verifying a log's
sector size is named "log2_size". Also added the "BB" to the
structure field name, based on feedback from Eric Sandeen. Also
dropped some superfluous parentheses.)
Signed-off-by: Alex Elder <aelder@sgi.com>
Reviewed-by: Eric Sandeen <sandeen@sandeen.net>
Diffstat (limited to 'fs/xfs/xfs_log_recover.c')
-rw-r--r-- | fs/xfs/xfs_log_recover.c | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c index e5b74db5d2e0..f1220ec1896f 100644 --- a/fs/xfs/xfs_log_recover.c +++ b/fs/xfs/xfs_log_recover.c | |||
@@ -60,9 +60,6 @@ STATIC void xlog_recover_check_summary(xlog_t *); | |||
60 | * Sector aligned buffer routines for buffer create/read/write/access | 60 | * Sector aligned buffer routines for buffer create/read/write/access |
61 | */ | 61 | */ |
62 | 62 | ||
63 | /* Number of basic blocks in a log sector */ | ||
64 | #define xlog_sectbb(log) (1 << (log)->l_sectbb_log) | ||
65 | |||
66 | /* | 63 | /* |
67 | * Verify the given count of basic blocks is valid number of blocks | 64 | * Verify the given count of basic blocks is valid number of blocks |
68 | * to specify for an operation involving the given XFS log buffer. | 65 | * to specify for an operation involving the given XFS log buffer. |
@@ -110,9 +107,9 @@ xlog_get_bp( | |||
110 | * extend the buffer by one extra log sector to ensure | 107 | * extend the buffer by one extra log sector to ensure |
111 | * there's space to accomodate this possiblility. | 108 | * there's space to accomodate this possiblility. |
112 | */ | 109 | */ |
113 | if (nbblks > 1 && log->l_sectbb_log) | 110 | if (nbblks > 1 && log->l_sectBBsize > 1) |
114 | nbblks += xlog_sectbb(log); | 111 | nbblks += log->l_sectBBsize; |
115 | nbblks = round_up(nbblks, xlog_sectbb(log)); | 112 | nbblks = round_up(nbblks, log->l_sectBBsize); |
116 | 113 | ||
117 | return xfs_buf_get_noaddr(BBTOB(nbblks), log->l_mp->m_logdev_targp); | 114 | return xfs_buf_get_noaddr(BBTOB(nbblks), log->l_mp->m_logdev_targp); |
118 | } | 115 | } |
@@ -133,7 +130,7 @@ xlog_align( | |||
133 | { | 130 | { |
134 | xfs_caddr_t ptr; | 131 | xfs_caddr_t ptr; |
135 | 132 | ||
136 | if (!log->l_sectbb_log) | 133 | if (log->l_sectBBsize == 1) |
137 | return XFS_BUF_PTR(bp); | 134 | return XFS_BUF_PTR(bp); |
138 | 135 | ||
139 | ptr = XFS_BUF_PTR(bp) + BBTOB((int)blk_no & log->l_sectbb_mask); | 136 | ptr = XFS_BUF_PTR(bp) + BBTOB((int)blk_no & log->l_sectbb_mask); |
@@ -162,8 +159,8 @@ xlog_bread_noalign( | |||
162 | return EFSCORRUPTED; | 159 | return EFSCORRUPTED; |
163 | } | 160 | } |
164 | 161 | ||
165 | blk_no = round_down(blk_no, xlog_sectbb(log)); | 162 | blk_no = round_down(blk_no, log->l_sectBBsize); |
166 | nbblks = round_up(nbblks, xlog_sectbb(log)); | 163 | nbblks = round_up(nbblks, log->l_sectBBsize); |
167 | 164 | ||
168 | ASSERT(nbblks > 0); | 165 | ASSERT(nbblks > 0); |
169 | ASSERT(BBTOB(nbblks) <= XFS_BUF_SIZE(bp)); | 166 | ASSERT(BBTOB(nbblks) <= XFS_BUF_SIZE(bp)); |
@@ -221,8 +218,8 @@ xlog_bwrite( | |||
221 | return EFSCORRUPTED; | 218 | return EFSCORRUPTED; |
222 | } | 219 | } |
223 | 220 | ||
224 | blk_no = round_down(blk_no, xlog_sectbb(log)); | 221 | blk_no = round_down(blk_no, log->l_sectBBsize); |
225 | nbblks = round_up(nbblks, xlog_sectbb(log)); | 222 | nbblks = round_up(nbblks, log->l_sectBBsize); |
226 | 223 | ||
227 | ASSERT(nbblks > 0); | 224 | ASSERT(nbblks > 0); |
228 | ASSERT(BBTOB(nbblks) <= XFS_BUF_SIZE(bp)); | 225 | ASSERT(BBTOB(nbblks) <= XFS_BUF_SIZE(bp)); |
@@ -410,7 +407,7 @@ xlog_find_verify_cycle( | |||
410 | bufblks = 1 << ffs(nbblks); | 407 | bufblks = 1 << ffs(nbblks); |
411 | while (!(bp = xlog_get_bp(log, bufblks))) { | 408 | while (!(bp = xlog_get_bp(log, bufblks))) { |
412 | bufblks >>= 1; | 409 | bufblks >>= 1; |
413 | if (bufblks < xlog_sectbb(log)) | 410 | if (bufblks < log->l_sectBBsize) |
414 | return ENOMEM; | 411 | return ENOMEM; |
415 | } | 412 | } |
416 | 413 | ||
@@ -1181,7 +1178,7 @@ xlog_write_log_records( | |||
1181 | xfs_caddr_t offset; | 1178 | xfs_caddr_t offset; |
1182 | xfs_buf_t *bp; | 1179 | xfs_buf_t *bp; |
1183 | int balign, ealign; | 1180 | int balign, ealign; |
1184 | int sectbb = xlog_sectbb(log); | 1181 | int sectbb = log->l_sectBBsize; |
1185 | int end_block = start_block + blocks; | 1182 | int end_block = start_block + blocks; |
1186 | int bufblks; | 1183 | int bufblks; |
1187 | int error = 0; | 1184 | int error = 0; |
@@ -1196,7 +1193,7 @@ xlog_write_log_records( | |||
1196 | bufblks = 1 << ffs(blocks); | 1193 | bufblks = 1 << ffs(blocks); |
1197 | while (!(bp = xlog_get_bp(log, bufblks))) { | 1194 | while (!(bp = xlog_get_bp(log, bufblks))) { |
1198 | bufblks >>= 1; | 1195 | bufblks >>= 1; |
1199 | if (bufblks < xlog_sectbb(log)) | 1196 | if (bufblks < sectbb) |
1200 | return ENOMEM; | 1197 | return ENOMEM; |
1201 | } | 1198 | } |
1202 | 1199 | ||
@@ -3515,7 +3512,7 @@ xlog_do_recovery_pass( | |||
3515 | hblks = 1; | 3512 | hblks = 1; |
3516 | } | 3513 | } |
3517 | } else { | 3514 | } else { |
3518 | ASSERT(log->l_sectbb_log == 0); | 3515 | ASSERT(log->l_sectBBsize == 1); |
3519 | hblks = 1; | 3516 | hblks = 1; |
3520 | hbp = xlog_get_bp(log, 1); | 3517 | hbp = xlog_get_bp(log, 1); |
3521 | h_size = XLOG_BIG_RECORD_BSIZE; | 3518 | h_size = XLOG_BIG_RECORD_BSIZE; |