xfs: per-filesystem stats counter implementation
[deliverable/linux.git] / fs / xfs / xfs_buf.c
index 01bd6781974eab6ebbcaf50a294dc27a08b07f51..90815c22b22df0227701ce2e2b30feef41fef2bd 100644 (file)
@@ -201,7 +201,7 @@ _xfs_buf_alloc(
        atomic_set(&bp->b_pin_count, 0);
        init_waitqueue_head(&bp->b_waiters);
 
-       XFS_STATS_INC(xb_create);
+       XFS_STATS_INC(target->bt_mount, xb_create);
        trace_xfs_buf_init(bp, _RET_IP_);
 
        return bp;
@@ -357,12 +357,12 @@ retry:
                "possible memory allocation deadlock in %s (mode:0x%x)",
                                        __func__, gfp_mask);
 
-                       XFS_STATS_INC(xb_page_retries);
+                       XFS_STATS_INC(bp->b_target->bt_mount, xb_page_retries);
                        congestion_wait(BLK_RW_ASYNC, HZ/50);
                        goto retry;
                }
 
-               XFS_STATS_INC(xb_page_found);
+               XFS_STATS_INC(bp->b_target->bt_mount, xb_page_found);
 
                nbytes = min_t(size_t, size, PAGE_SIZE - offset);
                size -= nbytes;
@@ -438,7 +438,6 @@ _xfs_buf_find(
        xfs_buf_flags_t         flags,
        xfs_buf_t               *new_bp)
 {
-       size_t                  numbytes;
        struct xfs_perag        *pag;
        struct rb_node          **rbp;
        struct rb_node          *parent;
@@ -450,10 +449,9 @@ _xfs_buf_find(
 
        for (i = 0; i < nmaps; i++)
                numblks += map[i].bm_len;
-       numbytes = BBTOB(numblks);
 
        /* Check for IOs smaller than the sector size / not sector aligned */
-       ASSERT(!(numbytes < btp->bt_meta_sectorsize));
+       ASSERT(!(BBTOB(numblks) < btp->bt_meta_sectorsize));
        ASSERT(!(BBTOB(blkno) & (xfs_off_t)btp->bt_meta_sectormask));
 
        /*
@@ -518,7 +516,7 @@ _xfs_buf_find(
                new_bp->b_pag = pag;
                spin_unlock(&pag->pag_buf_lock);
        } else {
-               XFS_STATS_INC(xb_miss_locked);
+               XFS_STATS_INC(btp->bt_mount, xb_miss_locked);
                spin_unlock(&pag->pag_buf_lock);
                xfs_perag_put(pag);
        }
@@ -531,11 +529,11 @@ found:
        if (!xfs_buf_trylock(bp)) {
                if (flags & XBF_TRYLOCK) {
                        xfs_buf_rele(bp);
-                       XFS_STATS_INC(xb_busy_locked);
+                       XFS_STATS_INC(btp->bt_mount, xb_busy_locked);
                        return NULL;
                }
                xfs_buf_lock(bp);
-               XFS_STATS_INC(xb_get_locked_waited);
+               XFS_STATS_INC(btp->bt_mount, xb_get_locked_waited);
        }
 
        /*
@@ -551,7 +549,7 @@ found:
        }
 
        trace_xfs_buf_find(bp, flags, _RET_IP_);
-       XFS_STATS_INC(xb_get_locked);
+       XFS_STATS_INC(btp->bt_mount, xb_get_locked);
        return bp;
 }
 
@@ -605,7 +603,7 @@ found:
                }
        }
 
-       XFS_STATS_INC(xb_get);
+       XFS_STATS_INC(target->bt_mount, xb_get);
        trace_xfs_buf_get(bp, flags, _RET_IP_);
        return bp;
 }
@@ -645,7 +643,7 @@ xfs_buf_read_map(
                trace_xfs_buf_read(bp, flags, _RET_IP_);
 
                if (!XFS_BUF_ISDONE(bp)) {
-                       XFS_STATS_INC(xb_get_read);
+                       XFS_STATS_INC(target->bt_mount, xb_get_read);
                        bp->b_ops = ops;
                        _xfs_buf_read(bp, flags);
                } else if (flags & XBF_ASYNC) {
@@ -1532,9 +1530,10 @@ xfs_wait_buftarg(
                        list_del_init(&bp->b_lru);
                        if (bp->b_flags & XBF_WRITE_FAIL) {
                                xfs_alert(btp->bt_mount,
-"Corruption Alert: Buffer at block 0x%llx had permanent write failures!\n"
-"Please run xfs_repair to determine the extent of the problem.",
+"Corruption Alert: Buffer at block 0x%llx had permanent write failures!",
                                        (long long)bp->b_bn);
+                               xfs_alert(btp->bt_mount,
+"Please run xfs_repair to determine the extent of the problem.");
                        }
                        xfs_buf_rele(bp);
                }
This page took 0.028323 seconds and 5 git commands to generate.