aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/xfs/xfs_buf.c17
-rw-r--r--fs/xfs/xfs_buf.h5
2 files changed, 8 insertions, 14 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;
diff --git a/fs/xfs/xfs_buf.h b/fs/xfs/xfs_buf.h
index ffd6da045d22..4d472e5ded7a 100644
--- a/fs/xfs/xfs_buf.h
+++ b/fs/xfs/xfs_buf.h
@@ -116,7 +116,7 @@ typedef struct xfs_buf {
116 * fast-path on locking. 116 * fast-path on locking.
117 */ 117 */
118 struct rb_node b_rbnode; /* rbtree node */ 118 struct rb_node b_rbnode; /* rbtree node */
119 xfs_off_t b_file_offset; /* offset in file */ 119 xfs_daddr_t b_bn; /* block number for I/O */
120 size_t b_buffer_length;/* size of buffer in bytes */ 120 size_t b_buffer_length;/* size of buffer in bytes */
121 atomic_t b_hold; /* reference count */ 121 atomic_t b_hold; /* reference count */
122 atomic_t b_lru_ref; /* lru reclaim ref count */ 122 atomic_t b_lru_ref; /* lru reclaim ref count */
@@ -128,7 +128,6 @@ typedef struct xfs_buf {
128 struct list_head b_list; 128 struct list_head b_list;
129 struct xfs_perag *b_pag; /* contains rbtree root */ 129 struct xfs_perag *b_pag; /* contains rbtree root */
130 xfs_buftarg_t *b_target; /* buffer target (device) */ 130 xfs_buftarg_t *b_target; /* buffer target (device) */
131 xfs_daddr_t b_bn; /* block number for I/O */
132 size_t b_count_desired;/* desired transfer size */ 131 size_t b_count_desired;/* desired transfer size */
133 void *b_addr; /* virtual address of buffer */ 132 void *b_addr; /* virtual address of buffer */
134 struct work_struct b_iodone_work; 133 struct work_struct b_iodone_work;
@@ -245,8 +244,6 @@ void xfs_buf_stale(struct xfs_buf *bp);
245 244
246#define XFS_BUF_ADDR(bp) ((bp)->b_bn) 245#define XFS_BUF_ADDR(bp) ((bp)->b_bn)
247#define XFS_BUF_SET_ADDR(bp, bno) ((bp)->b_bn = (xfs_daddr_t)(bno)) 246#define XFS_BUF_SET_ADDR(bp, bno) ((bp)->b_bn = (xfs_daddr_t)(bno))
248#define XFS_BUF_OFFSET(bp) ((bp)->b_file_offset)
249#define XFS_BUF_SET_OFFSET(bp, off) ((bp)->b_file_offset = (off))
250#define XFS_BUF_COUNT(bp) ((bp)->b_count_desired) 247#define XFS_BUF_COUNT(bp) ((bp)->b_count_desired)
251#define XFS_BUF_SET_COUNT(bp, cnt) ((bp)->b_count_desired = (cnt)) 248#define XFS_BUF_SET_COUNT(bp, cnt) ((bp)->b_count_desired = (cnt))
252#define XFS_BUF_SIZE(bp) ((bp)->b_buffer_length) 249#define XFS_BUF_SIZE(bp) ((bp)->b_buffer_length)