Commit 1f6553f9 authored by Nathan Scott's avatar Nathan Scott

[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: default avatarNathan Scott <nathans@sgi.com>
parent 0293ce3a
......@@ -145,17 +145,22 @@ __linvfs_readv(
{
struct inode *inode = file->f_mapping->host;
vnode_t *vp = LINVFS_GET_VP(inode);
struct kiocb kiocb;
struct kiocb *kiocb;
ssize_t rval;
init_sync_kiocb(&kiocb, file);
kiocb.ki_pos = *ppos;
kiocb = kmalloc(sizeof(*kiocb), GFP_KERNEL);
if (unlikely(!kiocb))
return -ENOMEM;
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;
*ppos = kiocb->ki_pos;
kfree(kiocb);
return rval;
}
......@@ -190,17 +195,22 @@ __linvfs_writev(
{
struct inode *inode = file->f_mapping->host;
vnode_t *vp = LINVFS_GET_VP(inode);
struct kiocb kiocb;
struct kiocb *kiocb;
ssize_t rval;
init_sync_kiocb(&kiocb, file);
kiocb.ki_pos = *ppos;
kiocb = kmalloc(sizeof(*kiocb), GFP_KERNEL);
if (unlikely(!kiocb))
return -ENOMEM;
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;
*ppos = kiocb->ki_pos;
kfree(kiocb);
return rval;
}
......
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