Merge commit 'refs/remotes/origin/linux-kernel-mem' into HEAD
This commit is contained in:
commit
7ad8b1fc82
17
.topmsg
17
.topmsg
|
@ -1,19 +1,6 @@
|
|||
From: Brian Behlendorf <behlendorf1@llnl.gov>
|
||||
Subject: [PATCH] zfs branch
|
||||
Subject: [PATCH] linux kernel mem
|
||||
|
||||
Merged result of all changes which are relevant to both Solaris
|
||||
and Linux builds of the ZFS code. These are changes where there
|
||||
is a reasonable chance they will be accepted upstream.
|
||||
|
||||
Additionally, since this is effectively the root of the linux
|
||||
ZFS tree the core linux build system is added here. This
|
||||
includes autogen.sh, configure.ac, m4 macros, some scripts/*,
|
||||
and makefiles for all the core ZFS components. Linux-only
|
||||
features which require tweaks to the build system should appear
|
||||
on the relevant topic branches. All autotools products which
|
||||
result from autogen.sh are commited to the linux-configure-branch.
|
||||
|
||||
This branch also contains the META, ChangeLog, AUTHORS, TODO,
|
||||
and README, files.
|
||||
Required kmem/vmem changes
|
||||
|
||||
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
|
||||
|
|
|
@ -303,6 +303,9 @@ extern void kstat_delete(kstat_t *);
|
|||
#define kmem_alloc(_s, _f) umem_alloc(_s, _f)
|
||||
#define kmem_zalloc(_s, _f) umem_zalloc(_s, _f)
|
||||
#define kmem_free(_b, _s) umem_free(_b, _s)
|
||||
#define vmem_alloc(_s, _f) kmem_alloc(_s, _f)
|
||||
#define vmem_zalloc(_s, _f) kmem_zalloc(_s, _f)
|
||||
#define vmem_free(_b, _s) kmem_free(_b, _s)
|
||||
#define kmem_cache_create(_a, _b, _c, _d, _e, _f, _g, _h, _i) \
|
||||
umem_cache_create(_a, _b, _c, _d, _e, _f, _g, _h, _i)
|
||||
#define kmem_cache_destroy(_c) umem_cache_destroy(_c)
|
||||
|
|
|
@ -755,8 +755,15 @@ buf_fini(void)
|
|||
{
|
||||
int i;
|
||||
|
||||
#if defined(_KERNEL) && defined(HAVE_SPL)
|
||||
/* Large allocations which do not require contiguous pages
|
||||
* should be using vmem_free() in the linux kernel */
|
||||
vmem_free(buf_hash_table.ht_table,
|
||||
(buf_hash_table.ht_mask + 1) * sizeof (void *));
|
||||
#else
|
||||
kmem_free(buf_hash_table.ht_table,
|
||||
(buf_hash_table.ht_mask + 1) * sizeof (void *));
|
||||
#endif
|
||||
for (i = 0; i < BUF_LOCKS; i++)
|
||||
mutex_destroy(&buf_hash_table.ht_locks[i].ht_lock);
|
||||
kmem_cache_destroy(hdr_cache);
|
||||
|
@ -855,8 +862,15 @@ buf_init(void)
|
|||
hsize <<= 1;
|
||||
retry:
|
||||
buf_hash_table.ht_mask = hsize - 1;
|
||||
#if defined(_KERNEL) && defined(HAVE_SPL)
|
||||
/* Large allocations which do not require contiguous pages
|
||||
* should be using vmem_alloc() in the linux kernel */
|
||||
buf_hash_table.ht_table =
|
||||
vmem_zalloc(hsize * sizeof (void*), KM_SLEEP);
|
||||
#else
|
||||
buf_hash_table.ht_table =
|
||||
kmem_zalloc(hsize * sizeof (void*), KM_NOSLEEP);
|
||||
#endif
|
||||
if (buf_hash_table.ht_table == NULL) {
|
||||
ASSERT(hsize > (1ULL << 8));
|
||||
hsize >>= 1;
|
||||
|
|
|
@ -255,7 +255,13 @@ dbuf_init(void)
|
|||
|
||||
retry:
|
||||
h->hash_table_mask = hsize - 1;
|
||||
#if defined(_KERNEL) && defined(HAVE_SPL)
|
||||
/* Large allocations which do not require contiguous pages
|
||||
* should be using vmem_alloc() in the linux kernel */
|
||||
h->hash_table = vmem_zalloc(hsize * sizeof (void *), KM_SLEEP);
|
||||
#else
|
||||
h->hash_table = kmem_zalloc(hsize * sizeof (void *), KM_NOSLEEP);
|
||||
#endif
|
||||
if (h->hash_table == NULL) {
|
||||
/* XXX - we should really return an error instead of assert */
|
||||
ASSERT(hsize > (1ULL << 10));
|
||||
|
@ -279,7 +285,13 @@ dbuf_fini(void)
|
|||
|
||||
for (i = 0; i < DBUF_MUTEXES; i++)
|
||||
mutex_destroy(&h->hash_mutexes[i]);
|
||||
#if defined(_KERNEL) && defined(HAVE_SPL)
|
||||
/* Large allocations which do not require contiguous pages
|
||||
* should be using vmem_free() in the linux kernel */
|
||||
vmem_free(h->hash_table, (h->hash_table_mask + 1) * sizeof (void *));
|
||||
#else
|
||||
kmem_free(h->hash_table, (h->hash_table_mask + 1) * sizeof (void *));
|
||||
#endif
|
||||
kmem_cache_destroy(dbuf_cache);
|
||||
}
|
||||
|
||||
|
|
|
@ -1008,7 +1008,7 @@ dmu_recv_stream(dmu_recv_cookie_t *drc, vnode_t *vp, offset_t *voffp)
|
|||
ra.vp = vp;
|
||||
ra.voff = *voffp;
|
||||
ra.bufsize = 1<<20;
|
||||
ra.buf = kmem_alloc(ra.bufsize, KM_SLEEP);
|
||||
ra.buf = vmem_alloc(ra.bufsize, KM_SLEEP);
|
||||
|
||||
/* these were verified in dmu_recv_begin */
|
||||
ASSERT(drc->drc_drrb->drr_version == DMU_BACKUP_STREAM_VERSION);
|
||||
|
@ -1098,7 +1098,7 @@ out:
|
|||
dmu_recv_abort_cleanup(drc);
|
||||
}
|
||||
|
||||
kmem_free(ra.buf, ra.bufsize);
|
||||
vmem_free(ra.buf, ra.bufsize);
|
||||
*voffp = ra.voff;
|
||||
return (ra.err);
|
||||
}
|
||||
|
|
|
@ -281,7 +281,7 @@ spa_history_log_sync(void *arg1, void *arg2, cred_t *cr, dmu_tx_t *tx)
|
|||
dmu_buf_rele(dbp, FTAG);
|
||||
|
||||
if (hap->ha_log_type == LOG_INTERNAL) {
|
||||
kmem_free((void*)hap->ha_history_str, HIS_MAX_RECORD_LEN);
|
||||
vmem_free((void*)hap->ha_history_str, HIS_MAX_RECORD_LEN);
|
||||
kmem_free(hap, sizeof (history_arg_t));
|
||||
}
|
||||
}
|
||||
|
@ -407,7 +407,7 @@ spa_history_internal_log(history_internal_events_t event, spa_t *spa,
|
|||
return;
|
||||
|
||||
hap = kmem_alloc(sizeof (history_arg_t), KM_SLEEP);
|
||||
str = kmem_alloc(HIS_MAX_RECORD_LEN, KM_SLEEP);
|
||||
str = vmem_alloc(HIS_MAX_RECORD_LEN, KM_SLEEP);
|
||||
|
||||
va_start(adx, fmt);
|
||||
(void) vsnprintf(str, HIS_MAX_RECORD_LEN, fmt, adx);
|
||||
|
|
|
@ -49,7 +49,7 @@ txg_init(dsl_pool_t *dp, uint64_t txg)
|
|||
int c;
|
||||
bzero(tx, sizeof (tx_state_t));
|
||||
|
||||
tx->tx_cpu = kmem_zalloc(max_ncpus * sizeof (tx_cpu_t), KM_SLEEP);
|
||||
tx->tx_cpu = vmem_zalloc(max_ncpus * sizeof (tx_cpu_t), KM_SLEEP);
|
||||
|
||||
for (c = 0; c < max_ncpus; c++) {
|
||||
int i;
|
||||
|
@ -109,7 +109,7 @@ txg_fini(dsl_pool_t *dp)
|
|||
if (tx->tx_commit_cb_taskq != NULL)
|
||||
taskq_destroy(tx->tx_commit_cb_taskq);
|
||||
|
||||
kmem_free(tx->tx_cpu, max_ncpus * sizeof (tx_cpu_t));
|
||||
vmem_free(tx->tx_cpu, max_ncpus * sizeof (tx_cpu_t));
|
||||
|
||||
bzero(tx, sizeof (tx_state_t));
|
||||
}
|
||||
|
|
|
@ -134,7 +134,7 @@ __dprintf(const char *file, const char *func, int line, const char *fmt, ...)
|
|||
static void
|
||||
history_str_free(char *buf)
|
||||
{
|
||||
kmem_free(buf, HIS_MAX_RECORD_LEN);
|
||||
vmem_free(buf, HIS_MAX_RECORD_LEN);
|
||||
}
|
||||
|
||||
static char *
|
||||
|
@ -145,7 +145,7 @@ history_str_get(zfs_cmd_t *zc)
|
|||
if (zc->zc_history == 0)
|
||||
return (NULL);
|
||||
|
||||
buf = kmem_alloc(HIS_MAX_RECORD_LEN, KM_SLEEP);
|
||||
buf = vmem_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);
|
||||
|
@ -729,12 +729,12 @@ put_nvlist(zfs_cmd_t *zc, nvlist_t *nvl)
|
|||
if (size > zc->zc_nvlist_dst_size) {
|
||||
error = ENOMEM;
|
||||
} else {
|
||||
packed = kmem_alloc(size, KM_SLEEP);
|
||||
packed = vmem_alloc(size, KM_SLEEP);
|
||||
VERIFY(nvlist_pack(nvl, &packed, &size, NV_ENCODE_NATIVE,
|
||||
KM_SLEEP) == 0);
|
||||
error = xcopyout(packed, (void *)(uintptr_t)zc->zc_nvlist_dst,
|
||||
size);
|
||||
kmem_free(packed, size);
|
||||
vmem_free(packed, size);
|
||||
}
|
||||
|
||||
zc->zc_nvlist_dst_size = size;
|
||||
|
@ -3002,7 +3002,7 @@ zfsdev_ioctl(dev_t dev, int cmd, intptr_t arg, int flag, cred_t *cr, int *rvalp)
|
|||
if (vec >= sizeof (zfs_ioc_vec) / sizeof (zfs_ioc_vec[0]))
|
||||
return (EINVAL);
|
||||
|
||||
zc = kmem_zalloc(sizeof (zfs_cmd_t), KM_SLEEP);
|
||||
zc = vmem_zalloc(sizeof (zfs_cmd_t), KM_SLEEP);
|
||||
|
||||
error = xcopyin((void *)arg, zc, sizeof (zfs_cmd_t));
|
||||
|
||||
|
@ -3041,7 +3041,7 @@ zfsdev_ioctl(dev_t dev, int cmd, intptr_t arg, int flag, cred_t *cr, int *rvalp)
|
|||
zfs_log_history(zc);
|
||||
}
|
||||
|
||||
kmem_free(zc, sizeof (zfs_cmd_t));
|
||||
vmem_free(zc, sizeof (zfs_cmd_t));
|
||||
return (error);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue