Commit 524fbf5d authored by Nathan Scott's avatar Nathan Scott

[XFS] Revert kiocb and vattr stack changes, theory is the AIO rework will

help here and vattr may be small enough.

SGI-PV: 947312
SGI-Modid: xfs-linux-melb:xfs-kern:25423a
Signed-off-by: default avatarNathan Scott <nathans@sgi.com>
parent f30a1211
...@@ -145,22 +145,17 @@ __xfs_file_readv( ...@@ -145,22 +145,17 @@ __xfs_file_readv(
{ {
struct inode *inode = file->f_mapping->host; struct inode *inode = file->f_mapping->host;
vnode_t *vp = LINVFS_GET_VP(inode); vnode_t *vp = LINVFS_GET_VP(inode);
struct kiocb *kiocb; struct kiocb kiocb;
ssize_t rval; ssize_t rval;
kiocb = kmalloc(sizeof(*kiocb), GFP_KERNEL); init_sync_kiocb(&kiocb, file);
if (unlikely(!kiocb)) kiocb.ki_pos = *ppos;
return -ENOMEM;
init_sync_kiocb(kiocb, file);
kiocb->ki_pos = *ppos;
if (unlikely(file->f_flags & O_DIRECT)) if (unlikely(file->f_flags & O_DIRECT))
ioflags |= IO_ISDIRECT; ioflags |= IO_ISDIRECT;
VOP_READ(vp, kiocb, iov, nr_segs, &kiocb->ki_pos, ioflags, NULL, rval); VOP_READ(vp, &kiocb, iov, nr_segs, &kiocb.ki_pos, ioflags, NULL, rval);
*ppos = kiocb->ki_pos; *ppos = kiocb.ki_pos;
kfree(kiocb);
return rval; return rval;
} }
...@@ -195,22 +190,17 @@ __xfs_file_writev( ...@@ -195,22 +190,17 @@ __xfs_file_writev(
{ {
struct inode *inode = file->f_mapping->host; struct inode *inode = file->f_mapping->host;
vnode_t *vp = LINVFS_GET_VP(inode); vnode_t *vp = LINVFS_GET_VP(inode);
struct kiocb *kiocb; struct kiocb kiocb;
ssize_t rval; ssize_t rval;
kiocb = kmalloc(sizeof(*kiocb), GFP_KERNEL); init_sync_kiocb(&kiocb, file);
if (unlikely(!kiocb)) kiocb.ki_pos = *ppos;
return -ENOMEM;
init_sync_kiocb(kiocb, file);
kiocb->ki_pos = *ppos;
if (unlikely(file->f_flags & O_DIRECT)) if (unlikely(file->f_flags & O_DIRECT))
ioflags |= IO_ISDIRECT; ioflags |= IO_ISDIRECT;
VOP_WRITE(vp, kiocb, iov, nr_segs, &kiocb->ki_pos, ioflags, NULL, rval); VOP_WRITE(vp, &kiocb, iov, nr_segs, &kiocb.ki_pos, ioflags, NULL, rval);
*ppos = kiocb->ki_pos; *ppos = kiocb.ki_pos;
kfree(kiocb);
return rval; return rval;
} }
...@@ -420,7 +410,7 @@ xfs_file_mmap( ...@@ -420,7 +410,7 @@ xfs_file_mmap(
{ {
struct inode *ip = filp->f_dentry->d_inode; struct inode *ip = filp->f_dentry->d_inode;
vnode_t *vp = LINVFS_GET_VP(ip); vnode_t *vp = LINVFS_GET_VP(ip);
vattr_t *vattr; vattr_t vattr;
int error; int error;
vma->vm_ops = &xfs_file_vm_ops; vma->vm_ops = &xfs_file_vm_ops;
...@@ -431,14 +421,10 @@ xfs_file_mmap( ...@@ -431,14 +421,10 @@ xfs_file_mmap(
} }
#endif /* CONFIG_XFS_DMAPI */ #endif /* CONFIG_XFS_DMAPI */
vattr = kmalloc(sizeof(*vattr), GFP_KERNEL); vattr.va_mask = XFS_AT_UPDATIME;
if (unlikely(!vattr)) VOP_SETATTR(vp, &vattr, XFS_AT_UPDATIME, NULL, error);
return -ENOMEM;
vattr->va_mask = XFS_AT_UPDATIME;
VOP_SETATTR(vp, vattr, XFS_AT_UPDATIME, NULL, error);
if (likely(!error)) if (likely(!error))
__vn_revalidate(vp, vattr); /* update flags */ __vn_revalidate(vp, &vattr); /* update flags */
kfree(vattr);
return 0; return 0;
} }
......
...@@ -295,7 +295,7 @@ xfs_vn_mknod( ...@@ -295,7 +295,7 @@ xfs_vn_mknod(
dev_t rdev) dev_t rdev)
{ {
struct inode *ip; struct inode *ip;
vattr_t *vattr; vattr_t vattr = { 0 };
vnode_t *vp = NULL, *dvp = LINVFS_GET_VP(dir); vnode_t *vp = NULL, *dvp = LINVFS_GET_VP(dir);
xfs_acl_t *default_acl = NULL; xfs_acl_t *default_acl = NULL;
attrexists_t test_default_acl = _ACL_DEFAULT_EXISTS; attrexists_t test_default_acl = _ACL_DEFAULT_EXISTS;
...@@ -308,13 +308,8 @@ xfs_vn_mknod( ...@@ -308,13 +308,8 @@ xfs_vn_mknod(
if (unlikely(!sysv_valid_dev(rdev) || MAJOR(rdev) & ~0x1ff)) if (unlikely(!sysv_valid_dev(rdev) || MAJOR(rdev) & ~0x1ff))
return -EINVAL; return -EINVAL;
vattr = kmalloc(sizeof(*vattr), GFP_KERNEL);
if (unlikely(!vattr))
return -ENOMEM;
if (unlikely(test_default_acl && test_default_acl(dvp))) { if (unlikely(test_default_acl && test_default_acl(dvp))) {
if (!_ACL_ALLOC(default_acl)) { if (!_ACL_ALLOC(default_acl)) {
kfree(vattr);
return -ENOMEM; return -ENOMEM;
} }
if (!_ACL_GET_DEFAULT(dvp, default_acl)) { if (!_ACL_GET_DEFAULT(dvp, default_acl)) {
...@@ -326,20 +321,19 @@ xfs_vn_mknod( ...@@ -326,20 +321,19 @@ xfs_vn_mknod(
if (IS_POSIXACL(dir) && !default_acl && xfs_has_fs_struct(current)) if (IS_POSIXACL(dir) && !default_acl && xfs_has_fs_struct(current))
mode &= ~current->fs->umask; mode &= ~current->fs->umask;
memset(vattr, 0, sizeof(*vattr)); vattr.va_mask = XFS_AT_TYPE|XFS_AT_MODE;
vattr->va_mask = XFS_AT_TYPE|XFS_AT_MODE; vattr.va_mode = mode;
vattr->va_mode = mode;
switch (mode & S_IFMT) { switch (mode & S_IFMT) {
case S_IFCHR: case S_IFBLK: case S_IFIFO: case S_IFSOCK: case S_IFCHR: case S_IFBLK: case S_IFIFO: case S_IFSOCK:
vattr->va_rdev = sysv_encode_dev(rdev); vattr.va_rdev = sysv_encode_dev(rdev);
vattr->va_mask |= XFS_AT_RDEV; vattr.va_mask |= XFS_AT_RDEV;
/*FALLTHROUGH*/ /*FALLTHROUGH*/
case S_IFREG: case S_IFREG:
VOP_CREATE(dvp, dentry, vattr, &vp, NULL, error); VOP_CREATE(dvp, dentry, &vattr, &vp, NULL, error);
break; break;
case S_IFDIR: case S_IFDIR:
VOP_MKDIR(dvp, dentry, vattr, &vp, NULL, error); VOP_MKDIR(dvp, dentry, &vattr, &vp, NULL, error);
break; break;
default: default:
error = EINVAL; error = EINVAL;
...@@ -354,7 +348,7 @@ xfs_vn_mknod( ...@@ -354,7 +348,7 @@ xfs_vn_mknod(
if (unlikely(default_acl)) { if (unlikely(default_acl)) {
if (!error) { if (!error) {
error = _ACL_INHERIT(vp, vattr, default_acl); error = _ACL_INHERIT(vp, &vattr, default_acl);
if (!error) if (!error)
VMODIFY(vp); VMODIFY(vp);
else else
...@@ -370,11 +364,10 @@ xfs_vn_mknod( ...@@ -370,11 +364,10 @@ xfs_vn_mknod(
if (S_ISCHR(mode) || S_ISBLK(mode)) if (S_ISCHR(mode) || S_ISBLK(mode))
ip->i_rdev = rdev; ip->i_rdev = rdev;
else if (S_ISDIR(mode)) else if (S_ISDIR(mode))
xfs_validate_fields(ip, vattr); xfs_validate_fields(ip, &vattr);
d_instantiate(dentry, ip); d_instantiate(dentry, ip);
xfs_validate_fields(dir, vattr); xfs_validate_fields(dir, &vattr);
} }
kfree(vattr);
return -error; return -error;
} }
...@@ -429,17 +422,13 @@ xfs_vn_link( ...@@ -429,17 +422,13 @@ xfs_vn_link(
struct inode *ip; /* inode of guy being linked to */ struct inode *ip; /* inode of guy being linked to */
vnode_t *tdvp; /* target directory for new name/link */ vnode_t *tdvp; /* target directory for new name/link */
vnode_t *vp; /* vp of name being linked */ vnode_t *vp; /* vp of name being linked */
vattr_t *vattr; vattr_t vattr;
int error; int error;
ip = old_dentry->d_inode; /* inode being linked to */ ip = old_dentry->d_inode; /* inode being linked to */
if (S_ISDIR(ip->i_mode)) if (S_ISDIR(ip->i_mode))
return -EPERM; return -EPERM;
vattr = kmalloc(sizeof(*vattr), GFP_KERNEL);
if (unlikely(!vattr))
return -ENOMEM;
tdvp = LINVFS_GET_VP(dir); tdvp = LINVFS_GET_VP(dir);
vp = LINVFS_GET_VP(ip); vp = LINVFS_GET_VP(ip);
...@@ -447,10 +436,9 @@ xfs_vn_link( ...@@ -447,10 +436,9 @@ xfs_vn_link(
if (likely(!error)) { if (likely(!error)) {
VMODIFY(tdvp); VMODIFY(tdvp);
VN_HOLD(vp); VN_HOLD(vp);
xfs_validate_fields(ip, vattr); xfs_validate_fields(ip, &vattr);
d_instantiate(dentry, ip); d_instantiate(dentry, ip);
} }
kfree(vattr);
return -error; return -error;
} }
...@@ -461,22 +449,17 @@ xfs_vn_unlink( ...@@ -461,22 +449,17 @@ xfs_vn_unlink(
{ {
struct inode *inode; struct inode *inode;
vnode_t *dvp; /* directory containing name to remove */ vnode_t *dvp; /* directory containing name to remove */
vattr_t *vattr; vattr_t vattr;
int error; int error;
vattr = kmalloc(sizeof(*vattr), GFP_KERNEL);
if (unlikely(!vattr))
return -ENOMEM;
inode = dentry->d_inode; inode = dentry->d_inode;
dvp = LINVFS_GET_VP(dir); dvp = LINVFS_GET_VP(dir);
VOP_REMOVE(dvp, dentry, NULL, error); VOP_REMOVE(dvp, dentry, NULL, error);
if (likely(!error)) { if (likely(!error)) {
xfs_validate_fields(dir, vattr); /* size needs update */ xfs_validate_fields(dir, &vattr); /* size needs update */
xfs_validate_fields(inode, vattr); xfs_validate_fields(inode, &vattr);
} }
kfree(vattr);
return -error; return -error;
} }
...@@ -487,7 +470,7 @@ xfs_vn_symlink( ...@@ -487,7 +470,7 @@ xfs_vn_symlink(
const char *symname) const char *symname)
{ {
struct inode *ip; struct inode *ip;
vattr_t *vattr; vattr_t vattr = { 0 };
vnode_t *dvp; /* directory containing name of symlink */ vnode_t *dvp; /* directory containing name of symlink */
vnode_t *cvp; /* used to lookup symlink to put in dentry */ vnode_t *cvp; /* used to lookup symlink to put in dentry */
int error; int error;
...@@ -495,27 +478,21 @@ xfs_vn_symlink( ...@@ -495,27 +478,21 @@ xfs_vn_symlink(
dvp = LINVFS_GET_VP(dir); dvp = LINVFS_GET_VP(dir);
cvp = NULL; cvp = NULL;
vattr = kmalloc(sizeof(*vattr), GFP_KERNEL); vattr.va_mode = S_IFLNK |
if (unlikely(!vattr))
return -ENOMEM;
memset(vattr, 0, sizeof(*vattr));
vattr->va_mode = S_IFLNK |
(irix_symlink_mode ? 0777 & ~current->fs->umask : S_IRWXUGO); (irix_symlink_mode ? 0777 & ~current->fs->umask : S_IRWXUGO);
vattr->va_mask = XFS_AT_TYPE|XFS_AT_MODE; vattr.va_mask = XFS_AT_TYPE|XFS_AT_MODE;
error = 0; error = 0;
VOP_SYMLINK(dvp, dentry, vattr, (char *)symname, &cvp, NULL, error); VOP_SYMLINK(dvp, dentry, &vattr, (char *)symname, &cvp, NULL, error);
if (likely(!error && cvp)) { if (likely(!error && cvp)) {
error = xfs_init_security(cvp, dir); error = xfs_init_security(cvp, dir);
if (likely(!error)) { if (likely(!error)) {
ip = LINVFS_GET_IP(cvp); ip = LINVFS_GET_IP(cvp);
d_instantiate(dentry, ip); d_instantiate(dentry, ip);
xfs_validate_fields(dir, vattr); xfs_validate_fields(dir, &vattr);
xfs_validate_fields(ip, vattr); xfs_validate_fields(ip, &vattr);
} }
} }
kfree(vattr);
return -error; return -error;
} }
...@@ -526,19 +503,14 @@ xfs_vn_rmdir( ...@@ -526,19 +503,14 @@ xfs_vn_rmdir(
{ {
struct inode *inode = dentry->d_inode; struct inode *inode = dentry->d_inode;
vnode_t *dvp = LINVFS_GET_VP(dir); vnode_t *dvp = LINVFS_GET_VP(dir);
vattr_t *vattr; vattr_t vattr;
int error; int error;
vattr = kmalloc(sizeof(*vattr), GFP_KERNEL);
if (unlikely(!vattr))
return -ENOMEM;
VOP_RMDIR(dvp, dentry, NULL, error); VOP_RMDIR(dvp, dentry, NULL, error);
if (likely(!error)) { if (likely(!error)) {
xfs_validate_fields(inode, vattr); xfs_validate_fields(inode, &vattr);
xfs_validate_fields(dir, vattr); xfs_validate_fields(dir, &vattr);
} }
kfree(vattr);
return -error; return -error;
} }
...@@ -552,25 +524,20 @@ xfs_vn_rename( ...@@ -552,25 +524,20 @@ xfs_vn_rename(
struct inode *new_inode = ndentry->d_inode; struct inode *new_inode = ndentry->d_inode;
vnode_t *fvp; /* from directory */ vnode_t *fvp; /* from directory */
vnode_t *tvp; /* target directory */ vnode_t *tvp; /* target directory */
vattr_t *vattr; vattr_t vattr;
int error; int error;
vattr = kmalloc(sizeof(*vattr), GFP_KERNEL);
if (unlikely(!vattr))
return -ENOMEM;
fvp = LINVFS_GET_VP(odir); fvp = LINVFS_GET_VP(odir);
tvp = LINVFS_GET_VP(ndir); tvp = LINVFS_GET_VP(ndir);
VOP_RENAME(fvp, odentry, tvp, ndentry, NULL, error); VOP_RENAME(fvp, odentry, tvp, ndentry, NULL, error);
if (likely(!error)) { if (likely(!error)) {
if (new_inode) if (new_inode)
xfs_validate_fields(new_inode, vattr); xfs_validate_fields(new_inode, &vattr);
xfs_validate_fields(odir, vattr); xfs_validate_fields(odir, &vattr);
if (ndir != odir) if (ndir != odir)
xfs_validate_fields(ndir, vattr); xfs_validate_fields(ndir, &vattr);
} }
kfree(vattr);
return -error; return -error;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment