aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_log_recover.c
diff options
context:
space:
mode:
authorDave Chinner <david@fromorbit.com>2012-04-23 01:58:52 -0400
committerBen Myers <bpm@sgi.com>2012-05-14 17:20:48 -0400
commitaa0e8833b05cbd9d34d6a1ddaf23a74a58d76a03 (patch)
tree72592f1fec3df30dea526f793416b56b8d133234 /fs/xfs/xfs_log_recover.c
parent4e94b71b7068b4bd9c615301197e09dbf0c3b770 (diff)
xfs: use blocks for storing the desired IO size
Now that we pass block counts everywhere, and index buffers by block number and length in units of blocks, convert the desired IO size into block counts rather than bytes. Convert the code to use block counts, and those that need byte counts get converted at the time of use. Rename the b_desired_count variable to something closer to it's purpose - b_io_length - as it is only used to specify the length of an IO for a subset of the buffer. The only time this is used is for log IO - both writing iclogs and during log recovery. In all other cases, the b_io_length matches b_length, and hence a lot of code confuses the two. e.g. the buf item code uses the io count exclusively when it should be using the buffer length. Fix these apprpriately as they are found. Also, remove the XFS_BUF_{SET_}COUNT() macros that are just wrappers around the desired IO length. They only serve to make the code shouty loud, don't actually add any real value, and are often used incorrectly. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Mark Tinguely <tinguely@sgi.com> Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_log_recover.c')
-rw-r--r--fs/xfs/xfs_log_recover.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
index 24f59a25ecdd..8c826b00aac1 100644
--- a/fs/xfs/xfs_log_recover.c
+++ b/fs/xfs/xfs_log_recover.c
@@ -178,7 +178,7 @@ xlog_bread_noalign(
178 178
179 XFS_BUF_SET_ADDR(bp, log->l_logBBstart + blk_no); 179 XFS_BUF_SET_ADDR(bp, log->l_logBBstart + blk_no);
180 XFS_BUF_READ(bp); 180 XFS_BUF_READ(bp);
181 XFS_BUF_SET_COUNT(bp, BBTOB(nbblks)); 181 bp->b_io_length = nbblks;
182 bp->b_error = 0; 182 bp->b_error = 0;
183 183
184 xfsbdstrat(log->l_mp, bp); 184 xfsbdstrat(log->l_mp, bp);
@@ -266,7 +266,7 @@ xlog_bwrite(
266 XFS_BUF_ZEROFLAGS(bp); 266 XFS_BUF_ZEROFLAGS(bp);
267 xfs_buf_hold(bp); 267 xfs_buf_hold(bp);
268 xfs_buf_lock(bp); 268 xfs_buf_lock(bp);
269 XFS_BUF_SET_COUNT(bp, BBTOB(nbblks)); 269 bp->b_io_length = nbblks;
270 bp->b_error = 0; 270 bp->b_error = 0;
271 271
272 error = xfs_bwrite(bp); 272 error = xfs_bwrite(bp);
@@ -1778,7 +1778,7 @@ xlog_recover_do_inode_buffer(
1778 1778
1779 trace_xfs_log_recover_buf_inode_buf(mp->m_log, buf_f); 1779 trace_xfs_log_recover_buf_inode_buf(mp->m_log, buf_f);
1780 1780
1781 inodes_per_buf = XFS_BUF_COUNT(bp) >> mp->m_sb.sb_inodelog; 1781 inodes_per_buf = BBTOB(bp->b_io_length) >> mp->m_sb.sb_inodelog;
1782 for (i = 0; i < inodes_per_buf; i++) { 1782 for (i = 0; i < inodes_per_buf; i++) {
1783 next_unlinked_offset = (i * mp->m_sb.sb_inodesize) + 1783 next_unlinked_offset = (i * mp->m_sb.sb_inodesize) +
1784 offsetof(xfs_dinode_t, di_next_unlinked); 1784 offsetof(xfs_dinode_t, di_next_unlinked);
@@ -1820,7 +1820,8 @@ xlog_recover_do_inode_buffer(
1820 1820
1821 ASSERT(item->ri_buf[item_index].i_addr != NULL); 1821 ASSERT(item->ri_buf[item_index].i_addr != NULL);
1822 ASSERT((item->ri_buf[item_index].i_len % XFS_BLF_CHUNK) == 0); 1822 ASSERT((item->ri_buf[item_index].i_len % XFS_BLF_CHUNK) == 0);
1823 ASSERT((reg_buf_offset + reg_buf_bytes) <= XFS_BUF_COUNT(bp)); 1823 ASSERT((reg_buf_offset + reg_buf_bytes) <=
1824 BBTOB(bp->b_io_length));
1824 1825
1825 /* 1826 /*
1826 * The current logged region contains a copy of the 1827 * The current logged region contains a copy of the
@@ -1879,8 +1880,8 @@ xlog_recover_do_reg_buffer(
1879 ASSERT(nbits > 0); 1880 ASSERT(nbits > 0);
1880 ASSERT(item->ri_buf[i].i_addr != NULL); 1881 ASSERT(item->ri_buf[i].i_addr != NULL);
1881 ASSERT(item->ri_buf[i].i_len % XFS_BLF_CHUNK == 0); 1882 ASSERT(item->ri_buf[i].i_len % XFS_BLF_CHUNK == 0);
1882 ASSERT(XFS_BUF_COUNT(bp) >= 1883 ASSERT(BBTOB(bp->b_io_length) >=
1883 ((uint)bit << XFS_BLF_SHIFT)+(nbits<<XFS_BLF_SHIFT)); 1884 ((uint)bit << XFS_BLF_SHIFT) + (nbits << XFS_BLF_SHIFT));
1884 1885
1885 /* 1886 /*
1886 * Do a sanity check if this is a dquot buffer. Just checking 1887 * Do a sanity check if this is a dquot buffer. Just checking
@@ -2173,7 +2174,7 @@ xlog_recover_buffer_pass2(
2173 */ 2174 */
2174 if (XFS_DINODE_MAGIC == 2175 if (XFS_DINODE_MAGIC ==
2175 be16_to_cpu(*((__be16 *)xfs_buf_offset(bp, 0))) && 2176 be16_to_cpu(*((__be16 *)xfs_buf_offset(bp, 0))) &&
2176 (XFS_BUF_COUNT(bp) != MAX(log->l_mp->m_sb.sb_blocksize, 2177 (BBTOB(bp->b_io_length) != MAX(log->l_mp->m_sb.sb_blocksize,
2177 (__uint32_t)XFS_INODE_CLUSTER_SIZE(log->l_mp)))) { 2178 (__uint32_t)XFS_INODE_CLUSTER_SIZE(log->l_mp)))) {
2178 xfs_buf_stale(bp); 2179 xfs_buf_stale(bp);
2179 error = xfs_bwrite(bp); 2180 error = xfs_bwrite(bp);