diff options
author | Nathan Scott <nathans@sgi.com> | 2006-03-13 21:30:48 -0500 |
---|---|---|
committer | Nathan Scott <nathans@sgi.com> | 2006-03-13 21:30:48 -0500 |
commit | 1f6553f9f9b6e41375c605769a75bd1646685a1b (patch) | |
tree | 8fc48aaad9b58ebece96747d058b952e72866aa1 /fs/xfs | |
parent | 0293ce3a9fd1b34c933a96577a8ba737b681cf75 (diff) |
[XFS] Dynamically allocate local kiocb structures in readv/writev routines
to reduce stack footprint.
SGI-PV: 947312
SGI-Modid: xfs-linux-melb:xfs-kern:25358a
Signed-off-by: Nathan Scott <nathans@sgi.com>
Diffstat (limited to 'fs/xfs')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_file.c | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/fs/xfs/linux-2.6/xfs_file.c b/fs/xfs/linux-2.6/xfs_file.c index ced4404339c7..269995ddfbdf 100644 --- a/fs/xfs/linux-2.6/xfs_file.c +++ b/fs/xfs/linux-2.6/xfs_file.c | |||
@@ -145,17 +145,22 @@ __linvfs_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 | init_sync_kiocb(&kiocb, file); | 151 | kiocb = kmalloc(sizeof(*kiocb), GFP_KERNEL); |
152 | kiocb.ki_pos = *ppos; | 152 | if (unlikely(!kiocb)) |
153 | return -ENOMEM; | ||
154 | |||
155 | init_sync_kiocb(kiocb, file); | ||
156 | kiocb->ki_pos = *ppos; | ||
153 | 157 | ||
154 | if (unlikely(file->f_flags & O_DIRECT)) | 158 | if (unlikely(file->f_flags & O_DIRECT)) |
155 | ioflags |= IO_ISDIRECT; | 159 | ioflags |= IO_ISDIRECT; |
156 | VOP_READ(vp, &kiocb, iov, nr_segs, &kiocb.ki_pos, ioflags, NULL, rval); | 160 | VOP_READ(vp, kiocb, iov, nr_segs, &kiocb->ki_pos, ioflags, NULL, rval); |
157 | 161 | ||
158 | *ppos = kiocb.ki_pos; | 162 | *ppos = kiocb->ki_pos; |
163 | kfree(kiocb); | ||
159 | return rval; | 164 | return rval; |
160 | } | 165 | } |
161 | 166 | ||
@@ -190,17 +195,22 @@ __linvfs_writev( | |||
190 | { | 195 | { |
191 | struct inode *inode = file->f_mapping->host; | 196 | struct inode *inode = file->f_mapping->host; |
192 | vnode_t *vp = LINVFS_GET_VP(inode); | 197 | vnode_t *vp = LINVFS_GET_VP(inode); |
193 | struct kiocb kiocb; | 198 | struct kiocb *kiocb; |
194 | ssize_t rval; | 199 | ssize_t rval; |
195 | 200 | ||
196 | init_sync_kiocb(&kiocb, file); | 201 | kiocb = kmalloc(sizeof(*kiocb), GFP_KERNEL); |
197 | kiocb.ki_pos = *ppos; | 202 | if (unlikely(!kiocb)) |
203 | return -ENOMEM; | ||
204 | |||
205 | init_sync_kiocb(kiocb, file); | ||
206 | kiocb->ki_pos = *ppos; | ||
198 | if (unlikely(file->f_flags & O_DIRECT)) | 207 | if (unlikely(file->f_flags & O_DIRECT)) |
199 | ioflags |= IO_ISDIRECT; | 208 | ioflags |= IO_ISDIRECT; |
200 | 209 | ||
201 | VOP_WRITE(vp, &kiocb, iov, nr_segs, &kiocb.ki_pos, ioflags, NULL, rval); | 210 | VOP_WRITE(vp, kiocb, iov, nr_segs, &kiocb->ki_pos, ioflags, NULL, rval); |
202 | 211 | ||
203 | *ppos = kiocb.ki_pos; | 212 | *ppos = kiocb->ki_pos; |
213 | kfree(kiocb); | ||
204 | return rval; | 214 | return rval; |
205 | } | 215 | } |
206 | 216 | ||
@@ -435,7 +445,7 @@ linvfs_ioctl( | |||
435 | unsigned long arg) | 445 | unsigned long arg) |
436 | { | 446 | { |
437 | int error; | 447 | int error; |
438 | struct inode *inode = filp->f_dentry->d_inode; | 448 | struct inode *inode = filp->f_dentry->d_inode; |
439 | vnode_t *vp = LINVFS_GET_VP(inode); | 449 | vnode_t *vp = LINVFS_GET_VP(inode); |
440 | 450 | ||
441 | VOP_IOCTL(vp, inode, filp, 0, cmd, (void __user *)arg, error); | 451 | VOP_IOCTL(vp, inode, filp, 0, cmd, (void __user *)arg, error); |
@@ -457,7 +467,7 @@ linvfs_ioctl_invis( | |||
457 | unsigned long arg) | 467 | unsigned long arg) |
458 | { | 468 | { |
459 | int error; | 469 | int error; |
460 | struct inode *inode = filp->f_dentry->d_inode; | 470 | struct inode *inode = filp->f_dentry->d_inode; |
461 | vnode_t *vp = LINVFS_GET_VP(inode); | 471 | vnode_t *vp = LINVFS_GET_VP(inode); |
462 | 472 | ||
463 | ASSERT(vp); | 473 | ASSERT(vp); |