mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-25 03:37:45 +03:00
Allocate zap_attribute_t from kmem instead of stack
This patch is preparatory work for long name feature. It changes all users of zap_attribute_t to allocate it from kmem instead of stack. It also make zap_attribute_t and zap_name_t structure variable length. Reviewed-by: Tony Hutter <hutter2@llnl.gov> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Alexander Motin <mav@FreeBSD.org> Signed-off-by: Chunwei Chen <david.chen@nutanix.com> Closes #15921
This commit is contained in:
committed by
Brian Behlendorf
parent
141368a4b6
commit
3cf2bfa570
@@ -153,19 +153,20 @@ static int
|
||||
zpl_xattr_readdir(struct inode *dxip, xattr_filldir_t *xf)
|
||||
{
|
||||
zap_cursor_t zc;
|
||||
zap_attribute_t zap;
|
||||
zap_attribute_t *zap = zap_attribute_alloc();
|
||||
int error;
|
||||
|
||||
zap_cursor_init(&zc, ITOZSB(dxip)->z_os, ITOZ(dxip)->z_id);
|
||||
|
||||
while ((error = -zap_cursor_retrieve(&zc, &zap)) == 0) {
|
||||
while ((error = -zap_cursor_retrieve(&zc, zap)) == 0) {
|
||||
|
||||
if (zap.za_integer_length != 8 || zap.za_num_integers != 1) {
|
||||
if (zap->za_integer_length != 8 || zap->za_num_integers != 1) {
|
||||
error = -ENXIO;
|
||||
break;
|
||||
}
|
||||
|
||||
error = zpl_xattr_filldir(xf, zap.za_name, strlen(zap.za_name));
|
||||
error = zpl_xattr_filldir(xf, zap->za_name,
|
||||
strlen(zap->za_name));
|
||||
if (error)
|
||||
break;
|
||||
|
||||
@@ -173,6 +174,7 @@ zpl_xattr_readdir(struct inode *dxip, xattr_filldir_t *xf)
|
||||
}
|
||||
|
||||
zap_cursor_fini(&zc);
|
||||
zap_attribute_free(zap);
|
||||
|
||||
if (error == -ENOENT)
|
||||
error = 0;
|
||||
|
||||
Reference in New Issue
Block a user