Use vmem_alloc() for zfs_ioc_userspace_many()
authorBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 20 May 2011 21:23:18 +0000 (14:23 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 20 May 2011 21:23:18 +0000 (14:23 -0700)
The default buffer size when requesting multiple quota entries
is 100 times the zfs_useracct_t size.  In practice this works out
to exactly 27200 bytes.  Since this will be a short lived buffer
in a non-performance critical path it is preferable to vmem_alloc()
the needed memory.

module/zfs/zfs_ioctl.c

index 7fba6e7..39c6091 100644 (file)
@@ -4094,7 +4094,7 @@ zfs_ioc_userspace_many(zfs_cmd_t *zc)
        if (error)
                return (error);
 
-       buf = kmem_alloc(bufsize, KM_SLEEP);
+       buf = vmem_alloc(bufsize, KM_SLEEP);
 
        error = zfs_userspace_many(zsb, zc->zc_objset_type, &zc->zc_cookie,
            buf, &zc->zc_nvlist_dst_size);
@@ -4104,7 +4104,7 @@ zfs_ioc_userspace_many(zfs_cmd_t *zc)
                    (void *)(uintptr_t)zc->zc_nvlist_dst,
                    zc->zc_nvlist_dst_size);
        }
-       kmem_free(buf, bufsize);
+       vmem_free(buf, bufsize);
        zfs_sb_rele(zsb, FTAG);
 
        return (error);