Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 23124
b: refs/heads/master
c: 524fbf5
h: refs/heads/master
v: v3
  • Loading branch information
Nathan Scott committed Mar 14, 2006
1 parent d18c7fb commit 867666b
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 90 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f30a1211119741d2c1063ad613bec8434fb9d099
refs/heads/master: 524fbf5dd1b25acffe6f8a4ed5f3cce1023cfdb8
42 changes: 14 additions & 28 deletions trunk/fs/xfs/linux-2.6/xfs_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,22 +145,17 @@ __xfs_file_readv(
{
struct inode *inode = file->f_mapping->host;
vnode_t *vp = LINVFS_GET_VP(inode);
struct kiocb *kiocb;
struct kiocb kiocb;
ssize_t rval;

kiocb = kmalloc(sizeof(*kiocb), GFP_KERNEL);
if (unlikely(!kiocb))
return -ENOMEM;

init_sync_kiocb(kiocb, file);
kiocb->ki_pos = *ppos;
init_sync_kiocb(&kiocb, file);
kiocb.ki_pos = *ppos;

if (unlikely(file->f_flags & O_DIRECT))
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;
kfree(kiocb);
*ppos = kiocb.ki_pos;
return rval;
}

Expand Down Expand Up @@ -195,22 +190,17 @@ __xfs_file_writev(
{
struct inode *inode = file->f_mapping->host;
vnode_t *vp = LINVFS_GET_VP(inode);
struct kiocb *kiocb;
struct kiocb kiocb;
ssize_t rval;

kiocb = kmalloc(sizeof(*kiocb), GFP_KERNEL);
if (unlikely(!kiocb))
return -ENOMEM;

init_sync_kiocb(kiocb, file);
kiocb->ki_pos = *ppos;
init_sync_kiocb(&kiocb, file);
kiocb.ki_pos = *ppos;
if (unlikely(file->f_flags & O_DIRECT))
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;
kfree(kiocb);
*ppos = kiocb.ki_pos;
return rval;
}

Expand Down Expand Up @@ -420,7 +410,7 @@ xfs_file_mmap(
{
struct inode *ip = filp->f_dentry->d_inode;
vnode_t *vp = LINVFS_GET_VP(ip);
vattr_t *vattr;
vattr_t vattr;
int error;

vma->vm_ops = &xfs_file_vm_ops;
Expand All @@ -431,14 +421,10 @@ xfs_file_mmap(
}
#endif /* CONFIG_XFS_DMAPI */

vattr = kmalloc(sizeof(*vattr), GFP_KERNEL);
if (unlikely(!vattr))
return -ENOMEM;
vattr->va_mask = XFS_AT_UPDATIME;
VOP_SETATTR(vp, vattr, XFS_AT_UPDATIME, NULL, error);
vattr.va_mask = XFS_AT_UPDATIME;
VOP_SETATTR(vp, &vattr, XFS_AT_UPDATIME, NULL, error);
if (likely(!error))
__vn_revalidate(vp, vattr); /* update flags */
kfree(vattr);
__vn_revalidate(vp, &vattr); /* update flags */
return 0;
}

Expand Down
89 changes: 28 additions & 61 deletions trunk/fs/xfs/linux-2.6/xfs_iops.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ xfs_vn_mknod(
dev_t rdev)
{
struct inode *ip;
vattr_t *vattr;
vattr_t vattr = { 0 };
vnode_t *vp = NULL, *dvp = LINVFS_GET_VP(dir);
xfs_acl_t *default_acl = NULL;
attrexists_t test_default_acl = _ACL_DEFAULT_EXISTS;
Expand All @@ -308,13 +308,8 @@ xfs_vn_mknod(
if (unlikely(!sysv_valid_dev(rdev) || MAJOR(rdev) & ~0x1ff))
return -EINVAL;

vattr = kmalloc(sizeof(*vattr), GFP_KERNEL);
if (unlikely(!vattr))
return -ENOMEM;

if (unlikely(test_default_acl && test_default_acl(dvp))) {
if (!_ACL_ALLOC(default_acl)) {
kfree(vattr);
return -ENOMEM;
}
if (!_ACL_GET_DEFAULT(dvp, default_acl)) {
Expand All @@ -326,20 +321,19 @@ xfs_vn_mknod(
if (IS_POSIXACL(dir) && !default_acl && xfs_has_fs_struct(current))
mode &= ~current->fs->umask;

memset(vattr, 0, sizeof(*vattr));
vattr->va_mask = XFS_AT_TYPE|XFS_AT_MODE;
vattr->va_mode = mode;
vattr.va_mask = XFS_AT_TYPE|XFS_AT_MODE;
vattr.va_mode = mode;

switch (mode & S_IFMT) {
case S_IFCHR: case S_IFBLK: case S_IFIFO: case S_IFSOCK:
vattr->va_rdev = sysv_encode_dev(rdev);
vattr->va_mask |= XFS_AT_RDEV;
vattr.va_rdev = sysv_encode_dev(rdev);
vattr.va_mask |= XFS_AT_RDEV;
/*FALLTHROUGH*/
case S_IFREG:
VOP_CREATE(dvp, dentry, vattr, &vp, NULL, error);
VOP_CREATE(dvp, dentry, &vattr, &vp, NULL, error);
break;
case S_IFDIR:
VOP_MKDIR(dvp, dentry, vattr, &vp, NULL, error);
VOP_MKDIR(dvp, dentry, &vattr, &vp, NULL, error);
break;
default:
error = EINVAL;
Expand All @@ -354,7 +348,7 @@ xfs_vn_mknod(

if (unlikely(default_acl)) {
if (!error) {
error = _ACL_INHERIT(vp, vattr, default_acl);
error = _ACL_INHERIT(vp, &vattr, default_acl);
if (!error)
VMODIFY(vp);
else
Expand All @@ -370,11 +364,10 @@ xfs_vn_mknod(
if (S_ISCHR(mode) || S_ISBLK(mode))
ip->i_rdev = rdev;
else if (S_ISDIR(mode))
xfs_validate_fields(ip, vattr);
xfs_validate_fields(ip, &vattr);
d_instantiate(dentry, ip);
xfs_validate_fields(dir, vattr);
xfs_validate_fields(dir, &vattr);
}
kfree(vattr);
return -error;
}

Expand Down Expand Up @@ -429,28 +422,23 @@ xfs_vn_link(
struct inode *ip; /* inode of guy being linked to */
vnode_t *tdvp; /* target directory for new name/link */
vnode_t *vp; /* vp of name being linked */
vattr_t *vattr;
vattr_t vattr;
int error;

ip = old_dentry->d_inode; /* inode being linked to */
if (S_ISDIR(ip->i_mode))
return -EPERM;

vattr = kmalloc(sizeof(*vattr), GFP_KERNEL);
if (unlikely(!vattr))
return -ENOMEM;

tdvp = LINVFS_GET_VP(dir);
vp = LINVFS_GET_VP(ip);

VOP_LINK(tdvp, vp, dentry, NULL, error);
if (likely(!error)) {
VMODIFY(tdvp);
VN_HOLD(vp);
xfs_validate_fields(ip, vattr);
xfs_validate_fields(ip, &vattr);
d_instantiate(dentry, ip);
}
kfree(vattr);
return -error;
}

Expand All @@ -461,22 +449,17 @@ xfs_vn_unlink(
{
struct inode *inode;
vnode_t *dvp; /* directory containing name to remove */
vattr_t *vattr;
vattr_t vattr;
int error;

vattr = kmalloc(sizeof(*vattr), GFP_KERNEL);
if (unlikely(!vattr))
return -ENOMEM;

inode = dentry->d_inode;
dvp = LINVFS_GET_VP(dir);

VOP_REMOVE(dvp, dentry, NULL, error);
if (likely(!error)) {
xfs_validate_fields(dir, vattr); /* size needs update */
xfs_validate_fields(inode, vattr);
xfs_validate_fields(dir, &vattr); /* size needs update */
xfs_validate_fields(inode, &vattr);
}
kfree(vattr);
return -error;
}

Expand All @@ -487,35 +470,29 @@ xfs_vn_symlink(
const char *symname)
{
struct inode *ip;
vattr_t *vattr;
vattr_t vattr = { 0 };
vnode_t *dvp; /* directory containing name of symlink */
vnode_t *cvp; /* used to lookup symlink to put in dentry */
int error;

dvp = LINVFS_GET_VP(dir);
cvp = NULL;

vattr = kmalloc(sizeof(*vattr), GFP_KERNEL);
if (unlikely(!vattr))
return -ENOMEM;

memset(vattr, 0, sizeof(*vattr));
vattr->va_mode = S_IFLNK |
vattr.va_mode = S_IFLNK |
(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;
VOP_SYMLINK(dvp, dentry, vattr, (char *)symname, &cvp, NULL, error);
VOP_SYMLINK(dvp, dentry, &vattr, (char *)symname, &cvp, NULL, error);
if (likely(!error && cvp)) {
error = xfs_init_security(cvp, dir);
if (likely(!error)) {
ip = LINVFS_GET_IP(cvp);
d_instantiate(dentry, ip);
xfs_validate_fields(dir, vattr);
xfs_validate_fields(ip, vattr);
xfs_validate_fields(dir, &vattr);
xfs_validate_fields(ip, &vattr);
}
}
kfree(vattr);
return -error;
}

Expand All @@ -526,19 +503,14 @@ xfs_vn_rmdir(
{
struct inode *inode = dentry->d_inode;
vnode_t *dvp = LINVFS_GET_VP(dir);
vattr_t *vattr;
vattr_t vattr;
int error;

vattr = kmalloc(sizeof(*vattr), GFP_KERNEL);
if (unlikely(!vattr))
return -ENOMEM;

VOP_RMDIR(dvp, dentry, NULL, error);
if (likely(!error)) {
xfs_validate_fields(inode, vattr);
xfs_validate_fields(dir, vattr);
xfs_validate_fields(inode, &vattr);
xfs_validate_fields(dir, &vattr);
}
kfree(vattr);
return -error;
}

Expand All @@ -552,25 +524,20 @@ xfs_vn_rename(
struct inode *new_inode = ndentry->d_inode;
vnode_t *fvp; /* from directory */
vnode_t *tvp; /* target directory */
vattr_t *vattr;
vattr_t vattr;
int error;

vattr = kmalloc(sizeof(*vattr), GFP_KERNEL);
if (unlikely(!vattr))
return -ENOMEM;

fvp = LINVFS_GET_VP(odir);
tvp = LINVFS_GET_VP(ndir);

VOP_RENAME(fvp, odentry, tvp, ndentry, NULL, error);
if (likely(!error)) {
if (new_inode)
xfs_validate_fields(new_inode, vattr);
xfs_validate_fields(odir, vattr);
xfs_validate_fields(new_inode, &vattr);
xfs_validate_fields(odir, &vattr);
if (ndir != odir)
xfs_validate_fields(ndir, vattr);
xfs_validate_fields(ndir, &vattr);
}
kfree(vattr);
return -error;
}

Expand Down

0 comments on commit 867666b

Please sign in to comment.