diff options
author | Badari Pulavarty <pbadari@us.ibm.com> | 2006-10-01 02:28:46 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-01 03:39:28 -0400 |
commit | 027445c37282bc1ed26add45e573ad2d3e4860a5 (patch) | |
tree | 93eab101a938ffebaea64703033c8649df4d73f0 /fs/nfs/file.c | |
parent | 9ea0f9499d15c49df23e7aac4332d830c40e12d0 (diff) |
[PATCH] Vectorize aio_read/aio_write fileop methods
This patch vectorizes aio_read() and aio_write() methods to prepare for
collapsing all aio & vectored operations into one interface - which is
aio_read()/aio_write().
Signed-off-by: Badari Pulavarty <pbadari@us.ibm.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Cc: Michael Holzheu <HOLZHEU@de.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/nfs/file.c')
-rw-r--r-- | fs/nfs/file.c | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/fs/nfs/file.c b/fs/nfs/file.c index be997d649127..cc93865cea93 100644 --- a/fs/nfs/file.c +++ b/fs/nfs/file.c | |||
@@ -41,8 +41,10 @@ static int nfs_file_release(struct inode *, struct file *); | |||
41 | static loff_t nfs_file_llseek(struct file *file, loff_t offset, int origin); | 41 | static loff_t nfs_file_llseek(struct file *file, loff_t offset, int origin); |
42 | static int nfs_file_mmap(struct file *, struct vm_area_struct *); | 42 | static int nfs_file_mmap(struct file *, struct vm_area_struct *); |
43 | static ssize_t nfs_file_sendfile(struct file *, loff_t *, size_t, read_actor_t, void *); | 43 | static ssize_t nfs_file_sendfile(struct file *, loff_t *, size_t, read_actor_t, void *); |
44 | static ssize_t nfs_file_read(struct kiocb *, char __user *, size_t, loff_t); | 44 | static ssize_t nfs_file_read(struct kiocb *, const struct iovec *iov, |
45 | static ssize_t nfs_file_write(struct kiocb *, const char __user *, size_t, loff_t); | 45 | unsigned long nr_segs, loff_t pos); |
46 | static ssize_t nfs_file_write(struct kiocb *, const struct iovec *iov, | ||
47 | unsigned long nr_segs, loff_t pos); | ||
46 | static int nfs_file_flush(struct file *, fl_owner_t id); | 48 | static int nfs_file_flush(struct file *, fl_owner_t id); |
47 | static int nfs_fsync(struct file *, struct dentry *dentry, int datasync); | 49 | static int nfs_fsync(struct file *, struct dentry *dentry, int datasync); |
48 | static int nfs_check_flags(int flags); | 50 | static int nfs_check_flags(int flags); |
@@ -53,8 +55,8 @@ const struct file_operations nfs_file_operations = { | |||
53 | .llseek = nfs_file_llseek, | 55 | .llseek = nfs_file_llseek, |
54 | .read = do_sync_read, | 56 | .read = do_sync_read, |
55 | .write = do_sync_write, | 57 | .write = do_sync_write, |
56 | .aio_read = nfs_file_read, | 58 | .aio_read = nfs_file_read, |
57 | .aio_write = nfs_file_write, | 59 | .aio_write = nfs_file_write, |
58 | .mmap = nfs_file_mmap, | 60 | .mmap = nfs_file_mmap, |
59 | .open = nfs_file_open, | 61 | .open = nfs_file_open, |
60 | .flush = nfs_file_flush, | 62 | .flush = nfs_file_flush, |
@@ -196,15 +198,17 @@ nfs_file_flush(struct file *file, fl_owner_t id) | |||
196 | } | 198 | } |
197 | 199 | ||
198 | static ssize_t | 200 | static ssize_t |
199 | nfs_file_read(struct kiocb *iocb, char __user * buf, size_t count, loff_t pos) | 201 | nfs_file_read(struct kiocb *iocb, const struct iovec *iov, |
202 | unsigned long nr_segs, loff_t pos) | ||
200 | { | 203 | { |
201 | struct dentry * dentry = iocb->ki_filp->f_dentry; | 204 | struct dentry * dentry = iocb->ki_filp->f_dentry; |
202 | struct inode * inode = dentry->d_inode; | 205 | struct inode * inode = dentry->d_inode; |
203 | ssize_t result; | 206 | ssize_t result; |
207 | size_t count = iov_length(iov, nr_segs); | ||
204 | 208 | ||
205 | #ifdef CONFIG_NFS_DIRECTIO | 209 | #ifdef CONFIG_NFS_DIRECTIO |
206 | if (iocb->ki_filp->f_flags & O_DIRECT) | 210 | if (iocb->ki_filp->f_flags & O_DIRECT) |
207 | return nfs_file_direct_read(iocb, buf, count, pos); | 211 | return nfs_file_direct_read(iocb, iov, nr_segs, pos); |
208 | #endif | 212 | #endif |
209 | 213 | ||
210 | dfprintk(VFS, "nfs: read(%s/%s, %lu@%lu)\n", | 214 | dfprintk(VFS, "nfs: read(%s/%s, %lu@%lu)\n", |
@@ -214,7 +218,7 @@ nfs_file_read(struct kiocb *iocb, char __user * buf, size_t count, loff_t pos) | |||
214 | result = nfs_revalidate_mapping(inode, iocb->ki_filp->f_mapping); | 218 | result = nfs_revalidate_mapping(inode, iocb->ki_filp->f_mapping); |
215 | nfs_add_stats(inode, NFSIOS_NORMALREADBYTES, count); | 219 | nfs_add_stats(inode, NFSIOS_NORMALREADBYTES, count); |
216 | if (!result) | 220 | if (!result) |
217 | result = generic_file_aio_read(iocb, buf, count, pos); | 221 | result = generic_file_aio_read(iocb, iov, nr_segs, pos); |
218 | return result; | 222 | return result; |
219 | } | 223 | } |
220 | 224 | ||
@@ -336,24 +340,22 @@ const struct address_space_operations nfs_file_aops = { | |||
336 | #endif | 340 | #endif |
337 | }; | 341 | }; |
338 | 342 | ||
339 | /* | 343 | static ssize_t nfs_file_write(struct kiocb *iocb, const struct iovec *iov, |
340 | * Write to a file (through the page cache). | 344 | unsigned long nr_segs, loff_t pos) |
341 | */ | ||
342 | static ssize_t | ||
343 | nfs_file_write(struct kiocb *iocb, const char __user *buf, size_t count, loff_t pos) | ||
344 | { | 345 | { |
345 | struct dentry * dentry = iocb->ki_filp->f_dentry; | 346 | struct dentry * dentry = iocb->ki_filp->f_dentry; |
346 | struct inode * inode = dentry->d_inode; | 347 | struct inode * inode = dentry->d_inode; |
347 | ssize_t result; | 348 | ssize_t result; |
349 | size_t count = iov_length(iov, nr_segs); | ||
348 | 350 | ||
349 | #ifdef CONFIG_NFS_DIRECTIO | 351 | #ifdef CONFIG_NFS_DIRECTIO |
350 | if (iocb->ki_filp->f_flags & O_DIRECT) | 352 | if (iocb->ki_filp->f_flags & O_DIRECT) |
351 | return nfs_file_direct_write(iocb, buf, count, pos); | 353 | return nfs_file_direct_write(iocb, iov, nr_segs, pos); |
352 | #endif | 354 | #endif |
353 | 355 | ||
354 | dfprintk(VFS, "nfs: write(%s/%s(%ld), %lu@%lu)\n", | 356 | dfprintk(VFS, "nfs: write(%s/%s(%ld), %lu@%Ld)\n", |
355 | dentry->d_parent->d_name.name, dentry->d_name.name, | 357 | dentry->d_parent->d_name.name, dentry->d_name.name, |
356 | inode->i_ino, (unsigned long) count, (unsigned long) pos); | 358 | inode->i_ino, (unsigned long) count, (long long) pos); |
357 | 359 | ||
358 | result = -EBUSY; | 360 | result = -EBUSY; |
359 | if (IS_SWAPFILE(inode)) | 361 | if (IS_SWAPFILE(inode)) |
@@ -372,7 +374,7 @@ nfs_file_write(struct kiocb *iocb, const char __user *buf, size_t count, loff_t | |||
372 | goto out; | 374 | goto out; |
373 | 375 | ||
374 | nfs_add_stats(inode, NFSIOS_NORMALWRITTENBYTES, count); | 376 | nfs_add_stats(inode, NFSIOS_NORMALWRITTENBYTES, count); |
375 | result = generic_file_aio_write(iocb, buf, count, pos); | 377 | result = generic_file_aio_write(iocb, iov, nr_segs, pos); |
376 | out: | 378 | out: |
377 | return result; | 379 | return result; |
378 | 380 | ||