]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux
authorAlex Elder <aelder@sgi.com>
Mon, 8 Aug 2011 12:06:24 +0000 (07:06 -0500)
committerAlex Elder <aelder@sgi.com>
Mon, 8 Aug 2011 12:06:24 +0000 (07:06 -0500)
1  2 
fs/xfs/linux-2.6/xfs_buf.c
fs/xfs/linux-2.6/xfs_sync.c
fs/xfs/xfs_bmap.c
fs/xfs/xfs_da_btree.c
fs/xfs/xfs_inode.c
fs/xfs/xfs_log_recover.c
fs/xfs/xfs_mount.c
fs/xfs/xfs_vnodeops.c

index 6bddce40de727c451e699c424f08212b0f0f24e5,d1fe74506c4c621aa8399b758126d2f8f0875c23..c57836dc778f9c9263770516ba0248dfe20c8aab
@@@ -596,7 -596,7 +596,7 @@@ _xfs_buf_read
        bp->b_flags |= flags & (XBF_READ | XBF_ASYNC | XBF_READ_AHEAD);
  
        status = xfs_buf_iorequest(bp);
 -      if (status || XFS_BUF_ISERROR(bp) || (flags & XBF_ASYNC))
 +      if (status || bp->b_error || (flags & XBF_ASYNC))
                return status;
        return xfs_buf_iowait(bp);
  }
@@@ -679,6 -679,7 +679,6 @@@ xfs_buf_read_uncached
        /* set up the buffer for a read IO */
        XFS_BUF_SET_ADDR(bp, daddr);
        XFS_BUF_READ(bp);
 -      XFS_BUF_BUSY(bp);
  
        xfsbdstrat(mp, bp);
        error = xfs_buf_iowait(bp);
@@@ -1068,7 -1069,7 +1068,7 @@@ xfs_bioerror
        /*
         * No need to wait until the buffer is unpinned, we aren't flushing it.
         */
 -      XFS_BUF_ERROR(bp, EIO);
 +      xfs_buf_ioerror(bp, EIO);
  
        /*
         * We're calling xfs_buf_ioend, so delete XBF_DONE flag.
@@@ -1093,7 -1094,7 +1093,7 @@@ STATIC in
  xfs_bioerror_relse(
        struct xfs_buf  *bp)
  {
 -      int64_t         fl = XFS_BUF_BFLAGS(bp);
 +      int64_t         fl = bp->b_flags;
        /*
         * No need to wait until the buffer is unpinned.
         * We aren't flushing it.
                 * There's no reason to mark error for
                 * ASYNC buffers.
                 */
 -              XFS_BUF_ERROR(bp, EIO);
 +              xfs_buf_ioerror(bp, EIO);
                XFS_BUF_FINISH_IOWAIT(bp);
        } else {
                xfs_buf_relse(bp);
@@@ -1223,6 -1224,9 +1223,9 @@@ _xfs_buf_ioapply
                rw = READ;
        }
  
+       /* we only use the buffer cache for meta-data */
+       rw |= REQ_META;
  next_chunk:
        atomic_inc(&bp->b_io_remaining);
        nr_pages = BIO_MAX_SECTORS >> (PAGE_SHIFT - BBSHIFT);
@@@ -1320,7 -1324,7 +1323,7 @@@ xfs_buf_offset
        struct page             *page;
  
        if (bp->b_flags & XBF_MAPPED)
 -              return XFS_BUF_PTR(bp) + offset;
 +              return bp->b_addr + offset;
  
        offset += bp->b_offset;
        page = bp->b_pages[offset >> PAGE_SHIFT];
@@@ -1480,7 -1484,7 +1483,7 @@@ xfs_setsize_buftarg_flags
        if (set_blocksize(btp->bt_bdev, sectorsize)) {
                xfs_warn(btp->bt_mount,
                        "Cannot set_blocksize to %u on device %s\n",
 -                      sectorsize, XFS_BUFTARG_NAME(btp));
 +                      sectorsize, xfs_buf_target_name(btp));
                return EINVAL;
        }
  
@@@ -1677,7 -1681,7 +1680,7 @@@ xfs_buf_delwri_split
        list_for_each_entry_safe(bp, n, dwq, b_list) {
                ASSERT(bp->b_flags & XBF_DELWRI);
  
 -              if (!XFS_BUF_ISPINNED(bp) && xfs_buf_trylock(bp)) {
 +              if (!xfs_buf_ispinned(bp) && xfs_buf_trylock(bp)) {
                        if (!force &&
                            time_before(jiffies, bp->b_queuetime + age)) {
                                xfs_buf_unlock(bp);
index a8500e92ae7270d3e85423b3b7f4777e4c7c5685,e4c938afb9100ab636df1339f378e718255dad90..4604f90f86a3dff55fee6ddef043ac5f5250a4b2
@@@ -179,6 -179,8 +179,8 @@@ restart
                if (error == EFSCORRUPTED)
                        break;
  
+               cond_resched();
        } while (nr_found && !done);
  
        if (skipped) {
@@@ -330,7 -332,7 +332,7 @@@ xfs_sync_fsdata
         * between there and here.
         */
        bp = xfs_getsb(mp, 0);
 -      if (XFS_BUF_ISPINNED(bp))
 +      if (xfs_buf_ispinned(bp))
                xfs_log_force(mp, 0);
  
        return xfs_bwrite(mp, bp);
@@@ -984,6 -986,8 +986,8 @@@ restart
  
                        *nr_to_scan -= XFS_LOOKUP_BATCH;
  
+                       cond_resched();
                } while (nr_found && !done && *nr_to_scan > 0);
  
                if (trylock && !done)
         * ensure that when we get more reclaimers than AGs we block rather
         * than spin trying to execute reclaim.
         */
-       if (trylock && skipped && *nr_to_scan > 0) {
+       if (skipped && (flags & SYNC_WAIT) && *nr_to_scan > 0) {
                trylock = 0;
                goto restart;
        }
@@@ -1019,44 -1023,38 +1023,38 @@@ xfs_reclaim_inodes
  }
  
  /*
-  * Inode cache shrinker.
+  * Scan a certain number of inodes for reclaim.
   *
   * When called we make sure that there is a background (fast) inode reclaim in
-  * progress, while we will throttle the speed of reclaim via doiing synchronous
+  * progress, while we will throttle the speed of reclaim via doing synchronous
   * reclaim of inodes. That means if we come across dirty inodes, we wait for
   * them to be cleaned, which we hope will not be very long due to the
   * background walker having already kicked the IO off on those dirty inodes.
   */
- static int
- xfs_reclaim_inode_shrink(
-       struct shrinker *shrink,
-       struct shrink_control *sc)
+ void
+ xfs_reclaim_inodes_nr(
+       struct xfs_mount        *mp,
+       int                     nr_to_scan)
  {
-       struct xfs_mount *mp;
-       struct xfs_perag *pag;
-       xfs_agnumber_t  ag;
-       int             reclaimable;
-       int nr_to_scan = sc->nr_to_scan;
-       gfp_t gfp_mask = sc->gfp_mask;
-       mp = container_of(shrink, struct xfs_mount, m_inode_shrink);
-       if (nr_to_scan) {
-               /* kick background reclaimer and push the AIL */
-               xfs_syncd_queue_reclaim(mp);
-               xfs_ail_push_all(mp->m_ail);
+       /* kick background reclaimer and push the AIL */
+       xfs_syncd_queue_reclaim(mp);
+       xfs_ail_push_all(mp->m_ail);
  
-               if (!(gfp_mask & __GFP_FS))
-                       return -1;
+       xfs_reclaim_inodes_ag(mp, SYNC_TRYLOCK | SYNC_WAIT, &nr_to_scan);
+ }
  
-               xfs_reclaim_inodes_ag(mp, SYNC_TRYLOCK | SYNC_WAIT,
-                                       &nr_to_scan);
-               /* terminate if we don't exhaust the scan */
-               if (nr_to_scan > 0)
-                       return -1;
-        }
+ /*
+  * Return the number of reclaimable inodes in the filesystem for
+  * the shrinker to determine how much to reclaim.
+  */
+ int
+ xfs_reclaim_inodes_count(
+       struct xfs_mount        *mp)
+ {
+       struct xfs_perag        *pag;
+       xfs_agnumber_t          ag = 0;
+       int                     reclaimable = 0;
  
-       reclaimable = 0;
-       ag = 0;
        while ((pag = xfs_perag_get_tag(mp, ag, XFS_ICI_RECLAIM_TAG))) {
                ag = pag->pag_agno + 1;
                reclaimable += pag->pag_ici_reclaimable;
        return reclaimable;
  }
  
- void
- xfs_inode_shrinker_register(
-       struct xfs_mount        *mp)
- {
-       mp->m_inode_shrink.shrink = xfs_reclaim_inode_shrink;
-       mp->m_inode_shrink.seeks = DEFAULT_SEEKS;
-       register_shrinker(&mp->m_inode_shrink);
- }
- void
- xfs_inode_shrinker_unregister(
-       struct xfs_mount        *mp)
- {
-       unregister_shrinker(&mp->m_inode_shrink);
- }
diff --combined fs/xfs/xfs_bmap.c
index 25cb2b2c427acef36ead13a18b58a54ca70393dd,ab3e5c6c464252c737457af110c6f52cc1e75145..452a291383abaf72c16b138769fe5a2eba2b1f7c
@@@ -414,7 -414,7 +414,7 @@@ xfs_bmap_add_attrfork_local
  
        if (ip->i_df.if_bytes <= XFS_IFORK_DSIZE(ip))
                return 0;
-       if ((ip->i_d.di_mode & S_IFMT) == S_IFDIR) {
+       if (S_ISDIR(ip->i_d.di_mode)) {
                mp = ip->i_mount;
                memset(&dargs, 0, sizeof(dargs));
                dargs.dp = ip;
@@@ -3344,8 -3344,7 +3344,7 @@@ xfs_bmap_local_to_extents
         * We don't want to deal with the case of keeping inode data inline yet.
         * So sending the data fork of a regular inode is invalid.
         */
-       ASSERT(!((ip->i_d.di_mode & S_IFMT) == S_IFREG &&
-                whichfork == XFS_DATA_FORK));
+       ASSERT(!(S_ISREG(ip->i_d.di_mode) && whichfork == XFS_DATA_FORK));
        ifp = XFS_IFORK_PTR(ip, whichfork);
        ASSERT(XFS_IFORK_FORMAT(ip, whichfork) == XFS_DINODE_FMT_LOCAL);
        flags = 0;
                ASSERT(args.len == 1);
                *firstblock = args.fsbno;
                bp = xfs_btree_get_bufl(args.mp, tp, args.fsbno, 0);
 -              memcpy((char *)XFS_BUF_PTR(bp), ifp->if_u1.if_data,
 -                      ifp->if_bytes);
 +              memcpy(bp->b_addr, ifp->if_u1.if_data, ifp->if_bytes);
                xfs_trans_log_buf(tp, bp, 0, ifp->if_bytes - 1);
                xfs_bmap_forkoff_reset(args.mp, ip, whichfork);
                xfs_idata_realloc(ip, -ifp->if_bytes, whichfork);
@@@ -4051,7 -4051,7 +4050,7 @@@ xfs_bmap_one_block
  
  #ifndef DEBUG
        if (whichfork == XFS_DATA_FORK) {
-               return ((ip->i_d.di_mode & S_IFMT) == S_IFREG) ?
+               return S_ISREG(ip->i_d.di_mode) ?
                        (ip->i_size == ip->i_mount->m_sb.sb_blocksize) :
                        (ip->i_d.di_size == ip->i_mount->m_sb.sb_blocksize);
        }
diff --combined fs/xfs/xfs_da_btree.c
index d56ccb70965562a433c6635991c96a0faad819db,5bfcb8779f9f63c93907aa45aa1a83bcfbf186a4..ee9d5427fcd4c2892577824417a186a59d8e9d88
@@@ -692,6 -692,24 +692,24 @@@ xfs_da_join(xfs_da_state_t *state
        return(error);
  }
  
+ #ifdef        DEBUG
+ static void
+ xfs_da_blkinfo_onlychild_validate(struct xfs_da_blkinfo *blkinfo, __u16 level)
+ {
+       __be16  magic = blkinfo->magic;
+       if (level == 1) {
+               ASSERT(magic == cpu_to_be16(XFS_DIR2_LEAFN_MAGIC) ||
+                      magic == cpu_to_be16(XFS_ATTR_LEAF_MAGIC));
+       } else
+               ASSERT(magic == cpu_to_be16(XFS_DA_NODE_MAGIC));
+       ASSERT(!blkinfo->forw);
+       ASSERT(!blkinfo->back);
+ }
+ #else /* !DEBUG */
+ #define       xfs_da_blkinfo_onlychild_validate(blkinfo, level)
+ #endif        /* !DEBUG */
  /*
   * We have only one entry in the root.  Copy the only remaining child of
   * the old root to block 0 as the new root node.
@@@ -700,8 -718,6 +718,6 @@@ STATIC in
  xfs_da_root_join(xfs_da_state_t *state, xfs_da_state_blk_t *root_blk)
  {
        xfs_da_intnode_t *oldroot;
-       /* REFERENCED */
-       xfs_da_blkinfo_t *blkinfo;
        xfs_da_args_t *args;
        xfs_dablk_t child;
        xfs_dabuf_t *bp;
        if (error)
                return(error);
        ASSERT(bp != NULL);
-       blkinfo = bp->data;
-       if (be16_to_cpu(oldroot->hdr.level) == 1) {
-               ASSERT(blkinfo->magic == cpu_to_be16(XFS_DIR2_LEAFN_MAGIC) ||
-                      blkinfo->magic == cpu_to_be16(XFS_ATTR_LEAF_MAGIC));
-       } else {
-               ASSERT(blkinfo->magic == cpu_to_be16(XFS_DA_NODE_MAGIC));
-       }
-       ASSERT(!blkinfo->forw);
-       ASSERT(!blkinfo->back);
+       xfs_da_blkinfo_onlychild_validate(bp->data,
+                                       be16_to_cpu(oldroot->hdr.level));
        memcpy(root_blk->bp->data, bp->data, state->blocksize);
        xfs_da_log_buf(args->trans, root_blk->bp, 0, state->blocksize - 1);
        error = xfs_da_shrink_inode(args, child, bp);
@@@ -2040,7 -2050,7 +2050,7 @@@ xfs_da_do_buf
                case 0:
                        bp = xfs_trans_get_buf(trans, mp->m_ddev_targp,
                                mappedbno, nmapped, 0);
 -                      error = bp ? XFS_BUF_GETERROR(bp) : XFS_ERROR(EIO);
 +                      error = bp ? bp->b_error : XFS_ERROR(EIO);
                        break;
                case 1:
                case 2:
@@@ -2258,7 -2268,7 +2268,7 @@@ xfs_da_buf_make(int nbuf, xfs_buf_t **b
                dabuf->nbuf = 1;
                bp = bps[0];
                dabuf->bbcount = (short)BTOBB(XFS_BUF_COUNT(bp));
 -              dabuf->data = XFS_BUF_PTR(bp);
 +              dabuf->data = bp->b_addr;
                dabuf->bps[0] = bp;
        } else {
                dabuf->nbuf = nbuf;
                dabuf->data = kmem_alloc(BBTOB(dabuf->bbcount), KM_SLEEP);
                for (i = off = 0; i < nbuf; i++, off += XFS_BUF_COUNT(bp)) {
                        bp = bps[i];
 -                      memcpy((char *)dabuf->data + off, XFS_BUF_PTR(bp),
 +                      memcpy((char *)dabuf->data + off, bp->b_addr,
                                XFS_BUF_COUNT(bp));
                }
        }
@@@ -2292,8 -2302,8 +2302,8 @@@ xfs_da_buf_clean(xfs_dabuf_t *dabuf
                for (i = off = 0; i < dabuf->nbuf;
                                i++, off += XFS_BUF_COUNT(bp)) {
                        bp = dabuf->bps[i];
 -                      memcpy(XFS_BUF_PTR(bp), (char *)dabuf->data + off,
 -                              XFS_BUF_COUNT(bp));
 +                      memcpy(bp->b_addr, dabuf->data + off,
 +                                              XFS_BUF_COUNT(bp));
                }
        }
  }
@@@ -2330,7 -2340,7 +2340,7 @@@ xfs_da_log_buf(xfs_trans_t *tp, xfs_dab
  
        ASSERT(dabuf->nbuf && dabuf->data && dabuf->bbcount && dabuf->bps[0]);
        if (dabuf->nbuf == 1) {
 -              ASSERT(dabuf->data == (void *)XFS_BUF_PTR(dabuf->bps[0]));
 +              ASSERT(dabuf->data == dabuf->bps[0]->b_addr);
                xfs_trans_log_buf(tp, dabuf->bps[0], first, last);
                return;
        }
diff --combined fs/xfs/xfs_inode.c
index 76ee2c5371ca7895dd25387c37db164ed2015fcb,2fcca4b03ed389ef048f744e421289e2dc3bafc8..0239a7c7c886a2c83a74352ee0504082cb328e26
@@@ -368,7 -368,7 +368,7 @@@ xfs_iformat
                        /*
                         * no local regular files yet
                         */
-                       if (unlikely((be16_to_cpu(dip->di_mode) & S_IFMT) == S_IFREG)) {
+                       if (unlikely(S_ISREG(be16_to_cpu(dip->di_mode)))) {
                                xfs_warn(ip->i_mount,
                        "corrupt inode %Lu (local format for regular file).",
                                        (unsigned long long) ip->i_ino);
@@@ -1040,7 -1040,7 +1040,7 @@@ xfs_ialloc
  
        if (pip && XFS_INHERIT_GID(pip)) {
                ip->i_d.di_gid = pip->i_d.di_gid;
-               if ((pip->i_d.di_mode & S_ISGID) && (mode & S_IFMT) == S_IFDIR) {
+               if ((pip->i_d.di_mode & S_ISGID) && S_ISDIR(mode)) {
                        ip->i_d.di_mode |= S_ISGID;
                }
        }
                if (pip && (pip->i_d.di_flags & XFS_DIFLAG_ANY)) {
                        uint    di_flags = 0;
  
-                       if ((mode & S_IFMT) == S_IFDIR) {
+                       if (S_ISDIR(mode)) {
                                if (pip->i_d.di_flags & XFS_DIFLAG_RTINHERIT)
                                        di_flags |= XFS_DIFLAG_RTINHERIT;
                                if (pip->i_d.di_flags & XFS_DIFLAG_EXTSZINHERIT) {
                                        di_flags |= XFS_DIFLAG_EXTSZINHERIT;
                                        ip->i_d.di_extsize = pip->i_d.di_extsize;
                                }
-                       } else if ((mode & S_IFMT) == S_IFREG) {
+                       } else if (S_ISREG(mode)) {
                                if (pip->i_d.di_flags & XFS_DIFLAG_RTINHERIT)
                                        di_flags |= XFS_DIFLAG_REALTIME;
                                if (pip->i_d.di_flags & XFS_DIFLAG_EXTSZINHERIT) {
@@@ -1188,7 -1188,7 +1188,7 @@@ xfs_isize_check
        int                     nimaps;
        xfs_bmbt_irec_t         imaps[2];
  
-       if ((ip->i_d.di_mode & S_IFMT) != S_IFREG)
+       if (!S_ISREG(ip->i_d.di_mode))
                return;
  
        if (XFS_IS_REALTIME_INODE(ip))
@@@ -1828,7 -1828,7 +1828,7 @@@ xfs_ifree
        ASSERT(ip->i_d.di_nextents == 0);
        ASSERT(ip->i_d.di_anextents == 0);
        ASSERT((ip->i_d.di_size == 0 && ip->i_size == 0) ||
-              ((ip->i_d.di_mode & S_IFMT) != S_IFREG));
+              (!S_ISREG(ip->i_d.di_mode)));
        ASSERT(ip->i_d.di_nblocks == 0);
  
        /*
@@@ -2473,7 -2473,7 +2473,7 @@@ cluster_corrupt_out
                if (bp->b_iodone) {
                        XFS_BUF_UNDONE(bp);
                        XFS_BUF_STALE(bp);
 -                      XFS_BUF_ERROR(bp,EIO);
 +                      xfs_buf_ioerror(bp, EIO);
                        xfs_buf_ioend(bp, 0);
                } else {
                        XFS_BUF_STALE(bp);
@@@ -2585,7 -2585,7 +2585,7 @@@ xfs_iflush
         * If the buffer is pinned then push on the log now so we won't
         * get stuck waiting in the write for too long.
         */
 -      if (XFS_BUF_ISPINNED(bp))
 +      if (xfs_buf_ispinned(bp))
                xfs_log_force(mp, 0);
  
        /*
@@@ -2671,7 -2671,7 +2671,7 @@@ xfs_iflush_int
                        __func__, ip->i_ino, ip, ip->i_d.di_magic);
                goto corrupt_out;
        }
-       if ((ip->i_d.di_mode & S_IFMT) == S_IFREG) {
+       if (S_ISREG(ip->i_d.di_mode)) {
                if (XFS_TEST_ERROR(
                    (ip->i_d.di_format != XFS_DINODE_FMT_EXTENTS) &&
                    (ip->i_d.di_format != XFS_DINODE_FMT_BTREE),
                                __func__, ip->i_ino, ip);
                        goto corrupt_out;
                }
-       } else if ((ip->i_d.di_mode & S_IFMT) == S_IFDIR) {
+       } else if (S_ISDIR(ip->i_d.di_mode)) {
                if (XFS_TEST_ERROR(
                    (ip->i_d.di_format != XFS_DINODE_FMT_EXTENTS) &&
                    (ip->i_d.di_format != XFS_DINODE_FMT_BTREE) &&
diff --combined fs/xfs/xfs_log_recover.c
index 93786e518d87c9370ba957485ec67205220a61e3,052a2c0ec5fbecaa2e6d0aebffc8289bdc43f465..1076b7effcdc6364b4a78829e804ea050d96db21
@@@ -147,7 -147,7 +147,7 @@@ xlog_align
        xfs_daddr_t     offset = blk_no & ((xfs_daddr_t)log->l_sectBBsize - 1);
  
        ASSERT(BBTOB(offset + nbblks) <= XFS_BUF_SIZE(bp));
 -      return XFS_BUF_PTR(bp) + BBTOB(offset);
 +      return bp->b_addr + BBTOB(offset);
  }
  
  
@@@ -178,7 -178,9 +178,7 @@@ xlog_bread_noalign
  
        XFS_BUF_SET_ADDR(bp, log->l_logBBstart + blk_no);
        XFS_BUF_READ(bp);
 -      XFS_BUF_BUSY(bp);
        XFS_BUF_SET_COUNT(bp, BBTOB(nbblks));
 -      XFS_BUF_SET_TARGET(bp, log->l_mp->m_logdev_targp);
  
        xfsbdstrat(log->l_mp, bp);
        error = xfs_buf_iowait(bp);
@@@ -218,18 -220,18 +218,18 @@@ xlog_bread_offset
        xfs_buf_t       *bp,
        xfs_caddr_t     offset)
  {
 -      xfs_caddr_t     orig_offset = XFS_BUF_PTR(bp);
 +      xfs_caddr_t     orig_offset = bp->b_addr;
        int             orig_len = bp->b_buffer_length;
        int             error, error2;
  
 -      error = XFS_BUF_SET_PTR(bp, offset, BBTOB(nbblks));
 +      error = xfs_buf_associate_memory(bp, offset, BBTOB(nbblks));
        if (error)
                return error;
  
        error = xlog_bread_noalign(log, blk_no, nbblks, bp);
  
        /* must reset buffer pointer even on error */
 -      error2 = XFS_BUF_SET_PTR(bp, orig_offset, orig_len);
 +      error2 = xfs_buf_associate_memory(bp, orig_offset, orig_len);
        if (error)
                return error;
        return error2;
@@@ -264,9 -266,11 +264,9 @@@ xlog_bwrite
  
        XFS_BUF_SET_ADDR(bp, log->l_logBBstart + blk_no);
        XFS_BUF_ZEROFLAGS(bp);
 -      XFS_BUF_BUSY(bp);
 -      XFS_BUF_HOLD(bp);
 +      xfs_buf_hold(bp);
        xfs_buf_lock(bp);
        XFS_BUF_SET_COUNT(bp, BBTOB(nbblks));
 -      XFS_BUF_SET_TARGET(bp, log->l_mp->m_logdev_targp);
  
        if ((error = xfs_bwrite(log->l_mp, bp)))
                xfs_ioerror_alert("xlog_bwrite", log->l_mp,
@@@ -356,7 -360,7 +356,7 @@@ STATIC voi
  xlog_recover_iodone(
        struct xfs_buf  *bp)
  {
 -      if (XFS_BUF_GETERROR(bp)) {
 +      if (bp->b_error) {
                /*
                 * We're not going to bother about retrying
                 * this during recovery. One strike!
@@@ -1258,7 -1262,7 +1258,7 @@@ xlog_write_log_records
                 */
                ealign = round_down(end_block, sectbb);
                if (j == 0 && (start_block + endcount > ealign)) {
 -                      offset = XFS_BUF_PTR(bp) + BBTOB(ealign - start_block);
 +                      offset = bp->b_addr + BBTOB(ealign - start_block);
                        error = xlog_bread_offset(log, ealign, sectbb,
                                                        bp, offset);
                        if (error)
@@@ -2131,14 -2135,15 +2131,14 @@@ xlog_recover_buffer_pass2
  
        bp = xfs_buf_read(mp->m_ddev_targp, buf_f->blf_blkno, buf_f->blf_len,
                          buf_flags);
 -      if (XFS_BUF_ISERROR(bp)) {
 +      error = xfs_buf_geterror(bp);
 +      if (error) {
                xfs_ioerror_alert("xlog_recover_do..(read#1)", mp,
                                  bp, buf_f->blf_blkno);
 -              error = XFS_BUF_GETERROR(bp);
                xfs_buf_relse(bp);
                return error;
        }
  
 -      error = 0;
        if (buf_f->blf_flags & XFS_BLF_INODE_BUF) {
                error = xlog_recover_do_inode_buffer(mp, item, bp, buf_f);
        } else if (buf_f->blf_flags &
@@@ -2222,13 -2227,14 +2222,13 @@@ xlog_recover_inode_pass2
  
        bp = xfs_buf_read(mp->m_ddev_targp, in_f->ilf_blkno, in_f->ilf_len,
                          XBF_LOCK);
 -      if (XFS_BUF_ISERROR(bp)) {
 +      error = xfs_buf_geterror(bp);
 +      if (error) {
                xfs_ioerror_alert("xlog_recover_do..(read#2)", mp,
                                  bp, in_f->ilf_blkno);
 -              error = XFS_BUF_GETERROR(bp);
                xfs_buf_relse(bp);
                goto error;
        }
 -      error = 0;
        ASSERT(in_f->ilf_fields & XFS_ILOG_CORE);
        dip = (xfs_dinode_t *)xfs_buf_offset(bp, in_f->ilf_boffset);
  
        /* Take the opportunity to reset the flush iteration count */
        dicp->di_flushiter = 0;
  
-       if (unlikely((dicp->di_mode & S_IFMT) == S_IFREG)) {
+       if (unlikely(S_ISREG(dicp->di_mode))) {
                if ((dicp->di_format != XFS_DINODE_FMT_EXTENTS) &&
                    (dicp->di_format != XFS_DINODE_FMT_BTREE)) {
                        XFS_CORRUPTION_ERROR("xlog_recover_inode_pass2(3)",
                        error = EFSCORRUPTED;
                        goto error;
                }
-       } else if (unlikely((dicp->di_mode & S_IFMT) == S_IFDIR)) {
+       } else if (unlikely(S_ISDIR(dicp->di_mode))) {
                if ((dicp->di_format != XFS_DINODE_FMT_EXTENTS) &&
                    (dicp->di_format != XFS_DINODE_FMT_BTREE) &&
                    (dicp->di_format != XFS_DINODE_FMT_LOCAL)) {
@@@ -3431,7 -3437,7 +3431,7 @@@ xlog_do_recovery_pass
                        /*
                         * Check for header wrapping around physical end-of-log
                         */
 -                      offset = XFS_BUF_PTR(hbp);
 +                      offset = hbp->b_addr;
                        split_hblks = 0;
                        wrapped_hblks = 0;
                        if (blk_no + hblks <= log->l_logBBsize) {
                        } else {
                                /* This log record is split across the
                                 * physical end of log */
 -                              offset = XFS_BUF_PTR(dbp);
 +                              offset = dbp->b_addr;
                                split_bblks = 0;
                                if (blk_no != log->l_logBBsize) {
                                        /* some data is before the physical
diff --combined fs/xfs/xfs_mount.c
index 49ecc170f7499ee157561163f8a350c6f601227a,092e16ae4d9d69615bb2c1ca48b74e8d983d5979..0081657ad985ee27417ba4b73c142cb3d43e78b7
@@@ -1331,7 -1331,7 +1331,7 @@@ xfs_mountfs
  
        ASSERT(rip != NULL);
  
-       if (unlikely((rip->i_d.di_mode & S_IFMT) != S_IFDIR)) {
+       if (unlikely(!S_ISDIR(rip->i_d.di_mode))) {
                xfs_warn(mp, "corrupted root inode %llu: not a directory",
                        (unsigned long long)rip->i_ino);
                xfs_iunlock(rip, XFS_ILOCK_EXCL);
@@@ -1615,7 -1615,7 +1615,7 @@@ xfs_unmountfs_writesb(xfs_mount_t *mp
                XFS_BUF_UNDELAYWRITE(sbp);
                XFS_BUF_WRITE(sbp);
                XFS_BUF_UNASYNC(sbp);
 -              ASSERT(XFS_BUF_TARGET(sbp) == mp->m_ddev_targp);
 +              ASSERT(sbp->b_target == mp->m_ddev_targp);
                xfsbdstrat(mp, sbp);
                error = xfs_buf_iowait(sbp);
                if (error)
@@@ -1938,7 -1938,7 +1938,7 @@@ xfs_getsb
                xfs_buf_lock(bp);
        }
  
 -      XFS_BUF_HOLD(bp);
 +      xfs_buf_hold(bp);
        ASSERT(XFS_BUF_ISDONE(bp));
        return bp;
  }
diff --combined fs/xfs/xfs_vnodeops.c
index 3ee5f8a2858b160a6a4ef0583e5375a4704c5eea,9322e13f0c637724c10a6491e2b2841534817c87..dd05360ad56fb9337d77c749ba9b737015dc7ccf
@@@ -83,7 -83,7 +83,7 @@@ xfs_readlink_bmap
  
                bp = xfs_buf_read(mp->m_ddev_targp, d, BTOBB(byte_cnt),
                                  XBF_LOCK | XBF_MAPPED | XBF_DONT_BLOCK);
 -              error = XFS_BUF_GETERROR(bp);
 +              error = xfs_buf_geterror(bp);
                if (error) {
                        xfs_ioerror_alert("xfs_readlink",
                                  ip->i_mount, bp, XFS_BUF_ADDR(bp));
@@@ -94,7 -94,7 +94,7 @@@
                        byte_cnt = pathlen;
                pathlen -= byte_cnt;
  
 -              memcpy(link, XFS_BUF_PTR(bp), byte_cnt);
 +              memcpy(link, bp->b_addr, byte_cnt);
                xfs_buf_relse(bp);
        }
  
@@@ -121,7 -121,7 +121,7 @@@ xfs_readlink
  
        xfs_ilock(ip, XFS_ILOCK_SHARED);
  
-       ASSERT((ip->i_d.di_mode & S_IFMT) == S_IFLNK);
+       ASSERT(S_ISLNK(ip->i_d.di_mode));
        ASSERT(ip->i_d.di_size <= MAXPATHLEN);
  
        pathlen = ip->i_d.di_size;
@@@ -529,7 -529,7 +529,7 @@@ xfs_release
        if (ip->i_d.di_nlink == 0)
                return 0;
  
-       if ((((ip->i_d.di_mode & S_IFMT) == S_IFREG) &&
+       if ((S_ISREG(ip->i_d.di_mode) &&
             ((ip->i_size > 0) || (VN_CACHED(VFS_I(ip)) > 0 ||
               ip->i_delayed_blks > 0)) &&
             (ip->i_df.if_flags & XFS_IFEXTENTS))  &&
@@@ -610,7 -610,7 +610,7 @@@ xfs_inactive
        truncate = ((ip->i_d.di_nlink == 0) &&
            ((ip->i_d.di_size != 0) || (ip->i_size != 0) ||
             (ip->i_d.di_nextents > 0) || (ip->i_delayed_blks > 0)) &&
-           ((ip->i_d.di_mode & S_IFMT) == S_IFREG));
+           S_ISREG(ip->i_d.di_mode));
  
        mp = ip->i_mount;
  
                goto out;
  
        if (ip->i_d.di_nlink != 0) {
-               if ((((ip->i_d.di_mode & S_IFMT) == S_IFREG) &&
+               if ((S_ISREG(ip->i_d.di_mode) &&
                       ((ip->i_size > 0) || (VN_CACHED(VFS_I(ip)) > 0 ||
                         ip->i_delayed_blks > 0)) &&
                      (ip->i_df.if_flags & XFS_IFEXTENTS) &&
                        xfs_iunlock(ip, XFS_IOLOCK_EXCL | XFS_ILOCK_EXCL);
                        return VN_INACTIVE_CACHE;
                }
-       } else if ((ip->i_d.di_mode & S_IFMT) == S_IFLNK) {
+       } else if (S_ISLNK(ip->i_d.di_mode)) {
  
                /*
                 * If we get an error while cleaning up a
@@@ -1648,13 -1648,13 +1648,13 @@@ xfs_symlink
                        byte_cnt = XFS_FSB_TO_B(mp, mval[n].br_blockcount);
                        bp = xfs_trans_get_buf(tp, mp->m_ddev_targp, d,
                                               BTOBB(byte_cnt), 0);
 -                      ASSERT(bp && !XFS_BUF_GETERROR(bp));
 +                      ASSERT(!xfs_buf_geterror(bp));
                        if (pathlen < byte_cnt) {
                                byte_cnt = pathlen;
                        }
                        pathlen -= byte_cnt;
  
 -                      memcpy(XFS_BUF_PTR(bp), cur_chunk, byte_cnt);
 +                      memcpy(bp->b_addr, cur_chunk, byte_cnt);
                        cur_chunk += byte_cnt;
  
                        xfs_trans_log_buf(tp, bp, 0, byte_cnt - 1);
@@@ -1999,7 -1999,7 +1999,7 @@@ xfs_zero_remaining_bytes
                                          mp, bp, XFS_BUF_ADDR(bp));
                        break;
                }
 -              memset(XFS_BUF_PTR(bp) +
 +              memset(bp->b_addr +
                        (offset - XFS_FSB_TO_B(mp, imap.br_startoff)),
                      0, lastoffset - offset + 1);
                XFS_BUF_UNDONE(bp);