summaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_buf.c
diff options
context:
space:
mode:
authorDave Chinner <david@fromorbit.com>2012-04-23 15:58:52 +1000
committerBen Myers <bpm@sgi.com>2012-05-14 16:20:48 -0500
commitaa0e8833b05cbd9d34d6a1ddaf23a74a58d76a03 (patch)
tree72592f1fec3df30dea526f793416b56b8d133234 /fs/xfs/xfs_buf.c
parent4e94b71b7068b4bd9c615301197e09dbf0c3b770 (diff)
downloadtalos-obmc-linux-aa0e8833b05cbd9d34d6a1ddaf23a74a58d76a03.tar.gz
talos-obmc-linux-aa0e8833b05cbd9d34d6a1ddaf23a74a58d76a03.zip
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.c')
-rw-r--r--fs/xfs/xfs_buf.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
index 382c49a42ac2..ab3c4491777b 100644
--- a/fs/xfs/xfs_buf.c
+++ b/fs/xfs/xfs_buf.c
@@ -198,12 +198,12 @@ xfs_buf_alloc(
bp->b_target = target;
/*
- * Set length and count_desired to the same value initially.
- * I/O routines should use count_desired, which will be the same in
+ * Set length and io_length to the same value initially.
+ * I/O routines should use io_length, which will be the same in
* most cases but may be reset (e.g. XFS recovery).
*/
bp->b_length = numblks;
- bp->b_count_desired = numblks << BBSHIFT;
+ bp->b_io_length = numblks;
bp->b_flags = flags;
/*
@@ -302,7 +302,7 @@ xfs_buf_allocate_memory(
xfs_buf_t *bp,
uint flags)
{
- size_t size = bp->b_count_desired;
+ size_t size;
size_t nbytes, offset;
gfp_t gfp_mask = xb_to_gfp(flags);
unsigned short page_count, i;
@@ -345,6 +345,7 @@ use_alloc_page:
return error;
offset = bp->b_offset;
+ size = BBTOB(bp->b_length);
bp->b_flags |= _XBF_PAGES;
for (i = 0; i < bp->b_page_count; i++) {
@@ -575,7 +576,7 @@ xfs_buf_get(
* that we can do IO on it.
*/
bp->b_bn = blkno;
- bp->b_count_desired = BBTOB(bp->b_length);
+ bp->b_io_length = bp->b_length;
found:
if (!(bp->b_flags & XBF_MAPPED)) {
@@ -718,7 +719,7 @@ xfs_buf_set_empty(
bp->b_page_count = 0;
bp->b_addr = NULL;
bp->b_length = numblks;
- bp->b_count_desired = numblks << BBSHIFT;
+ bp->b_io_length = numblks;
bp->b_bn = XFS_BUF_DADDR_NULL;
bp->b_flags &= ~XBF_MAPPED;
}
@@ -770,7 +771,7 @@ xfs_buf_associate_memory(
pageaddr += PAGE_SIZE;
}
- bp->b_count_desired = len;
+ bp->b_io_length = BTOBB(len);
bp->b_length = BTOBB(buflen);
bp->b_flags |= XBF_MAPPED;
@@ -1012,9 +1013,8 @@ xfs_buf_ioerror_alert(
const char *func)
{
xfs_alert(bp->b_target->bt_mount,
-"metadata I/O error: block 0x%llx (\"%s\") error %d buf count %zd",
- (__uint64_t)XFS_BUF_ADDR(bp), func,
- bp->b_error, XFS_BUF_COUNT(bp));
+"metadata I/O error: block 0x%llx (\"%s\") error %d numblks %d",
+ (__uint64_t)XFS_BUF_ADDR(bp), func, bp->b_error, bp->b_length);
}
int
@@ -1186,7 +1186,7 @@ _xfs_buf_ioapply(
int rw, map_i, total_nr_pages, nr_pages;
struct bio *bio;
int offset = bp->b_offset;
- int size = bp->b_count_desired;
+ int size = BBTOB(bp->b_io_length);
sector_t sector = bp->b_bn;
total_nr_pages = bp->b_page_count;
@@ -1234,7 +1234,7 @@ next_chunk:
break;
offset = 0;
- sector += nbytes >> BBSHIFT;
+ sector += BTOBB(nbytes);
size -= nbytes;
total_nr_pages--;
}
@@ -1328,7 +1328,7 @@ xfs_buf_iomove(
page = bp->b_pages[xfs_buf_btoct(boff + bp->b_offset)];
cpoff = xfs_buf_poff(boff + bp->b_offset);
csize = min_t(size_t,
- PAGE_SIZE-cpoff, bp->b_count_desired-boff);
+ PAGE_SIZE - cpoff, BBTOB(bp->b_io_length) - boff);
ASSERT(((csize + cpoff) <= PAGE_SIZE));
OpenPOWER on IntegriCloud