xfs: exclude never-released buffers from buftarg I/O accounting
[deliverable/linux.git] / fs / xfs / xfs_buf.c
index 9a2191b911377f94e38d81d57d5d037a7e19ae8b..c0bd5e0b244aa6581014c634d74591ac9ca58a5b 100644 (file)
@@ -815,7 +815,8 @@ xfs_buf_get_uncached(
        struct xfs_buf          *bp;
        DEFINE_SINGLE_BUF_MAP(map, XFS_BUF_DADDR_NULL, numblks);
 
-       bp = _xfs_buf_alloc(target, &map, 1, 0);
+       /* flags might contain irrelevant bits, pass only what we care about */
+       bp = _xfs_buf_alloc(target, &map, 1, flags & XBF_NO_IOACCT);
        if (unlikely(bp == NULL))
                goto fail;
 
@@ -1100,22 +1101,18 @@ xfs_bwrite(
        return error;
 }
 
-STATIC void
+static void
 xfs_buf_bio_end_io(
        struct bio              *bio)
 {
-       xfs_buf_t               *bp = (xfs_buf_t *)bio->bi_private;
+       struct xfs_buf          *bp = (struct xfs_buf *)bio->bi_private;
 
        /*
         * don't overwrite existing errors - otherwise we can lose errors on
         * buffers that require multiple bios to complete.
         */
-       if (bio->bi_error) {
-               spin_lock(&bp->b_lock);
-               if (!bp->b_io_error)
-                       bp->b_io_error = bio->bi_error;
-               spin_unlock(&bp->b_lock);
-       }
+       if (bio->bi_error)
+               cmpxchg(&bp->b_io_error, 0, bio->bi_error);
 
        if (!bp->b_error && xfs_buf_is_vmapped(bp) && (bp->b_flags & XBF_READ))
                invalidate_kernel_vmap_range(bp->b_addr, xfs_buf_vmap_len(bp));
@@ -1820,7 +1817,7 @@ __xfs_buf_delwri_submit(
 
        blk_start_plug(&plug);
        list_for_each_entry_safe(bp, n, io_list, b_list) {
-               bp->b_flags &= ~(_XBF_DELWRI_Q | XBF_ASYNC | XBF_WRITE_FAIL);
+               bp->b_flags &= ~(_XBF_DELWRI_Q | XBF_WRITE_FAIL);
                bp->b_flags |= XBF_WRITE | XBF_ASYNC;
 
                /*
This page took 0.02652 seconds and 5 git commands to generate.