aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2012-04-23 01:58:49 -0400
committerBen Myers <bpm@sgi.com>2012-05-14 17:20:45 -0400
commite70b73f84f474cc594a39bd8ff083974e6d69aea (patch)
tree0d365698ca2b6542aab8ca92c8e1f23b9c43da55
parentbf813cdddfb3a5bc88e1612e8f62a12367871213 (diff)
xfs: clean up buffer get/read call API
The xfs_buf_get/read API is not consistent in the units it uses, and does not use appropriate or consistent units/types for the variables. Convert the API to use disk addresses and block counts for all buffer get and read calls. Use consistent naming for all the functions and their declarations, and convert the internal functions to use disk addresses and block counts to avoid need to convert them from one type to another and back again. Fix all the callers to use disk addresses and block counts. In many cases, this removes an additional conversion from the function call as the callers already have a block count. 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>
-rw-r--r--fs/xfs/xfs_buf.c86
-rw-r--r--fs/xfs/xfs_buf.h38
-rw-r--r--fs/xfs/xfs_fsops.c4
-rw-r--r--fs/xfs/xfs_log.c6
-rw-r--r--fs/xfs/xfs_log_recover.c2
-rw-r--r--fs/xfs/xfs_mount.c12
-rw-r--r--fs/xfs/xfs_rtalloc.c8
-rw-r--r--fs/xfs/xfs_vnodeops.c2
8 files changed, 84 insertions, 74 deletions
diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
index f463dce42515..d3a1974c91d5 100644
--- a/fs/xfs/xfs_buf.c
+++ b/fs/xfs/xfs_buf.c
@@ -172,8 +172,8 @@ xfs_buf_stale(
172struct xfs_buf * 172struct xfs_buf *
173xfs_buf_alloc( 173xfs_buf_alloc(
174 struct xfs_buftarg *target, 174 struct xfs_buftarg *target,
175 xfs_off_t range_base, 175 xfs_daddr_t blkno,
176 size_t range_length, 176 size_t numblks,
177 xfs_buf_flags_t flags) 177 xfs_buf_flags_t flags)
178{ 178{
179 struct xfs_buf *bp; 179 struct xfs_buf *bp;
@@ -196,14 +196,21 @@ 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 = range_base; 199 bp->b_file_offset = blkno << BBSHIFT;
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
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 = range_length; 205 bp->b_buffer_length = bp->b_count_desired = numblks << BBSHIFT;
206 bp->b_flags = flags; 206 bp->b_flags = flags;
207
208 /*
209 * We do not set the block number here in the buffer because we have not
210 * finished initialising the buffer. We insert the buffer into the cache
211 * in this state, so this ensures that we are unable to do IO on a
212 * buffer that hasn't been fully initialised.
213 */
207 bp->b_bn = XFS_BUF_DADDR_NULL; 214 bp->b_bn = XFS_BUF_DADDR_NULL;
208 atomic_set(&bp->b_pin_count, 0); 215 atomic_set(&bp->b_pin_count, 0);
209 init_waitqueue_head(&bp->b_waiters); 216 init_waitqueue_head(&bp->b_waiters);
@@ -426,29 +433,29 @@ _xfs_buf_map_pages(
426 */ 433 */
427xfs_buf_t * 434xfs_buf_t *
428_xfs_buf_find( 435_xfs_buf_find(
429 xfs_buftarg_t *btp, /* block device target */ 436 struct xfs_buftarg *btp,
430 xfs_off_t ioff, /* starting offset of range */ 437 xfs_daddr_t blkno,
431 size_t isize, /* length of range */ 438 size_t numblks,
432 xfs_buf_flags_t flags, 439 xfs_buf_flags_t flags,
433 xfs_buf_t *new_bp) 440 xfs_buf_t *new_bp)
434{ 441{
435 xfs_off_t range_base; 442 xfs_off_t offset;
436 size_t range_length; 443 size_t numbytes;
437 struct xfs_perag *pag; 444 struct xfs_perag *pag;
438 struct rb_node **rbp; 445 struct rb_node **rbp;
439 struct rb_node *parent; 446 struct rb_node *parent;
440 xfs_buf_t *bp; 447 xfs_buf_t *bp;
441 448
442 range_base = (ioff << BBSHIFT); 449 offset = BBTOB(blkno);
443 range_length = (isize << BBSHIFT); 450 numbytes = BBTOB(numblks);
444 451
445 /* Check for IOs smaller than the sector size / not sector aligned */ 452 /* Check for IOs smaller than the sector size / not sector aligned */
446 ASSERT(!(range_length < (1 << btp->bt_sshift))); 453 ASSERT(!(numbytes < (1 << btp->bt_sshift)));
447 ASSERT(!(range_base & (xfs_off_t)btp->bt_smask)); 454 ASSERT(!(offset & (xfs_off_t)btp->bt_smask));
448 455
449 /* get tree root */ 456 /* get tree root */
450 pag = xfs_perag_get(btp->bt_mount, 457 pag = xfs_perag_get(btp->bt_mount,
451 xfs_daddr_to_agno(btp->bt_mount, ioff)); 458 xfs_daddr_to_agno(btp->bt_mount, blkno));
452 459
453 /* walk tree */ 460 /* walk tree */
454 spin_lock(&pag->pag_buf_lock); 461 spin_lock(&pag->pag_buf_lock);
@@ -459,9 +466,9 @@ _xfs_buf_find(
459 parent = *rbp; 466 parent = *rbp;
460 bp = rb_entry(parent, struct xfs_buf, b_rbnode); 467 bp = rb_entry(parent, struct xfs_buf, b_rbnode);
461 468
462 if (range_base < bp->b_file_offset) 469 if (offset < bp->b_file_offset)
463 rbp = &(*rbp)->rb_left; 470 rbp = &(*rbp)->rb_left;
464 else if (range_base > bp->b_file_offset) 471 else if (offset > bp->b_file_offset)
465 rbp = &(*rbp)->rb_right; 472 rbp = &(*rbp)->rb_right;
466 else { 473 else {
467 /* 474 /*
@@ -472,7 +479,7 @@ _xfs_buf_find(
472 * reallocating a busy extent. Skip this buffer and 479 * reallocating a busy extent. Skip this buffer and
473 * continue searching to the right for an exact match. 480 * continue searching to the right for an exact match.
474 */ 481 */
475 if (bp->b_buffer_length != range_length) { 482 if (bp->b_buffer_length != numbytes) {
476 ASSERT(bp->b_flags & XBF_STALE); 483 ASSERT(bp->b_flags & XBF_STALE);
477 rbp = &(*rbp)->rb_right; 484 rbp = &(*rbp)->rb_right;
478 continue; 485 continue;
@@ -532,21 +539,20 @@ found:
532 */ 539 */
533struct xfs_buf * 540struct xfs_buf *
534xfs_buf_get( 541xfs_buf_get(
535 xfs_buftarg_t *target,/* target for buffer */ 542 xfs_buftarg_t *target,
536 xfs_off_t ioff, /* starting offset of range */ 543 xfs_daddr_t blkno,
537 size_t isize, /* length of range */ 544 size_t numblks,
538 xfs_buf_flags_t flags) 545 xfs_buf_flags_t flags)
539{ 546{
540 struct xfs_buf *bp; 547 struct xfs_buf *bp;
541 struct xfs_buf *new_bp; 548 struct xfs_buf *new_bp;
542 int error = 0; 549 int error = 0;
543 550
544 bp = _xfs_buf_find(target, ioff, isize, flags, NULL); 551 bp = _xfs_buf_find(target, blkno, numblks, flags, NULL);
545 if (likely(bp)) 552 if (likely(bp))
546 goto found; 553 goto found;
547 554
548 new_bp = xfs_buf_alloc(target, ioff << BBSHIFT, isize << BBSHIFT, 555 new_bp = xfs_buf_alloc(target, blkno, numblks, flags);
549 flags);
550 if (unlikely(!new_bp)) 556 if (unlikely(!new_bp))
551 return NULL; 557 return NULL;
552 558
@@ -556,7 +562,7 @@ xfs_buf_get(
556 return NULL; 562 return NULL;
557 } 563 }
558 564
559 bp = _xfs_buf_find(target, ioff, isize, flags, new_bp); 565 bp = _xfs_buf_find(target, blkno, numblks, flags, new_bp);
560 if (!bp) { 566 if (!bp) {
561 xfs_buf_free(new_bp); 567 xfs_buf_free(new_bp);
562 return NULL; 568 return NULL;
@@ -569,7 +575,7 @@ xfs_buf_get(
569 * Now we have a workable buffer, fill in the block number so 575 * Now we have a workable buffer, fill in the block number so
570 * that we can do IO on it. 576 * that we can do IO on it.
571 */ 577 */
572 bp->b_bn = ioff; 578 bp->b_bn = blkno;
573 bp->b_count_desired = bp->b_buffer_length; 579 bp->b_count_desired = bp->b_buffer_length;
574 580
575found: 581found:
@@ -613,15 +619,15 @@ _xfs_buf_read(
613xfs_buf_t * 619xfs_buf_t *
614xfs_buf_read( 620xfs_buf_read(
615 xfs_buftarg_t *target, 621 xfs_buftarg_t *target,
616 xfs_off_t ioff, 622 xfs_daddr_t blkno,
617 size_t isize, 623 size_t numblks,
618 xfs_buf_flags_t flags) 624 xfs_buf_flags_t flags)
619{ 625{
620 xfs_buf_t *bp; 626 xfs_buf_t *bp;
621 627
622 flags |= XBF_READ; 628 flags |= XBF_READ;
623 629
624 bp = xfs_buf_get(target, ioff, isize, flags); 630 bp = xfs_buf_get(target, blkno, numblks, flags);
625 if (bp) { 631 if (bp) {
626 trace_xfs_buf_read(bp, flags, _RET_IP_); 632 trace_xfs_buf_read(bp, flags, _RET_IP_);
627 633
@@ -656,13 +662,13 @@ xfs_buf_read(
656void 662void
657xfs_buf_readahead( 663xfs_buf_readahead(
658 xfs_buftarg_t *target, 664 xfs_buftarg_t *target,
659 xfs_off_t ioff, 665 xfs_daddr_t blkno,
660 size_t isize) 666 size_t numblks)
661{ 667{
662 if (bdi_read_congested(target->bt_bdi)) 668 if (bdi_read_congested(target->bt_bdi))
663 return; 669 return;
664 670
665 xfs_buf_read(target, ioff, isize, 671 xfs_buf_read(target, blkno, numblks,
666 XBF_TRYLOCK|XBF_ASYNC|XBF_READ_AHEAD|XBF_DONT_BLOCK); 672 XBF_TRYLOCK|XBF_ASYNC|XBF_READ_AHEAD|XBF_DONT_BLOCK);
667} 673}
668 674
@@ -672,16 +678,15 @@ xfs_buf_readahead(
672 */ 678 */
673struct xfs_buf * 679struct xfs_buf *
674xfs_buf_read_uncached( 680xfs_buf_read_uncached(
675 struct xfs_mount *mp,
676 struct xfs_buftarg *target, 681 struct xfs_buftarg *target,
677 xfs_daddr_t daddr, 682 xfs_daddr_t daddr,
678 size_t length, 683 size_t numblks,
679 int flags) 684 int flags)
680{ 685{
681 xfs_buf_t *bp; 686 xfs_buf_t *bp;
682 int error; 687 int error;
683 688
684 bp = xfs_buf_get_uncached(target, length, flags); 689 bp = xfs_buf_get_uncached(target, numblks, flags);
685 if (!bp) 690 if (!bp)
686 return NULL; 691 return NULL;
687 692
@@ -689,7 +694,7 @@ xfs_buf_read_uncached(
689 XFS_BUF_SET_ADDR(bp, daddr); 694 XFS_BUF_SET_ADDR(bp, daddr);
690 XFS_BUF_READ(bp); 695 XFS_BUF_READ(bp);
691 696
692 xfsbdstrat(mp, bp); 697 xfsbdstrat(target->bt_mount, bp);
693 error = xfs_buf_iowait(bp); 698 error = xfs_buf_iowait(bp);
694 if (error) { 699 if (error) {
695 xfs_buf_relse(bp); 700 xfs_buf_relse(bp);
@@ -705,7 +710,7 @@ xfs_buf_read_uncached(
705void 710void
706xfs_buf_set_empty( 711xfs_buf_set_empty(
707 struct xfs_buf *bp, 712 struct xfs_buf *bp,
708 size_t len) 713 size_t numblks)
709{ 714{
710 if (bp->b_pages) 715 if (bp->b_pages)
711 _xfs_buf_free_pages(bp); 716 _xfs_buf_free_pages(bp);
@@ -714,7 +719,7 @@ xfs_buf_set_empty(
714 bp->b_page_count = 0; 719 bp->b_page_count = 0;
715 bp->b_addr = NULL; 720 bp->b_addr = NULL;
716 bp->b_file_offset = 0; 721 bp->b_file_offset = 0;
717 bp->b_buffer_length = bp->b_count_desired = len; 722 bp->b_buffer_length = bp->b_count_desired = numblks << BBSHIFT;
718 bp->b_bn = XFS_BUF_DADDR_NULL; 723 bp->b_bn = XFS_BUF_DADDR_NULL;
719 bp->b_flags &= ~XBF_MAPPED; 724 bp->b_flags &= ~XBF_MAPPED;
720} 725}
@@ -776,17 +781,18 @@ xfs_buf_associate_memory(
776xfs_buf_t * 781xfs_buf_t *
777xfs_buf_get_uncached( 782xfs_buf_get_uncached(
778 struct xfs_buftarg *target, 783 struct xfs_buftarg *target,
779 size_t len, 784 size_t numblks,
780 int flags) 785 int flags)
781{ 786{
782 unsigned long page_count = PAGE_ALIGN(len) >> PAGE_SHIFT; 787 unsigned long page_count;
783 int error, i; 788 int error, i;
784 xfs_buf_t *bp; 789 xfs_buf_t *bp;
785 790
786 bp = xfs_buf_alloc(target, 0, len, 0); 791 bp = xfs_buf_alloc(target, 0, numblks, 0);
787 if (unlikely(bp == NULL)) 792 if (unlikely(bp == NULL))
788 goto fail; 793 goto fail;
789 794
795 page_count = PAGE_ALIGN(numblks << BBSHIFT) >> PAGE_SHIFT;
790 error = _xfs_buf_get_pages(bp, page_count, 0); 796 error = _xfs_buf_get_pages(bp, page_count, 0);
791 if (error) 797 if (error)
792 goto fail_free_buf; 798 goto fail_free_buf;
diff --git a/fs/xfs/xfs_buf.h b/fs/xfs/xfs_buf.h
index 87a474853f8a..ffd6da045d22 100644
--- a/fs/xfs/xfs_buf.h
+++ b/fs/xfs/xfs_buf.h
@@ -150,26 +150,30 @@ typedef struct xfs_buf {
150 150
151 151
152/* Finding and Reading Buffers */ 152/* Finding and Reading Buffers */
153extern xfs_buf_t *_xfs_buf_find(xfs_buftarg_t *, xfs_off_t, size_t, 153struct xfs_buf *_xfs_buf_find(struct xfs_buftarg *target, xfs_daddr_t blkno,
154 xfs_buf_flags_t, xfs_buf_t *); 154 size_t numblks, xfs_buf_flags_t flags,
155 struct xfs_buf *new_bp);
155#define xfs_incore(buftarg,blkno,len,lockit) \ 156#define xfs_incore(buftarg,blkno,len,lockit) \
156 _xfs_buf_find(buftarg, blkno ,len, lockit, NULL) 157 _xfs_buf_find(buftarg, blkno ,len, lockit, NULL)
157 158
158extern xfs_buf_t *xfs_buf_get(xfs_buftarg_t *, xfs_off_t, size_t, 159struct xfs_buf *xfs_buf_get(struct xfs_buftarg *target, xfs_daddr_t blkno,
159 xfs_buf_flags_t); 160 size_t numblks, xfs_buf_flags_t flags);
160extern xfs_buf_t *xfs_buf_read(xfs_buftarg_t *, xfs_off_t, size_t, 161struct xfs_buf *xfs_buf_read(struct xfs_buftarg *target, xfs_daddr_t blkno,
161 xfs_buf_flags_t); 162 size_t numblks, xfs_buf_flags_t flags);
162 163void xfs_buf_readahead(struct xfs_buftarg *target, xfs_daddr_t blkno,
163struct xfs_buf *xfs_buf_alloc(struct xfs_buftarg *, xfs_off_t, size_t, 164 size_t numblks);
164 xfs_buf_flags_t); 165
165extern void xfs_buf_set_empty(struct xfs_buf *bp, size_t len); 166struct xfs_buf *xfs_buf_get_empty(struct xfs_buftarg *target, size_t numblks);
166extern xfs_buf_t *xfs_buf_get_uncached(struct xfs_buftarg *, size_t, int); 167struct xfs_buf *xfs_buf_alloc(struct xfs_buftarg *target, xfs_daddr_t blkno,
167extern int xfs_buf_associate_memory(xfs_buf_t *, void *, size_t); 168 size_t numblks, xfs_buf_flags_t flags);
168extern void xfs_buf_hold(xfs_buf_t *); 169void xfs_buf_set_empty(struct xfs_buf *bp, size_t numblks);
169extern void xfs_buf_readahead(xfs_buftarg_t *, xfs_off_t, size_t); 170int xfs_buf_associate_memory(struct xfs_buf *bp, void *mem, size_t length);
170struct xfs_buf *xfs_buf_read_uncached(struct xfs_mount *mp, 171
171 struct xfs_buftarg *target, 172struct xfs_buf *xfs_buf_get_uncached(struct xfs_buftarg *target, size_t numblks,
172 xfs_daddr_t daddr, size_t length, int flags); 173 int flags);
174struct xfs_buf *xfs_buf_read_uncached(struct xfs_buftarg *target,
175 xfs_daddr_t daddr, size_t numblks, int flags);
176void xfs_buf_hold(struct xfs_buf *bp);
173 177
174/* Releasing Buffers */ 178/* Releasing Buffers */
175extern void xfs_buf_free(xfs_buf_t *); 179extern void xfs_buf_free(xfs_buf_t *);
diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c
index 1c6fdeb702ff..019ba5c52a49 100644
--- a/fs/xfs/xfs_fsops.c
+++ b/fs/xfs/xfs_fsops.c
@@ -147,9 +147,9 @@ xfs_growfs_data_private(
147 if ((error = xfs_sb_validate_fsb_count(&mp->m_sb, nb))) 147 if ((error = xfs_sb_validate_fsb_count(&mp->m_sb, nb)))
148 return error; 148 return error;
149 dpct = pct - mp->m_sb.sb_imax_pct; 149 dpct = pct - mp->m_sb.sb_imax_pct;
150 bp = xfs_buf_read_uncached(mp, mp->m_ddev_targp, 150 bp = xfs_buf_read_uncached(mp->m_ddev_targp,
151 XFS_FSB_TO_BB(mp, nb) - XFS_FSS_TO_BB(mp, 1), 151 XFS_FSB_TO_BB(mp, nb) - XFS_FSS_TO_BB(mp, 1),
152 BBTOB(XFS_FSS_TO_BB(mp, 1)), 0); 152 XFS_FSS_TO_BB(mp, 1), 0);
153 if (!bp) 153 if (!bp)
154 return EIO; 154 return EIO;
155 xfs_buf_relse(bp); 155 xfs_buf_relse(bp);
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index 418d5d7bc52b..89900129a4a3 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -1187,7 +1187,7 @@ xlog_alloc_log(xfs_mount_t *mp,
1187 xlog_get_iclog_buffer_size(mp, log); 1187 xlog_get_iclog_buffer_size(mp, log);
1188 1188
1189 error = ENOMEM; 1189 error = ENOMEM;
1190 bp = xfs_buf_alloc(mp->m_logdev_targp, 0, log->l_iclog_size, 0); 1190 bp = xfs_buf_alloc(mp->m_logdev_targp, 0, BTOBB(log->l_iclog_size), 0);
1191 if (!bp) 1191 if (!bp)
1192 goto out_free_log; 1192 goto out_free_log;
1193 bp->b_iodone = xlog_iodone; 1193 bp->b_iodone = xlog_iodone;
@@ -1219,7 +1219,7 @@ xlog_alloc_log(xfs_mount_t *mp,
1219 prev_iclog = iclog; 1219 prev_iclog = iclog;
1220 1220
1221 bp = xfs_buf_get_uncached(mp->m_logdev_targp, 1221 bp = xfs_buf_get_uncached(mp->m_logdev_targp,
1222 log->l_iclog_size, 0); 1222 BTOBB(log->l_iclog_size), 0);
1223 if (!bp) 1223 if (!bp)
1224 goto out_free_iclog; 1224 goto out_free_iclog;
1225 1225
@@ -1588,7 +1588,7 @@ xlog_dealloc_log(xlog_t *log)
1588 * always need to ensure that the extra buffer does not point to memory 1588 * always need to ensure that the extra buffer does not point to memory
1589 * owned by another log buffer before we free it. 1589 * owned by another log buffer before we free it.
1590 */ 1590 */
1591 xfs_buf_set_empty(log->l_xbuf, log->l_iclog_size); 1591 xfs_buf_set_empty(log->l_xbuf, BTOBB(log->l_iclog_size));
1592 xfs_buf_free(log->l_xbuf); 1592 xfs_buf_free(log->l_xbuf);
1593 1593
1594 iclog = log->l_iclog; 1594 iclog = log->l_iclog;
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
index e1577e763fdf..8a2165c56108 100644
--- a/fs/xfs/xfs_log_recover.c
+++ b/fs/xfs/xfs_log_recover.c
@@ -120,7 +120,7 @@ xlog_get_bp(
120 nbblks += log->l_sectBBsize; 120 nbblks += log->l_sectBBsize;
121 nbblks = round_up(nbblks, log->l_sectBBsize); 121 nbblks = round_up(nbblks, log->l_sectBBsize);
122 122
123 bp = xfs_buf_get_uncached(log->l_mp->m_logdev_targp, BBTOB(nbblks), 0); 123 bp = xfs_buf_get_uncached(log->l_mp->m_logdev_targp, nbblks, 0);
124 if (bp) 124 if (bp)
125 xfs_buf_unlock(bp); 125 xfs_buf_unlock(bp);
126 return bp; 126 return bp;
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
index 385a3b11d3dd..89be5ff57907 100644
--- a/fs/xfs/xfs_mount.c
+++ b/fs/xfs/xfs_mount.c
@@ -684,8 +684,8 @@ xfs_readsb(xfs_mount_t *mp, int flags)
684 sector_size = xfs_getsize_buftarg(mp->m_ddev_targp); 684 sector_size = xfs_getsize_buftarg(mp->m_ddev_targp);
685 685
686reread: 686reread:
687 bp = xfs_buf_read_uncached(mp, mp->m_ddev_targp, 687 bp = xfs_buf_read_uncached(mp->m_ddev_targp, XFS_SB_DADDR,
688 XFS_SB_DADDR, sector_size, 0); 688 BTOBB(sector_size), 0);
689 if (!bp) { 689 if (!bp) {
690 if (loud) 690 if (loud)
691 xfs_warn(mp, "SB buffer read failed"); 691 xfs_warn(mp, "SB buffer read failed");
@@ -1033,9 +1033,9 @@ xfs_check_sizes(xfs_mount_t *mp)
1033 xfs_warn(mp, "filesystem size mismatch detected"); 1033 xfs_warn(mp, "filesystem size mismatch detected");
1034 return XFS_ERROR(EFBIG); 1034 return XFS_ERROR(EFBIG);
1035 } 1035 }
1036 bp = xfs_buf_read_uncached(mp, mp->m_ddev_targp, 1036 bp = xfs_buf_read_uncached(mp->m_ddev_targp,
1037 d - XFS_FSS_TO_BB(mp, 1), 1037 d - XFS_FSS_TO_BB(mp, 1),
1038 BBTOB(XFS_FSS_TO_BB(mp, 1)), 0); 1038 XFS_FSS_TO_BB(mp, 1), 0);
1039 if (!bp) { 1039 if (!bp) {
1040 xfs_warn(mp, "last sector read failed"); 1040 xfs_warn(mp, "last sector read failed");
1041 return EIO; 1041 return EIO;
@@ -1048,9 +1048,9 @@ xfs_check_sizes(xfs_mount_t *mp)
1048 xfs_warn(mp, "log size mismatch detected"); 1048 xfs_warn(mp, "log size mismatch detected");
1049 return XFS_ERROR(EFBIG); 1049 return XFS_ERROR(EFBIG);
1050 } 1050 }
1051 bp = xfs_buf_read_uncached(mp, mp->m_logdev_targp, 1051 bp = xfs_buf_read_uncached(mp->m_logdev_targp,
1052 d - XFS_FSB_TO_BB(mp, 1), 1052 d - XFS_FSB_TO_BB(mp, 1),
1053 XFS_FSB_TO_B(mp, 1), 0); 1053 XFS_FSB_TO_BB(mp, 1), 0);
1054 if (!bp) { 1054 if (!bp) {
1055 xfs_warn(mp, "log device read failed"); 1055 xfs_warn(mp, "log device read failed");
1056 return EIO; 1056 return EIO;
diff --git a/fs/xfs/xfs_rtalloc.c b/fs/xfs/xfs_rtalloc.c
index ca4f31534a0a..7434d3fd483a 100644
--- a/fs/xfs/xfs_rtalloc.c
+++ b/fs/xfs/xfs_rtalloc.c
@@ -1872,9 +1872,9 @@ xfs_growfs_rt(
1872 /* 1872 /*
1873 * Read in the last block of the device, make sure it exists. 1873 * Read in the last block of the device, make sure it exists.
1874 */ 1874 */
1875 bp = xfs_buf_read_uncached(mp, mp->m_rtdev_targp, 1875 bp = xfs_buf_read_uncached(mp->m_rtdev_targp,
1876 XFS_FSB_TO_BB(mp, nrblocks - 1), 1876 XFS_FSB_TO_BB(mp, nrblocks - 1),
1877 XFS_FSB_TO_B(mp, 1), 0); 1877 XFS_FSB_TO_BB(mp, 1), 0);
1878 if (!bp) 1878 if (!bp)
1879 return EIO; 1879 return EIO;
1880 xfs_buf_relse(bp); 1880 xfs_buf_relse(bp);
@@ -2219,9 +2219,9 @@ xfs_rtmount_init(
2219 (unsigned long long) mp->m_sb.sb_rblocks); 2219 (unsigned long long) mp->m_sb.sb_rblocks);
2220 return XFS_ERROR(EFBIG); 2220 return XFS_ERROR(EFBIG);
2221 } 2221 }
2222 bp = xfs_buf_read_uncached(mp, mp->m_rtdev_targp, 2222 bp = xfs_buf_read_uncached(mp->m_rtdev_targp,
2223 d - XFS_FSB_TO_BB(mp, 1), 2223 d - XFS_FSB_TO_BB(mp, 1),
2224 XFS_FSB_TO_B(mp, 1), 0); 2224 XFS_FSB_TO_BB(mp, 1), 0);
2225 if (!bp) { 2225 if (!bp) {
2226 xfs_warn(mp, "realtime device size check failed"); 2226 xfs_warn(mp, "realtime device size check failed");
2227 return EIO; 2227 return EIO;
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c
index 64981d7e7375..445c224742b8 100644
--- a/fs/xfs/xfs_vnodeops.c
+++ b/fs/xfs/xfs_vnodeops.c
@@ -1966,7 +1966,7 @@ xfs_zero_remaining_bytes(
1966 1966
1967 bp = xfs_buf_get_uncached(XFS_IS_REALTIME_INODE(ip) ? 1967 bp = xfs_buf_get_uncached(XFS_IS_REALTIME_INODE(ip) ?
1968 mp->m_rtdev_targp : mp->m_ddev_targp, 1968 mp->m_rtdev_targp : mp->m_ddev_targp,
1969 mp->m_sb.sb_blocksize, XBF_DONT_BLOCK); 1969 BTOBB(mp->m_sb.sb_blocksize), XBF_DONT_BLOCK);
1970 if (!bp) 1970 if (!bp)
1971 return XFS_ERROR(ENOMEM); 1971 return XFS_ERROR(ENOMEM);
1972 1972