]> granicus.if.org Git - zfs/commitdiff
Retire KM_NODEBUG
authorBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 3 Dec 2014 19:56:32 +0000 (14:56 -0500)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 16 Jan 2015 22:40:32 +0000 (14:40 -0800)
Callers of kmem_alloc() which passed the KM_NODEBUG flag to suppress
the large allocation warning have been replaced by vmem_alloc() as
appropriate.  The updated vmem_alloc() call will not print a warning
regardless of the size of the allocation.

A careful reader will notice that not all callers have been changed
to vmem_alloc().  Some have only had the KM_NODEBUG flag removed.
This was possible because the default warning threshold has been
increased to 32k.  This is desirable because it minimizes the need
for Linux specific code changes.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
17 files changed:
include/sys/spa.h
include/sys/zfs_context.h
module/nvpair/nvpair_alloc_spl.c
module/zfs/ddt.c
module/zfs/dmu.c
module/zfs/dnode.c
module/zfs/dsl_scan.c
module/zfs/spa.c
module/zfs/spa_config.c
module/zfs/spa_misc.c
module/zfs/vdev.c
module/zfs/zfs_ioctl.c
module/zfs/zfs_vfsops.c
module/zfs/zfs_znode.c
module/zfs/zil.c
module/zfs/zio.c
module/zfs/zpl_file.c

index 1faf0420f21a2f3d6a5f96f8449e14dcfa1416e7..c989c0b35cd4d281fd062aebf78aab9c583d42dc 100644 (file)
@@ -29,6 +29,7 @@
 
 #include <sys/avl.h>
 #include <sys/zfs_context.h>
+#include <sys/kstat.h>
 #include <sys/nvpair.h>
 #include <sys/sysmacros.h>
 #include <sys/types.h>
index 1487a99f4a6447a2d9a090a8cb095b4f407e9d83..dd02e6f1bcc4e26b0656ce8884de20291aa732a0 100644 (file)
@@ -41,6 +41,7 @@
 #include <sys/bitmap.h>
 #include <sys/cmn_err.h>
 #include <sys/kmem.h>
+#include <sys/vmem.h>
 #include <sys/taskq.h>
 #include <sys/buf.h>
 #include <sys/param.h>
@@ -391,7 +392,6 @@ extern void kstat_set_raw_ops(kstat_t *ksp,
 #define        KM_SLEEP                UMEM_NOFAIL
 #define        KM_PUSHPAGE             KM_SLEEP
 #define        KM_NOSLEEP              UMEM_DEFAULT
-#define        KM_NODEBUG              0x0
 #define        KMC_NODEBUG             UMC_NODEBUG
 #define        KMC_KMEM                0x0
 #define        KMC_VMEM                0x0
index a75b4a6c7fd7365d0aef7138397b56386df7474f..f9055b94f1008d7acd299e341d04e6f81b0d3929 100644 (file)
 static void *
 nv_alloc_sleep_spl(nv_alloc_t *nva, size_t size)
 {
-       return (kmem_alloc(size, KM_SLEEP | KM_NODEBUG));
+       return (kmem_alloc(size, KM_SLEEP));
 }
 
 static void *
 nv_alloc_pushpage_spl(nv_alloc_t *nva, size_t size)
 {
-       return (kmem_alloc(size, KM_PUSHPAGE | KM_NODEBUG));
+       return (kmem_alloc(size, KM_PUSHPAGE));
 }
 
 static void *
index 0ce8ca1a98ef1088d63109db2bb5c94b9d2fb4cc..3ecb5390931aa50570c95c085f4045b4b59ff1fa 100644 (file)
@@ -834,7 +834,7 @@ ddt_table_alloc(spa_t *spa, enum zio_checksum c)
 {
        ddt_t *ddt;
 
-       ddt = kmem_cache_alloc(ddt_cache, KM_PUSHPAGE | KM_NODEBUG);
+       ddt = kmem_cache_alloc(ddt_cache, KM_PUSHPAGE);
        bzero(ddt, sizeof (ddt_t));
 
        mutex_init(&ddt->ddt_lock, NULL, MUTEX_DEFAULT, NULL);
index 98defa3bbfd6172ec42bfbd2a9c63b892846bbf8..607da887b04b403224f04c0fb336e5bea90f5abf 100644 (file)
@@ -417,8 +417,7 @@ dmu_buf_hold_array_by_dnode(dnode_t *dn, uint64_t offset, uint64_t length,
                }
                nblks = 1;
        }
-       dbp = kmem_zalloc(sizeof (dmu_buf_t *) * nblks,
-           KM_PUSHPAGE | KM_NODEBUG);
+       dbp = kmem_zalloc(sizeof (dmu_buf_t *) * nblks, KM_PUSHPAGE);
 
        zio = zio_root(dn->dn_objset->os_spa, NULL, NULL, ZIO_FLAG_CANFAIL);
        blkid = dbuf_whichblock(dn, offset);
index 0a87aa9b15d833b602c999a15a7158dc1052c15e..e5c212cc0bda89b90c9003982c0e529e14f1f383 100644 (file)
@@ -1070,8 +1070,7 @@ dnode_hold_impl(objset_t *os, uint64_t object, int flag,
                int i;
                dnode_children_t *winner;
                children_dnodes = kmem_alloc(sizeof (dnode_children_t) +
-                   (epb - 1) * sizeof (dnode_handle_t),
-                   KM_PUSHPAGE | KM_NODEBUG);
+                   (epb - 1) * sizeof (dnode_handle_t), KM_PUSHPAGE);
                children_dnodes->dnc_count = epb;
                dnh = &children_dnodes->dnc_children[0];
                for (i = 0; i < epb; i++) {
index 0e16002b375560c423d67d1786af8343d571c060..ebb6305eb16e013d0d546c3843ed9b93582d8963 100644 (file)
@@ -262,7 +262,7 @@ dsl_scan_setup_sync(void *arg, dmu_tx_t *tx)
 
        if (dp->dp_blkstats == NULL) {
                dp->dp_blkstats = kmem_alloc(sizeof (zfs_all_blkstats_t),
-                   KM_PUSHPAGE | KM_NODEBUG);
+                   KM_PUSHPAGE);
        }
        bzero(dp->dp_blkstats, sizeof (zfs_all_blkstats_t));
 
index 776beda1179e49fcf8662215563b2e2fc255ec26..88641603abc9e93185a802b5cecfee478c8d79bb 100644 (file)
@@ -1586,7 +1586,7 @@ load_nvlist(spa_t *spa, uint64_t obj, nvlist_t **value)
        nvsize = *(uint64_t *)db->db_data;
        dmu_buf_rele(db, FTAG);
 
-       packed = kmem_alloc(nvsize, KM_PUSHPAGE | KM_NODEBUG);
+       packed = kmem_alloc(nvsize, KM_PUSHPAGE);
        error = dmu_read(spa->spa_meta_objset, obj, 0, nvsize, packed,
            DMU_READ_PREFETCH);
        if (error == 0)
index a08456d56f60a776f99f2c41ef00bebd97823b84..818a4308f116dba96dc914b445d7822dd1c6a5d2 100644 (file)
@@ -102,7 +102,7 @@ spa_config_load(void)
        if (kobj_get_filesize(file, &fsize) != 0)
                goto out;
 
-       buf = kmem_alloc(fsize, KM_PUSHPAGE | KM_NODEBUG);
+       buf = kmem_alloc(fsize, KM_PUSHPAGE);
 
        /*
         * Read the nvlist from the file.
@@ -165,7 +165,7 @@ spa_config_write(spa_config_dirent_t *dp, nvlist_t *nvl)
         */
        VERIFY(nvlist_size(nvl, &buflen, NV_ENCODE_XDR) == 0);
 
-       buf = kmem_alloc(buflen, KM_PUSHPAGE | KM_NODEBUG);
+       buf = kmem_alloc(buflen, KM_PUSHPAGE);
        temp = kmem_zalloc(MAXPATHLEN, KM_PUSHPAGE);
 
        VERIFY(nvlist_pack(nvl, &buf, &buflen, NV_ENCODE_XDR,
index 2a2e72d5a359ad6a12dc28328eb9eba88c4fa8f9..363f982febfabce53a0df68628d97c542e408eb5 100644 (file)
@@ -520,7 +520,7 @@ spa_add(const char *name, nvlist_t *config, const char *altroot)
 
        ASSERT(MUTEX_HELD(&spa_namespace_lock));
 
-       spa = kmem_zalloc(sizeof (spa_t), KM_PUSHPAGE | KM_NODEBUG);
+       spa = kmem_zalloc(sizeof (spa_t), KM_PUSHPAGE);
 
        mutex_init(&spa->spa_async_lock, NULL, MUTEX_DEFAULT, NULL);
        mutex_init(&spa->spa_errlist_lock, NULL, MUTEX_DEFAULT, NULL);
index 37ce49297390d7a88ff233f0e08a02498e623fd2..18a246c333db31df7d1e12ca94fd989c614a23f6 100644 (file)
@@ -856,7 +856,7 @@ vdev_metaslab_init(vdev_t *vd, uint64_t txg)
 
        ASSERT(oldc <= newc);
 
-       mspp = kmem_zalloc(newc * sizeof (*mspp), KM_PUSHPAGE | KM_NODEBUG);
+       mspp = kmem_zalloc(newc * sizeof (*mspp), KM_PUSHPAGE);
 
        if (oldc != 0) {
                bcopy(vd->vdev_ms, mspp, oldc * sizeof (*mspp));
index 5fb407900adf7fda3b0999aed60ff79b350fcdc5..7d443ecf185460b8a4f11e55a57aa3f679b36c61 100644 (file)
@@ -311,7 +311,7 @@ history_str_get(zfs_cmd_t *zc)
        if (zc->zc_history == 0)
                return (NULL);
 
-       buf = kmem_alloc(HIS_MAX_RECORD_LEN, KM_SLEEP | KM_NODEBUG);
+       buf = kmem_alloc(HIS_MAX_RECORD_LEN, KM_SLEEP);
        if (copyinstr((void *)(uintptr_t)zc->zc_history,
            buf, HIS_MAX_RECORD_LEN, NULL) != 0) {
                history_str_free(buf);
@@ -1328,7 +1328,7 @@ get_nvlist(uint64_t nvl, uint64_t size, int iflag, nvlist_t **nvp)
        if (size == 0)
                return (SET_ERROR(EINVAL));
 
-       packed = kmem_alloc(size, KM_SLEEP | KM_NODEBUG);
+       packed = kmem_alloc(size, KM_SLEEP);
 
        if ((error = ddi_copyin((void *)(uintptr_t)nvl, packed, size,
            iflag)) != 0) {
@@ -2443,8 +2443,7 @@ zfs_prop_set_special(const char *dsname, zprop_source_t source,
                if (err == 0 && intval >= ZPL_VERSION_USERSPACE) {
                        zfs_cmd_t *zc;
 
-                       zc = kmem_zalloc(sizeof (zfs_cmd_t),
-                           KM_SLEEP | KM_NODEBUG);
+                       zc = kmem_zalloc(sizeof (zfs_cmd_t), KM_SLEEP);
                        (void) strcpy(zc->zc_name, dsname);
                        (void) zfs_ioc_userspace_upgrade(zc);
                        kmem_free(zc, sizeof (zfs_cmd_t));
@@ -3875,7 +3874,7 @@ zfs_check_clearable(char *dataset, nvlist_t *props, nvlist_t **errlist)
 
        VERIFY(nvlist_alloc(&errors, NV_UNIQUE_NAME, KM_SLEEP) == 0);
 
-       zc = kmem_alloc(sizeof (zfs_cmd_t), KM_SLEEP | KM_NODEBUG);
+       zc = kmem_alloc(sizeof (zfs_cmd_t), KM_SLEEP);
        (void) strcpy(zc->zc_name, dataset);
        pair = nvlist_next_nvpair(props, NULL);
        while (pair != NULL) {
@@ -5748,7 +5747,7 @@ zfsdev_ioctl(struct file *filp, unsigned cmd, unsigned long arg)
        if (vec->zvec_func == NULL && vec->zvec_legacy_func == NULL)
                return (-SET_ERROR(EINVAL));
 
-       zc = kmem_zalloc(sizeof (zfs_cmd_t), KM_SLEEP | KM_NODEBUG);
+       zc = kmem_zalloc(sizeof (zfs_cmd_t), KM_SLEEP);
 
        error = ddi_copyin((void *)arg, zc, sizeof (zfs_cmd_t), flag);
        if (error != 0) {
index d67f11eca08b84644736dac75fd25b07cc0fba5c..d29fc6560a8f7e0c90ebb263677168298c114ce4 100644 (file)
@@ -653,7 +653,7 @@ zfs_sb_create(const char *osname, zfs_sb_t **zsbp)
        int i, error;
        uint64_t sa_obj;
 
-       zsb = kmem_zalloc(sizeof (zfs_sb_t), KM_SLEEP | KM_NODEBUG);
+       zsb = kmem_zalloc(sizeof (zfs_sb_t), KM_SLEEP);
 
        /*
         * We claim to always be readonly so we can open snapshots;
index f02c02184b9236a9e7b5cc91c1ba6076929ddeba..b51d780375c471aed405c7f30857e793e660baed 100644 (file)
@@ -1702,7 +1702,7 @@ zfs_create_fs(objset_t *os, cred_t *cr, nvlist_t *zplprops, dmu_tx_t *tx)
        rootzp->z_atime_dirty = 0;
        rootzp->z_is_sa = USE_SA(version, os);
 
-       zsb = kmem_zalloc(sizeof (zfs_sb_t), KM_PUSHPAGE | KM_NODEBUG);
+       zsb = kmem_zalloc(sizeof (zfs_sb_t), KM_PUSHPAGE);
        zsb->z_os = os;
        zsb->z_parent = zsb;
        zsb->z_version = version;
index 6ee6c9868e69d0c97fd8a6690a9ee1729106619b..1d8e7cb4d151ccf8c693c2b946ac32f51da00690 100644 (file)
@@ -1192,8 +1192,7 @@ zil_itx_create(uint64_t txtype, size_t lrsize)
 
        lrsize = P2ROUNDUP_TYPED(lrsize, sizeof (uint64_t), size_t);
 
-       itx = kmem_alloc(offsetof(itx_t, itx_lr) + lrsize,
-           KM_PUSHPAGE | KM_NODEBUG);
+       itx = vmem_alloc(offsetof(itx_t, itx_lr) + lrsize, KM_PUSHPAGE);
        itx->itx_lr.lrc_txtype = txtype;
        itx->itx_lr.lrc_reclen = lrsize;
        itx->itx_sod = lrsize; /* if write & WR_NEED_COPY will be increased */
@@ -1208,7 +1207,7 @@ zil_itx_create(uint64_t txtype, size_t lrsize)
 void
 zil_itx_destroy(itx_t *itx)
 {
-       kmem_free(itx, offsetof(itx_t, itx_lr) + itx->itx_lr.lrc_reclen);
+       vmem_free(itx, offsetof(itx_t, itx_lr) + itx->itx_lr.lrc_reclen);
 }
 
 /*
index 7c0e6bf7e8eec0370af24ae4a2c9a79aeb8b9d39..d7c8458f473da0302b537cbe7fa7c855eeab58a3 100644 (file)
@@ -246,7 +246,7 @@ zio_buf_alloc(size_t size)
 
        ASSERT3U(c, <, SPA_MAXBLOCKSIZE >> SPA_MINBLOCKSHIFT);
 
-       return (kmem_cache_alloc(zio_buf_cache[c], KM_PUSHPAGE | KM_NODEBUG));
+       return (kmem_cache_alloc(zio_buf_cache[c], KM_PUSHPAGE));
 }
 
 /*
@@ -262,8 +262,7 @@ zio_data_buf_alloc(size_t size)
 
        ASSERT(c < SPA_MAXBLOCKSIZE >> SPA_MINBLOCKSHIFT);
 
-       return (kmem_cache_alloc(zio_data_buf_cache[c],
-           KM_PUSHPAGE | KM_NODEBUG));
+       return (kmem_cache_alloc(zio_data_buf_cache[c], KM_PUSHPAGE));
 }
 
 void
index 61005dcd4ff74685ccae233d94446f977f082d33..1f4f219ed58c48b057ac28922358d58a65a0c2a6 100644 (file)
@@ -248,7 +248,7 @@ zpl_aio_read(struct kiocb *kiocb, const struct iovec *iovp,
        size_t count = kiocb->ki_nbytes;
        ssize_t read;
        size_t alloc_size = sizeof (struct iovec) * nr_segs;
-       struct iovec *iov_tmp = kmem_alloc(alloc_size, KM_SLEEP | KM_NODEBUG);
+       struct iovec *iov_tmp = kmem_alloc(alloc_size, KM_SLEEP);
        bcopy(iovp, iov_tmp, alloc_size);
 
        ASSERT(iovp);
@@ -325,7 +325,7 @@ zpl_aio_write(struct kiocb *kiocb, const struct iovec *iovp,
        size_t count = kiocb->ki_nbytes;
        ssize_t wrote;
        size_t alloc_size = sizeof (struct iovec) * nr_segs;
-       struct iovec *iov_tmp = kmem_alloc(alloc_size, KM_SLEEP | KM_NODEBUG);
+       struct iovec *iov_tmp = kmem_alloc(alloc_size, KM_SLEEP);
        bcopy(iovp, iov_tmp, alloc_size);
 
        ASSERT(iovp);