diff options
author | Badari Pulavarty <pbadari@us.ibm.com> | 2006-10-01 02:28:48 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-01 03:39:28 -0400 |
commit | 543ade1fc901db4c3dbe9fb27241fb977f1f3eea (patch) | |
tree | cdd1a1f67a718adf71e92fe08e4b3d33bf3dbadc /fs/udf/file.c | |
parent | ee0b3e671baff681d69fbf0db33b47603c0a8280 (diff) |
[PATCH] Streamline generic_file_* interfaces and filemap cleanups
This patch cleans up generic_file_*_read/write() interfaces. Christoph
Hellwig gave me the idea for this clean ups.
In a nutshell, all filesystems should set .aio_read/.aio_write methods and use
do_sync_read/ do_sync_write() as their .read/.write methods. This allows us
to cleanup all variants of generic_file_* routines.
Final available interfaces:
generic_file_aio_read() - read handler
generic_file_aio_write() - write handler
generic_file_aio_write_nolock() - no lock write handler
__generic_file_aio_write_nolock() - internal worker routine
Signed-off-by: Badari Pulavarty <pbadari@us.ibm.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/udf/file.c')
-rw-r--r-- | fs/udf/file.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/fs/udf/file.c b/fs/udf/file.c index a59e5f33daf6..7aedd552cba1 100644 --- a/fs/udf/file.c +++ b/fs/udf/file.c | |||
@@ -103,19 +103,21 @@ const struct address_space_operations udf_adinicb_aops = { | |||
103 | .commit_write = udf_adinicb_commit_write, | 103 | .commit_write = udf_adinicb_commit_write, |
104 | }; | 104 | }; |
105 | 105 | ||
106 | static ssize_t udf_file_write(struct file * file, const char __user * buf, | 106 | static ssize_t udf_file_aio_write(struct kiocb *iocb, const struct iovec *iov, |
107 | size_t count, loff_t *ppos) | 107 | unsigned long nr_segs, loff_t ppos) |
108 | { | 108 | { |
109 | ssize_t retval; | 109 | ssize_t retval; |
110 | struct file *file = iocb->ki_filp; | ||
110 | struct inode *inode = file->f_dentry->d_inode; | 111 | struct inode *inode = file->f_dentry->d_inode; |
111 | int err, pos; | 112 | int err, pos; |
113 | size_t count = iocb->ki_left; | ||
112 | 114 | ||
113 | if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_IN_ICB) | 115 | if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_IN_ICB) |
114 | { | 116 | { |
115 | if (file->f_flags & O_APPEND) | 117 | if (file->f_flags & O_APPEND) |
116 | pos = inode->i_size; | 118 | pos = inode->i_size; |
117 | else | 119 | else |
118 | pos = *ppos; | 120 | pos = ppos; |
119 | 121 | ||
120 | if (inode->i_sb->s_blocksize < (udf_file_entry_alloc_offset(inode) + | 122 | if (inode->i_sb->s_blocksize < (udf_file_entry_alloc_offset(inode) + |
121 | pos + count)) | 123 | pos + count)) |
@@ -136,7 +138,7 @@ static ssize_t udf_file_write(struct file * file, const char __user * buf, | |||
136 | } | 138 | } |
137 | } | 139 | } |
138 | 140 | ||
139 | retval = generic_file_write(file, buf, count, ppos); | 141 | retval = generic_file_aio_write(iocb, iov, nr_segs, ppos); |
140 | 142 | ||
141 | if (retval > 0) | 143 | if (retval > 0) |
142 | mark_inode_dirty(inode); | 144 | mark_inode_dirty(inode); |
@@ -249,11 +251,13 @@ static int udf_release_file(struct inode * inode, struct file * filp) | |||
249 | } | 251 | } |
250 | 252 | ||
251 | const struct file_operations udf_file_operations = { | 253 | const struct file_operations udf_file_operations = { |
252 | .read = generic_file_read, | 254 | .read = do_sync_read, |
255 | .aio_read = generic_file_aio_read, | ||
253 | .ioctl = udf_ioctl, | 256 | .ioctl = udf_ioctl, |
254 | .open = generic_file_open, | 257 | .open = generic_file_open, |
255 | .mmap = generic_file_mmap, | 258 | .mmap = generic_file_mmap, |
256 | .write = udf_file_write, | 259 | .write = do_sync_write, |
260 | .aio_write = udf_file_aio_write, | ||
257 | .release = udf_release_file, | 261 | .release = udf_release_file, |
258 | .fsync = udf_fsync_file, | 262 | .fsync = udf_fsync_file, |
259 | .sendfile = generic_file_sendfile, | 263 | .sendfile = generic_file_sendfile, |