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.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
index d3a1974c91d5..854b27a8e776 100644
--- a/fs/xfs/xfs_buf.c
+++ b/fs/xfs/xfs_buf.c
@@ -196,7 +196,7 @@ xfs_buf_alloc(
196 sema_init(&bp->b_sema, 0); /* held, no waiters */ 196 sema_init(&bp->b_sema, 0); /* held, no waiters */
197 XB_SET_OWNER(bp); 197 XB_SET_OWNER(bp);
198 bp->b_target = target; 198 bp->b_target = target;
199 bp->b_file_offset = blkno << BBSHIFT; 199
200 /* 200 /*
201 * Set buffer_length and count_desired to the same value initially. 201 * Set buffer_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
@@ -337,8 +337,8 @@ xfs_buf_allocate_memory(
337 } 337 }
338 338
339use_alloc_page: 339use_alloc_page:
340 end = bp->b_file_offset + bp->b_buffer_length; 340 end = BBTOB(bp->b_bn) + bp->b_buffer_length;
341 page_count = xfs_buf_btoc(end) - xfs_buf_btoct(bp->b_file_offset); 341 page_count = xfs_buf_btoc(end) - xfs_buf_btoct(BBTOB(bp->b_bn));
342 error = _xfs_buf_get_pages(bp, page_count, flags); 342 error = _xfs_buf_get_pages(bp, page_count, flags);
343 if (unlikely(error)) 343 if (unlikely(error))
344 return error; 344 return error;
@@ -439,19 +439,17 @@ _xfs_buf_find(
439 xfs_buf_flags_t flags, 439 xfs_buf_flags_t flags,
440 xfs_buf_t *new_bp) 440 xfs_buf_t *new_bp)
441{ 441{
442 xfs_off_t offset;
443 size_t numbytes; 442 size_t numbytes;
444 struct xfs_perag *pag; 443 struct xfs_perag *pag;
445 struct rb_node **rbp; 444 struct rb_node **rbp;
446 struct rb_node *parent; 445 struct rb_node *parent;
447 xfs_buf_t *bp; 446 xfs_buf_t *bp;
448 447
449 offset = BBTOB(blkno);
450 numbytes = BBTOB(numblks); 448 numbytes = BBTOB(numblks);
451 449
452 /* Check for IOs smaller than the sector size / not sector aligned */ 450 /* Check for IOs smaller than the sector size / not sector aligned */
453 ASSERT(!(numbytes < (1 << btp->bt_sshift))); 451 ASSERT(!(numbytes < (1 << btp->bt_sshift)));
454 ASSERT(!(offset & (xfs_off_t)btp->bt_smask)); 452 ASSERT(!(BBTOB(blkno) & (xfs_off_t)btp->bt_smask));
455 453
456 /* get tree root */ 454 /* get tree root */
457 pag = xfs_perag_get(btp->bt_mount, 455 pag = xfs_perag_get(btp->bt_mount,
@@ -466,13 +464,13 @@ _xfs_buf_find(
466 parent = *rbp; 464 parent = *rbp;
467 bp = rb_entry(parent, struct xfs_buf, b_rbnode); 465 bp = rb_entry(parent, struct xfs_buf, b_rbnode);
468 466
469 if (offset < bp->b_file_offset) 467 if (blkno < bp->b_bn)
470 rbp = &(*rbp)->rb_left; 468 rbp = &(*rbp)->rb_left;
471 else if (offset > bp->b_file_offset) 469 else if (blkno > bp->b_bn)
472 rbp = &(*rbp)->rb_right; 470 rbp = &(*rbp)->rb_right;
473 else { 471 else {
474 /* 472 /*
475 * found a block offset match. If the range doesn't 473 * found a block number match. If the range doesn't
476 * match, the only way this is allowed is if the buffer 474 * match, the only way this is allowed is if the buffer
477 * in the cache is stale and the transaction that made 475 * in the cache is stale and the transaction that made
478 * it stale has not yet committed. i.e. we are 476 * it stale has not yet committed. i.e. we are
@@ -718,7 +716,6 @@ xfs_buf_set_empty(
718 bp->b_pages = NULL; 716 bp->b_pages = NULL;
719 bp->b_page_count = 0; 717 bp->b_page_count = 0;
720 bp->b_addr = NULL; 718 bp->b_addr = NULL;
721 bp->b_file_offset = 0;
722 bp->b_buffer_length = bp->b_count_desired = numblks << BBSHIFT; 719 bp->b_buffer_length = bp->b_count_desired = numblks << BBSHIFT;
723 bp->b_bn = XFS_BUF_DADDR_NULL; 720 bp->b_bn = XFS_BUF_DADDR_NULL;
724 bp->b_flags &= ~XBF_MAPPED; 721 bp->b_flags &= ~XBF_MAPPED;