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;
 
        /*
        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;
                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++) {
         * 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)) {
        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;
 }
                pageaddr += PAGE_SIZE;
        }
 
-       bp->b_count_desired = len;
+       bp->b_io_length = BTOBB(len);
        bp->b_length = BTOBB(buflen);
        bp->b_flags |= XBF_MAPPED;
 
        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
        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;
                        break;
 
                offset = 0;
-               sector += nbytes >> BBSHIFT;
+               sector += BTOBB(nbytes);
                size -= nbytes;
                total_nr_pages--;
        }
                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));
 
 
        struct list_head        b_list;
        struct xfs_perag        *b_pag;         /* contains rbtree root */
        xfs_buftarg_t           *b_target;      /* buffer target (device) */
-       size_t                  b_count_desired;/* desired transfer size */
        void                    *b_addr;        /* virtual address of buffer */
        struct work_struct      b_iodone_work;
        xfs_buf_iodone_t        b_iodone;       /* I/O completion function */
        struct xfs_trans        *b_transp;
        struct page             **b_pages;      /* array of page pointers */
        struct page             *b_page_array[XB_PAGES]; /* inline pages */
+       int                     b_io_length;    /* IO size in BBs */
        atomic_t                b_pin_count;    /* pin count */
        atomic_t                b_io_remaining; /* #outstanding I/O requests */
        unsigned int            b_page_count;   /* size of page array */
 
 #define XFS_BUF_ADDR(bp)               ((bp)->b_bn)
 #define XFS_BUF_SET_ADDR(bp, bno)      ((bp)->b_bn = (xfs_daddr_t)(bno))
-#define XFS_BUF_COUNT(bp)              ((bp)->b_count_desired)
-#define XFS_BUF_SET_COUNT(bp, cnt)     ((bp)->b_count_desired = (cnt))
 
 static inline void xfs_buf_set_ref(struct xfs_buf *bp, int lru_ref)
 {
 
        ASSERT(bip->bli_logged != NULL);
 
        bp = bip->bli_buf;
-       ASSERT(XFS_BUF_COUNT(bp) > 0);
+       ASSERT(bp->b_length > 0);
        ASSERT(bp->b_addr != NULL);
        orig = bip->bli_orig;
        buffer = bp->b_addr;
-       for (x = 0; x < XFS_BUF_COUNT(bp); x++) {
+       for (x = 0; x < BBTOB(bp->b_length); x++) {
                if (orig[x] != buffer[x] && !btst(bip->bli_logged, x)) {
                        xfs_emerg(bp->b_mount,
                                "%s: bip %x buffer %x orig %x index %d",
         * truncate any pieces.  map_size is the size of the
         * bitmap needed to describe the chunks of the buffer.
         */
-       chunks = (int)((XFS_BUF_COUNT(bp) + (XFS_BLF_CHUNK - 1)) >> XFS_BLF_SHIFT);
+       chunks = (int)((BBTOB(bp->b_length) + (XFS_BLF_CHUNK - 1)) >>
+                                                               XFS_BLF_SHIFT);
        map_size = (int)((chunks + NBWORD) >> BIT_TO_WORD_SHIFT);
 
        bip = (xfs_buf_log_item_t*)kmem_zone_zalloc(xfs_buf_item_zone,
        xfs_buf_hold(bp);
        bip->bli_format.blf_type = XFS_LI_BUF;
        bip->bli_format.blf_blkno = (__int64_t)XFS_BUF_ADDR(bp);
-       bip->bli_format.blf_len = (ushort)BTOBB(XFS_BUF_COUNT(bp));
+       bip->bli_format.blf_len = (ushort)bp->b_length;
        bip->bli_format.blf_map_size = map_size;
 
 #ifdef XFS_TRANS_DEBUG
         * the buffer to indicate which bytes the callers have asked
         * to have logged.
         */
-       bip->bli_orig = (char *)kmem_alloc(XFS_BUF_COUNT(bp), KM_SLEEP);
-       memcpy(bip->bli_orig, bp->b_addr, XFS_BUF_COUNT(bp));
-       bip->bli_logged = (char *)kmem_zalloc(XFS_BUF_COUNT(bp) / NBBY, KM_SLEEP);
+       bip->bli_orig = kmem_alloc(BBTOB(bp->b_length), KM_SLEEP);
+       memcpy(bip->bli_orig, bp->b_addr, BBTOB(bp->b_length));
+       bip->bli_logged = kmem_zalloc(BBTOB(bp->b_length) / NBBY, KM_SLEEP);
 #endif
 
        /*
 
        if (nbuf == 1) {
                dabuf->nbuf = 1;
                bp = bps[0];
-               dabuf->bbcount = (short)BTOBB(XFS_BUF_COUNT(bp));
+               dabuf->bbcount = bp->b_length;
                dabuf->data = bp->b_addr;
                dabuf->bps[0] = bp;
        } else {
                dabuf->nbuf = nbuf;
                for (i = 0, dabuf->bbcount = 0; i < nbuf; i++) {
                        dabuf->bps[i] = bp = bps[i];
-                       dabuf->bbcount += BTOBB(XFS_BUF_COUNT(bp));
+                       dabuf->bbcount += bp->b_length;
                }
                dabuf->data = kmem_alloc(BBTOB(dabuf->bbcount), KM_SLEEP);
-               for (i = off = 0; i < nbuf; i++, off += XFS_BUF_COUNT(bp)) {
+               for (i = off = 0; i < nbuf; i++, off += BBTOB(bp->b_length)) {
                        bp = bps[i];
                        memcpy((char *)dabuf->data + off, bp->b_addr,
-                               XFS_BUF_COUNT(bp));
+                               BBTOB(bp->b_length));
                }
        }
        return dabuf;
                ASSERT(dabuf->nbuf > 1);
                dabuf->dirty = 0;
                for (i = off = 0; i < dabuf->nbuf;
-                               i++, off += XFS_BUF_COUNT(bp)) {
+                               i++, off += BBTOB(bp->b_length)) {
                        bp = dabuf->bps[i];
                        memcpy(bp->b_addr, dabuf->data + off,
-                                               XFS_BUF_COUNT(bp));
+                                               BBTOB(bp->b_length));
                }
        }
 }
        }
        dabuf->dirty = 1;
        ASSERT(first <= last);
-       for (i = off = 0; i < dabuf->nbuf; i++, off += XFS_BUF_COUNT(bp)) {
+       for (i = off = 0; i < dabuf->nbuf; i++, off += BBTOB(bp->b_length)) {
                bp = dabuf->bps[i];
                f = off;
-               l = f + XFS_BUF_COUNT(bp) - 1;
+               l = f + BBTOB(bp->b_length) - 1;
                if (f < first)
                        f = first;
                if (l > last)
 
        } else {
                iclog->ic_bwritecnt = 1;
        }
-       XFS_BUF_SET_COUNT(bp, count);
+       bp->b_io_length = BTOBB(count);
        bp->b_fspriv = iclog;
        XFS_BUF_ZEROFLAGS(bp);
        XFS_BUF_ASYNC(bp);
 
 
        XFS_BUF_SET_ADDR(bp, log->l_logBBstart + blk_no);
        XFS_BUF_READ(bp);
-       XFS_BUF_SET_COUNT(bp, BBTOB(nbblks));
+       bp->b_io_length = nbblks;
        bp->b_error = 0;
 
        xfsbdstrat(log->l_mp, bp);
        XFS_BUF_ZEROFLAGS(bp);
        xfs_buf_hold(bp);
        xfs_buf_lock(bp);
-       XFS_BUF_SET_COUNT(bp, BBTOB(nbblks));
+       bp->b_io_length = nbblks;
        bp->b_error = 0;
 
        error = xfs_bwrite(bp);
 
        trace_xfs_log_recover_buf_inode_buf(mp->m_log, buf_f);
 
-       inodes_per_buf = XFS_BUF_COUNT(bp) >> mp->m_sb.sb_inodelog;
+       inodes_per_buf = BBTOB(bp->b_io_length) >> mp->m_sb.sb_inodelog;
        for (i = 0; i < inodes_per_buf; i++) {
                next_unlinked_offset = (i * mp->m_sb.sb_inodesize) +
                        offsetof(xfs_dinode_t, di_next_unlinked);
 
                ASSERT(item->ri_buf[item_index].i_addr != NULL);
                ASSERT((item->ri_buf[item_index].i_len % XFS_BLF_CHUNK) == 0);
-               ASSERT((reg_buf_offset + reg_buf_bytes) <= XFS_BUF_COUNT(bp));
+               ASSERT((reg_buf_offset + reg_buf_bytes) <=
+                                                       BBTOB(bp->b_io_length));
 
                /*
                 * The current logged region contains a copy of the
                ASSERT(nbits > 0);
                ASSERT(item->ri_buf[i].i_addr != NULL);
                ASSERT(item->ri_buf[i].i_len % XFS_BLF_CHUNK == 0);
-               ASSERT(XFS_BUF_COUNT(bp) >=
-                      ((uint)bit << XFS_BLF_SHIFT)+(nbits<<XFS_BLF_SHIFT));
+               ASSERT(BBTOB(bp->b_io_length) >=
+                      ((uint)bit << XFS_BLF_SHIFT) + (nbits << XFS_BLF_SHIFT));
 
                /*
                 * Do a sanity check if this is a dquot buffer. Just checking
         */
        if (XFS_DINODE_MAGIC ==
            be16_to_cpu(*((__be16 *)xfs_buf_offset(bp, 0))) &&
-           (XFS_BUF_COUNT(bp) != MAX(log->l_mp->m_sb.sb_blocksize,
+           (BBTOB(bp->b_io_length) != MAX(log->l_mp->m_sb.sb_blocksize,
                        (__uint32_t)XFS_INODE_CLUSTER_SIZE(log->l_mp)))) {
                xfs_buf_stale(bp);
                error = xfs_bwrite(bp);
 
                if (blip->bli_item.li_type == XFS_LI_BUF &&
                    blip->bli_buf->b_target == target &&
                    XFS_BUF_ADDR(blip->bli_buf) == blkno &&
-                   XFS_BUF_COUNT(blip->bli_buf) == len)
+                   BBTOB(blip->bli_buf->b_length) == len)
                        return blip->bli_buf;
        }
 
 
        ASSERT(bp->b_transp == tp);
        ASSERT(bip != NULL);
-       ASSERT((first <= last) && (last < XFS_BUF_COUNT(bp)));
+       ASSERT(first <= last && last < BBTOB(bp->b_length));
        ASSERT(bp->b_iodone == NULL ||
               bp->b_iodone == xfs_buf_iodone_callbacks);