Skip to content

Commit

Permalink
Use vmem_alloc() in spa_config_write()
Browse files Browse the repository at this point in the history
The packed nvlist allocated in spa_config_write() may exceed the
warning threshold for large configurations.  Use the vmem interfaces
for this short lived allocation.

Signed-off-by: Brian Behlendorf <[email protected]>
Closes openzfs#3251
  • Loading branch information
behlendorf committed Apr 7, 2015
1 parent 40d06e3 commit f42d7f4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions module/zfs/spa_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,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_SLEEP);
buf = vmem_alloc(buflen, KM_SLEEP);
temp = kmem_zalloc(MAXPATHLEN, KM_SLEEP);

VERIFY(nvlist_pack(nvl, &buf, &buflen, NV_ENCODE_XDR,
Expand All @@ -191,7 +191,7 @@ spa_config_write(spa_config_dirent_t *dp, nvlist_t *nvl)

(void) vn_remove(temp, UIO_SYSSPACE, RMFILE);

kmem_free(buf, buflen);
vmem_free(buf, buflen);
kmem_free(temp, MAXPATHLEN);
}

Expand Down

0 comments on commit f42d7f4

Please sign in to comment.