diff options
author | Brian Behlendorf <[email protected]> | 2016-04-13 08:55:35 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2016-04-21 09:49:25 -0700 |
commit | da5e151f207ff1bc4972ce74a3a85e442ffd5a03 (patch) | |
tree | 59fcc326b6ad69b36bc9f06bf1dd25a23afee34c /module/zfs/zpl_inode.c | |
parent | 8fc5674c522e22f0b97e4714bf5410e24d481afa (diff) |
Add pn_alloc()/pn_free() functions
In order to remove the HAVE_PN_UTILS wrappers the pn_alloc() and
pn_free() functions must be implemented. The existing illumos
implementation were used for this purpose.
The `flags` argument which was used in places wrapped by the
HAVE_PN_UTILS condition has beed added back to zfs_remove() and
zfs_link() functions. This removes a small point of divergence
between the ZoL code and upstream.
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #4522
Diffstat (limited to 'module/zfs/zpl_inode.c')
-rw-r--r-- | module/zfs/zpl_inode.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/module/zfs/zpl_inode.c b/module/zfs/zpl_inode.c index 7cf62783f..089e3a1bc 100644 --- a/module/zfs/zpl_inode.c +++ b/module/zfs/zpl_inode.c @@ -59,8 +59,7 @@ zpl_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags) /* If we are a case insensitive fs, we need the real name */ if (zsb->z_case == ZFS_CASE_INSENSITIVE) { zfs_flags = FIGNORECASE; - pn.pn_bufsize = ZFS_MAXNAMELEN; - pn.pn_buf = kmem_zalloc(ZFS_MAXNAMELEN, KM_SLEEP); + pn_alloc(&pn); ppn = &pn; } @@ -83,7 +82,7 @@ zpl_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags) * Fall through if the error is not ENOENT. Also free memory. */ if (ppn) { - kmem_free(pn.pn_buf, ZFS_MAXNAMELEN); + pn_free(ppn); if (error == -ENOENT) return (NULL); } @@ -105,7 +104,7 @@ zpl_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags) ci_name.name = pn.pn_buf; ci_name.len = strlen(pn.pn_buf); new_dentry = d_add_ci(dentry, ip, &ci_name); - kmem_free(pn.pn_buf, ZFS_MAXNAMELEN); + pn_free(ppn); return (new_dentry); } else { return (d_splice_alias(ip, dentry)); @@ -157,7 +156,7 @@ zpl_create(struct inode *dir, struct dentry *dentry, zpl_umode_t mode, error = zpl_init_acl(ip, dir); if (error) - (void) zfs_remove(dir, dname(dentry), cr); + (void) zfs_remove(dir, dname(dentry), cr, 0); } spl_fstrans_unmark(cookie); @@ -200,7 +199,7 @@ zpl_mknod(struct inode *dir, struct dentry *dentry, zpl_umode_t mode, error = zpl_init_acl(ip, dir); if (error) - (void) zfs_remove(dir, dname(dentry), cr); + (void) zfs_remove(dir, dname(dentry), cr, 0); } spl_fstrans_unmark(cookie); @@ -221,7 +220,7 @@ zpl_unlink(struct inode *dir, struct dentry *dentry) crhold(cr); cookie = spl_fstrans_mark(); - error = -zfs_remove(dir, dname(dentry), cr); + error = -zfs_remove(dir, dname(dentry), cr, 0); /* * For a CI FS we must invalidate the dentry to prevent the @@ -389,7 +388,7 @@ zpl_symlink(struct inode *dir, struct dentry *dentry, const char *name) error = zpl_xattr_security_init(ip, dir, &dentry->d_name); if (error) - (void) zfs_remove(dir, dname(dentry), cr); + (void) zfs_remove(dir, dname(dentry), cr, 0); } spl_fstrans_unmark(cookie); @@ -537,7 +536,7 @@ zpl_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry) igrab(ip); /* Use ihold() if available */ cookie = spl_fstrans_mark(); - error = -zfs_link(dir, ip, dname(dentry), cr); + error = -zfs_link(dir, ip, dname(dentry), cr, 0); if (error) { iput(ip); goto out; |