diff options
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_file.c')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_file.c | 42 |
1 files changed, 14 insertions, 28 deletions
diff --git a/fs/xfs/linux-2.6/xfs_file.c b/fs/xfs/linux-2.6/xfs_file.c index b050e4079427..c271c9936498 100644 --- a/fs/xfs/linux-2.6/xfs_file.c +++ b/fs/xfs/linux-2.6/xfs_file.c | |||
@@ -145,22 +145,17 @@ __xfs_file_readv( | |||
145 | { | 145 | { |
146 | struct inode *inode = file->f_mapping->host; | 146 | struct inode *inode = file->f_mapping->host; |
147 | vnode_t *vp = LINVFS_GET_VP(inode); | 147 | vnode_t *vp = LINVFS_GET_VP(inode); |
148 | struct kiocb *kiocb; | 148 | struct kiocb kiocb; |
149 | ssize_t rval; | 149 | ssize_t rval; |
150 | 150 | ||
151 | kiocb = kmalloc(sizeof(*kiocb), GFP_KERNEL); | 151 | init_sync_kiocb(&kiocb, file); |
152 | if (unlikely(!kiocb)) | 152 | kiocb.ki_pos = *ppos; |
153 | return -ENOMEM; | ||
154 | |||
155 | init_sync_kiocb(kiocb, file); | ||
156 | kiocb->ki_pos = *ppos; | ||
157 | 153 | ||
158 | if (unlikely(file->f_flags & O_DIRECT)) | 154 | if (unlikely(file->f_flags & O_DIRECT)) |
159 | ioflags |= IO_ISDIRECT; | 155 | ioflags |= IO_ISDIRECT; |
160 | VOP_READ(vp, kiocb, iov, nr_segs, &kiocb->ki_pos, ioflags, NULL, rval); | 156 | VOP_READ(vp, &kiocb, iov, nr_segs, &kiocb.ki_pos, ioflags, NULL, rval); |
161 | 157 | ||
162 | *ppos = kiocb->ki_pos; | 158 | *ppos = kiocb.ki_pos; |
163 | kfree(kiocb); | ||
164 | return rval; | 159 | return rval; |
165 | } | 160 | } |
166 | 161 | ||
@@ -195,22 +190,17 @@ __xfs_file_writev( | |||
195 | { | 190 | { |
196 | struct inode *inode = file->f_mapping->host; | 191 | struct inode *inode = file->f_mapping->host; |
197 | vnode_t *vp = LINVFS_GET_VP(inode); | 192 | vnode_t *vp = LINVFS_GET_VP(inode); |
198 | struct kiocb *kiocb; | 193 | struct kiocb kiocb; |
199 | ssize_t rval; | 194 | ssize_t rval; |
200 | 195 | ||
201 | kiocb = kmalloc(sizeof(*kiocb), GFP_KERNEL); | 196 | init_sync_kiocb(&kiocb, file); |
202 | if (unlikely(!kiocb)) | 197 | kiocb.ki_pos = *ppos; |
203 | return -ENOMEM; | ||
204 | |||
205 | init_sync_kiocb(kiocb, file); | ||
206 | kiocb->ki_pos = *ppos; | ||
207 | if (unlikely(file->f_flags & O_DIRECT)) | 198 | if (unlikely(file->f_flags & O_DIRECT)) |
208 | ioflags |= IO_ISDIRECT; | 199 | ioflags |= IO_ISDIRECT; |
209 | 200 | ||
210 | VOP_WRITE(vp, kiocb, iov, nr_segs, &kiocb->ki_pos, ioflags, NULL, rval); | 201 | VOP_WRITE(vp, &kiocb, iov, nr_segs, &kiocb.ki_pos, ioflags, NULL, rval); |
211 | 202 | ||
212 | *ppos = kiocb->ki_pos; | 203 | *ppos = kiocb.ki_pos; |
213 | kfree(kiocb); | ||
214 | return rval; | 204 | return rval; |
215 | } | 205 | } |
216 | 206 | ||
@@ -420,7 +410,7 @@ xfs_file_mmap( | |||
420 | { | 410 | { |
421 | struct inode *ip = filp->f_dentry->d_inode; | 411 | struct inode *ip = filp->f_dentry->d_inode; |
422 | vnode_t *vp = LINVFS_GET_VP(ip); | 412 | vnode_t *vp = LINVFS_GET_VP(ip); |
423 | vattr_t *vattr; | 413 | vattr_t vattr; |
424 | int error; | 414 | int error; |
425 | 415 | ||
426 | vma->vm_ops = &xfs_file_vm_ops; | 416 | vma->vm_ops = &xfs_file_vm_ops; |
@@ -431,14 +421,10 @@ xfs_file_mmap( | |||
431 | } | 421 | } |
432 | #endif /* CONFIG_XFS_DMAPI */ | 422 | #endif /* CONFIG_XFS_DMAPI */ |
433 | 423 | ||
434 | vattr = kmalloc(sizeof(*vattr), GFP_KERNEL); | 424 | vattr.va_mask = XFS_AT_UPDATIME; |
435 | if (unlikely(!vattr)) | 425 | VOP_SETATTR(vp, &vattr, XFS_AT_UPDATIME, NULL, error); |
436 | return -ENOMEM; | ||
437 | vattr->va_mask = XFS_AT_UPDATIME; | ||
438 | VOP_SETATTR(vp, vattr, XFS_AT_UPDATIME, NULL, error); | ||
439 | if (likely(!error)) | 426 | if (likely(!error)) |
440 | __vn_revalidate(vp, vattr); /* update flags */ | 427 | __vn_revalidate(vp, &vattr); /* update flags */ |
441 | kfree(vattr); | ||
442 | return 0; | 428 | return 0; |
443 | } | 429 | } |
444 | 430 | ||