Illumos #952: separate intent logs should be obvious in 'zpool iostat' output
[zfs.git] / module / zfs / arc.c
index cfd4c79..cbc27d3 100644 (file)
 #endif
 #include <sys/callb.h>
 #include <sys/kstat.h>
+#include <sys/dmu_tx.h>
 #include <zfs_fletcher.h>
 
 static kmutex_t                arc_reclaim_thr_lock;
@@ -1016,7 +1017,8 @@ arc_cksum_compute(arc_buf_t *buf, boolean_t force)
                mutex_exit(&buf->b_hdr->b_freeze_lock);
                return;
        }
-       buf->b_hdr->b_freeze_cksum = kmem_alloc(sizeof (zio_cksum_t), KM_SLEEP);
+       buf->b_hdr->b_freeze_cksum = kmem_alloc(sizeof (zio_cksum_t),
+                                               KM_PUSHPAGE);
        fletcher_2_native(buf->b_data, buf->b_hdr->b_size,
            buf->b_hdr->b_freeze_cksum);
        mutex_exit(&buf->b_hdr->b_freeze_lock);
@@ -3584,6 +3586,7 @@ arc_memory_throttle(uint64_t reserve, uint64_t inflight_data, uint64_t txg)
        } else if (page_load > 0 && arc_reclaim_needed()) {
                /* memory is low, delay before restarting */
                ARCSTAT_INCR(arcstat_memory_throttle_count, 1);
+               DMU_TX_STAT_BUMP(dmu_tx_memory_reclaim);
                return (EAGAIN);
        }
        page_load = 0;
@@ -3599,6 +3602,7 @@ arc_memory_throttle(uint64_t reserve, uint64_t inflight_data, uint64_t txg)
 
        if (inflight_data > available_memory / 4) {
                ARCSTAT_INCR(arcstat_memory_throttle_count, 1);
+               DMU_TX_STAT_BUMP(dmu_tx_memory_inflight);
                return (ERESTART);
        }
 #endif
@@ -3629,8 +3633,10 @@ arc_tempreserve_space(uint64_t reserve, uint64_t txg)
 #endif
        if (reserve > arc_c/4 && !arc_no_grow)
                arc_c = MIN(arc_c_max, reserve * 4);
-       if (reserve > arc_c)
+       if (reserve > arc_c) {
+               DMU_TX_STAT_BUMP(dmu_tx_memory_reserve);
                return (ENOMEM);
+       }
 
        /*
         * Don't count loaned bufs as in flight dirty data to prevent long
@@ -3663,6 +3669,7 @@ arc_tempreserve_space(uint64_t reserve, uint64_t txg)
                    arc_anon->arcs_lsize[ARC_BUFC_METADATA]>>10,
                    arc_anon->arcs_lsize[ARC_BUFC_DATA]>>10,
                    reserve>>10, arc_c>>10);
+               DMU_TX_STAT_BUMP(dmu_tx_dirty_throttle);
                return (ERESTART);
        }
        atomic_add_64(&arc_tempreserve, reserve);
@@ -3702,7 +3709,7 @@ arc_kstat_update(kstat_t *ksp, int rw)
                    &as->arcstat_mfu_size,
                    &as->arcstat_mfu_evict_data,
                    &as->arcstat_mfu_evict_metadata);
-               arc_kstat_update_state(arc_mru_ghost,
+               arc_kstat_update_state(arc_mfu_ghost,
                    &as->arcstat_mfu_ghost_size,
                    &as->arcstat_mfu_ghost_evict_data,
                    &as->arcstat_mfu_ghost_evict_metadata);
@@ -4617,8 +4624,8 @@ l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint64_t target_sz)
                                 */
                                list_insert_head(dev->l2ad_buflist, head);
 
-                               cb = kmem_alloc(
-                                   sizeof (l2arc_write_callback_t), KM_SLEEP);
+                               cb = kmem_alloc(sizeof (l2arc_write_callback_t),
+                                               KM_PUSHPAGE);
                                cb->l2wcb_dev = dev;
                                cb->l2wcb_head = head;
                                pio = zio_root(spa, l2arc_write_done, cb,
@@ -4628,7 +4635,8 @@ l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint64_t target_sz)
                        /*
                         * Create and add a new L2ARC header.
                         */
-                       hdrl2 = kmem_zalloc(sizeof (l2arc_buf_hdr_t), KM_SLEEP);
+                       hdrl2 = kmem_zalloc(sizeof (l2arc_buf_hdr_t),
+                                           KM_PUSHPAGE);
                        hdrl2->b_dev = dev;
                        hdrl2->b_daddr = dev->l2ad_hand;