diff options
author | Dave Chinner <david@fromorbit.com> | 2012-04-23 01:58:52 -0400 |
---|---|---|
committer | Ben Myers <bpm@sgi.com> | 2012-05-14 17:20:48 -0400 |
commit | aa0e8833b05cbd9d34d6a1ddaf23a74a58d76a03 (patch) | |
tree | 72592f1fec3df30dea526f793416b56b8d133234 /fs/xfs/xfs_buf_item.c | |
parent | 4e94b71b7068b4bd9c615301197e09dbf0c3b770 (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_buf_item.c')
-rw-r--r-- | fs/xfs/xfs_buf_item.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/fs/xfs/xfs_buf_item.c b/fs/xfs/xfs_buf_item.c index 7f0abeaf919c..a25206c84cf9 100644 --- a/fs/xfs/xfs_buf_item.c +++ b/fs/xfs/xfs_buf_item.c | |||
@@ -123,11 +123,11 @@ xfs_buf_item_log_check( | |||
123 | ASSERT(bip->bli_logged != NULL); | 123 | ASSERT(bip->bli_logged != NULL); |
124 | 124 | ||
125 | bp = bip->bli_buf; | 125 | bp = bip->bli_buf; |
126 | ASSERT(XFS_BUF_COUNT(bp) > 0); | 126 | ASSERT(bp->b_length > 0); |
127 | ASSERT(bp->b_addr != NULL); | 127 | ASSERT(bp->b_addr != NULL); |
128 | orig = bip->bli_orig; | 128 | orig = bip->bli_orig; |
129 | buffer = bp->b_addr; | 129 | buffer = bp->b_addr; |
130 | for (x = 0; x < XFS_BUF_COUNT(bp); x++) { | 130 | for (x = 0; x < BBTOB(bp->b_length); x++) { |
131 | if (orig[x] != buffer[x] && !btst(bip->bli_logged, x)) { | 131 | if (orig[x] != buffer[x] && !btst(bip->bli_logged, x)) { |
132 | xfs_emerg(bp->b_mount, | 132 | xfs_emerg(bp->b_mount, |
133 | "%s: bip %x buffer %x orig %x index %d", | 133 | "%s: bip %x buffer %x orig %x index %d", |
@@ -657,7 +657,8 @@ xfs_buf_item_init( | |||
657 | * truncate any pieces. map_size is the size of the | 657 | * truncate any pieces. map_size is the size of the |
658 | * bitmap needed to describe the chunks of the buffer. | 658 | * bitmap needed to describe the chunks of the buffer. |
659 | */ | 659 | */ |
660 | chunks = (int)((XFS_BUF_COUNT(bp) + (XFS_BLF_CHUNK - 1)) >> XFS_BLF_SHIFT); | 660 | chunks = (int)((BBTOB(bp->b_length) + (XFS_BLF_CHUNK - 1)) >> |
661 | XFS_BLF_SHIFT); | ||
661 | map_size = (int)((chunks + NBWORD) >> BIT_TO_WORD_SHIFT); | 662 | map_size = (int)((chunks + NBWORD) >> BIT_TO_WORD_SHIFT); |
662 | 663 | ||
663 | bip = (xfs_buf_log_item_t*)kmem_zone_zalloc(xfs_buf_item_zone, | 664 | bip = (xfs_buf_log_item_t*)kmem_zone_zalloc(xfs_buf_item_zone, |
@@ -667,7 +668,7 @@ xfs_buf_item_init( | |||
667 | xfs_buf_hold(bp); | 668 | xfs_buf_hold(bp); |
668 | bip->bli_format.blf_type = XFS_LI_BUF; | 669 | bip->bli_format.blf_type = XFS_LI_BUF; |
669 | bip->bli_format.blf_blkno = (__int64_t)XFS_BUF_ADDR(bp); | 670 | bip->bli_format.blf_blkno = (__int64_t)XFS_BUF_ADDR(bp); |
670 | bip->bli_format.blf_len = (ushort)BTOBB(XFS_BUF_COUNT(bp)); | 671 | bip->bli_format.blf_len = (ushort)bp->b_length; |
671 | bip->bli_format.blf_map_size = map_size; | 672 | bip->bli_format.blf_map_size = map_size; |
672 | 673 | ||
673 | #ifdef XFS_TRANS_DEBUG | 674 | #ifdef XFS_TRANS_DEBUG |
@@ -679,9 +680,9 @@ xfs_buf_item_init( | |||
679 | * the buffer to indicate which bytes the callers have asked | 680 | * the buffer to indicate which bytes the callers have asked |
680 | * to have logged. | 681 | * to have logged. |
681 | */ | 682 | */ |
682 | bip->bli_orig = (char *)kmem_alloc(XFS_BUF_COUNT(bp), KM_SLEEP); | 683 | bip->bli_orig = kmem_alloc(BBTOB(bp->b_length), KM_SLEEP); |
683 | memcpy(bip->bli_orig, bp->b_addr, XFS_BUF_COUNT(bp)); | 684 | memcpy(bip->bli_orig, bp->b_addr, BBTOB(bp->b_length)); |
684 | bip->bli_logged = (char *)kmem_zalloc(XFS_BUF_COUNT(bp) / NBBY, KM_SLEEP); | 685 | bip->bli_logged = kmem_zalloc(BBTOB(bp->b_length) / NBBY, KM_SLEEP); |
685 | #endif | 686 | #endif |
686 | 687 | ||
687 | /* | 688 | /* |