aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_buf.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_buf.c')
-rw-r--r--fs/xfs/xfs_buf.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
index 854b27a8e776..382c49a42ac2 100644
--- a/fs/xfs/xfs_buf.c
+++ b/fs/xfs/xfs_buf.c
@@ -198,11 +198,12 @@ xfs_buf_alloc(
198 bp->b_target = target; 198 bp->b_target = target;
199 199
200 /* 200 /*
201 * Set buffer_length and count_desired to the same value initially. 201 * Set length and count_desired to the same value initially.
202 * I/O routines should use count_desired, which will be the same in 202 * I/O routines should use count_desired, which will be the same in
203 * most cases but may be reset (e.g. XFS recovery). 203 * most cases but may be reset (e.g. XFS recovery).
204 */ 204 */
205 bp->b_buffer_length = bp->b_count_desired = numblks << BBSHIFT; 205 bp->b_length = numblks;
206 bp->b_count_desired = numblks << BBSHIFT;
206 bp->b_flags = flags; 207 bp->b_flags = flags;
207 208
208 /* 209 /*
@@ -313,14 +314,14 @@ xfs_buf_allocate_memory(
313 * the memory from the heap - there's no need for the complexity of 314 * the memory from the heap - there's no need for the complexity of
314 * page arrays to keep allocation down to order 0. 315 * page arrays to keep allocation down to order 0.
315 */ 316 */
316 if (bp->b_buffer_length < PAGE_SIZE) { 317 if (bp->b_length < BTOBB(PAGE_SIZE)) {
317 bp->b_addr = kmem_alloc(bp->b_buffer_length, xb_to_km(flags)); 318 bp->b_addr = kmem_alloc(BBTOB(bp->b_length), xb_to_km(flags));
318 if (!bp->b_addr) { 319 if (!bp->b_addr) {
319 /* low memory - use alloc_page loop instead */ 320 /* low memory - use alloc_page loop instead */
320 goto use_alloc_page; 321 goto use_alloc_page;
321 } 322 }
322 323
323 if (((unsigned long)(bp->b_addr + bp->b_buffer_length - 1) & 324 if (((unsigned long)(bp->b_addr + BBTOB(bp->b_length) - 1) &
324 PAGE_MASK) != 325 PAGE_MASK) !=
325 ((unsigned long)bp->b_addr & PAGE_MASK)) { 326 ((unsigned long)bp->b_addr & PAGE_MASK)) {
326 /* b_addr spans two pages - use alloc_page instead */ 327 /* b_addr spans two pages - use alloc_page instead */
@@ -337,7 +338,7 @@ xfs_buf_allocate_memory(
337 } 338 }
338 339
339use_alloc_page: 340use_alloc_page:
340 end = BBTOB(bp->b_bn) + bp->b_buffer_length; 341 end = BBTOB(bp->b_bn + bp->b_length);
341 page_count = xfs_buf_btoc(end) - xfs_buf_btoct(BBTOB(bp->b_bn)); 342 page_count = xfs_buf_btoc(end) - xfs_buf_btoct(BBTOB(bp->b_bn));
342 error = _xfs_buf_get_pages(bp, page_count, flags); 343 error = _xfs_buf_get_pages(bp, page_count, flags);
343 if (unlikely(error)) 344 if (unlikely(error))
@@ -477,7 +478,7 @@ _xfs_buf_find(
477 * reallocating a busy extent. Skip this buffer and 478 * reallocating a busy extent. Skip this buffer and
478 * continue searching to the right for an exact match. 479 * continue searching to the right for an exact match.
479 */ 480 */
480 if (bp->b_buffer_length != numbytes) { 481 if (bp->b_length != numblks) {
481 ASSERT(bp->b_flags & XBF_STALE); 482 ASSERT(bp->b_flags & XBF_STALE);
482 rbp = &(*rbp)->rb_right; 483 rbp = &(*rbp)->rb_right;
483 continue; 484 continue;
@@ -574,7 +575,7 @@ xfs_buf_get(
574 * that we can do IO on it. 575 * that we can do IO on it.
575 */ 576 */
576 bp->b_bn = blkno; 577 bp->b_bn = blkno;
577 bp->b_count_desired = bp->b_buffer_length; 578 bp->b_count_desired = BBTOB(bp->b_length);
578 579
579found: 580found:
580 if (!(bp->b_flags & XBF_MAPPED)) { 581 if (!(bp->b_flags & XBF_MAPPED)) {
@@ -716,7 +717,8 @@ xfs_buf_set_empty(
716 bp->b_pages = NULL; 717 bp->b_pages = NULL;
717 bp->b_page_count = 0; 718 bp->b_page_count = 0;
718 bp->b_addr = NULL; 719 bp->b_addr = NULL;
719 bp->b_buffer_length = bp->b_count_desired = numblks << BBSHIFT; 720 bp->b_length = numblks;
721 bp->b_count_desired = numblks << BBSHIFT;
720 bp->b_bn = XFS_BUF_DADDR_NULL; 722 bp->b_bn = XFS_BUF_DADDR_NULL;
721 bp->b_flags &= ~XBF_MAPPED; 723 bp->b_flags &= ~XBF_MAPPED;
722} 724}
@@ -769,7 +771,7 @@ xfs_buf_associate_memory(
769 } 771 }
770 772
771 bp->b_count_desired = len; 773 bp->b_count_desired = len;
772 bp->b_buffer_length = buflen; 774 bp->b_length = BTOBB(buflen);
773 bp->b_flags |= XBF_MAPPED; 775 bp->b_flags |= XBF_MAPPED;
774 776
775 return 0; 777 return 0;