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/smbfs/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/smbfs/file.c')
-rw-r--r-- | fs/smbfs/file.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/fs/smbfs/file.c b/fs/smbfs/file.c index dae67048baba..50784d13c87b 100644 --- a/fs/smbfs/file.c +++ b/fs/smbfs/file.c | |||
@@ -214,13 +214,15 @@ smb_updatepage(struct file *file, struct page *page, unsigned long offset, | |||
214 | } | 214 | } |
215 | 215 | ||
216 | static ssize_t | 216 | static ssize_t |
217 | smb_file_read(struct file * file, char __user * buf, size_t count, loff_t *ppos) | 217 | smb_file_aio_read(struct kiocb *iocb, const struct iovec *iov, |
218 | unsigned long nr_segs, loff_t pos) | ||
218 | { | 219 | { |
220 | struct file * file = iocb->ki_filp; | ||
219 | struct dentry * dentry = file->f_dentry; | 221 | struct dentry * dentry = file->f_dentry; |
220 | ssize_t status; | 222 | ssize_t status; |
221 | 223 | ||
222 | VERBOSE("file %s/%s, count=%lu@%lu\n", DENTRY_PATH(dentry), | 224 | VERBOSE("file %s/%s, count=%lu@%lu\n", DENTRY_PATH(dentry), |
223 | (unsigned long) count, (unsigned long) *ppos); | 225 | (unsigned long) iocb->ki_left, (unsigned long) pos); |
224 | 226 | ||
225 | status = smb_revalidate_inode(dentry); | 227 | status = smb_revalidate_inode(dentry); |
226 | if (status) { | 228 | if (status) { |
@@ -233,7 +235,7 @@ smb_file_read(struct file * file, char __user * buf, size_t count, loff_t *ppos) | |||
233 | (long)dentry->d_inode->i_size, | 235 | (long)dentry->d_inode->i_size, |
234 | dentry->d_inode->i_flags, dentry->d_inode->i_atime); | 236 | dentry->d_inode->i_flags, dentry->d_inode->i_atime); |
235 | 237 | ||
236 | status = generic_file_read(file, buf, count, ppos); | 238 | status = generic_file_aio_read(iocb, iov, nr_segs, pos); |
237 | out: | 239 | out: |
238 | return status; | 240 | return status; |
239 | } | 241 | } |
@@ -317,14 +319,16 @@ const struct address_space_operations smb_file_aops = { | |||
317 | * Write to a file (through the page cache). | 319 | * Write to a file (through the page cache). |
318 | */ | 320 | */ |
319 | static ssize_t | 321 | static ssize_t |
320 | smb_file_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) | 322 | smb_file_aio_write(struct kiocb *iocb, const struct iovec *iov, |
323 | unsigned long nr_segs, loff_t pos) | ||
321 | { | 324 | { |
325 | struct file * file = iocb->ki_filp; | ||
322 | struct dentry * dentry = file->f_dentry; | 326 | struct dentry * dentry = file->f_dentry; |
323 | ssize_t result; | 327 | ssize_t result; |
324 | 328 | ||
325 | VERBOSE("file %s/%s, count=%lu@%lu\n", | 329 | VERBOSE("file %s/%s, count=%lu@%lu\n", |
326 | DENTRY_PATH(dentry), | 330 | DENTRY_PATH(dentry), |
327 | (unsigned long) count, (unsigned long) *ppos); | 331 | (unsigned long) iocb->ki_left, (unsigned long) pos); |
328 | 332 | ||
329 | result = smb_revalidate_inode(dentry); | 333 | result = smb_revalidate_inode(dentry); |
330 | if (result) { | 334 | if (result) { |
@@ -337,8 +341,8 @@ smb_file_write(struct file *file, const char __user *buf, size_t count, loff_t * | |||
337 | if (result) | 341 | if (result) |
338 | goto out; | 342 | goto out; |
339 | 343 | ||
340 | if (count > 0) { | 344 | if (iocb->ki_left > 0) { |
341 | result = generic_file_write(file, buf, count, ppos); | 345 | result = generic_file_aio_write(iocb, iov, nr_segs, pos); |
342 | VERBOSE("pos=%ld, size=%ld, mtime=%ld, atime=%ld\n", | 346 | VERBOSE("pos=%ld, size=%ld, mtime=%ld, atime=%ld\n", |
343 | (long) file->f_pos, (long) dentry->d_inode->i_size, | 347 | (long) file->f_pos, (long) dentry->d_inode->i_size, |
344 | dentry->d_inode->i_mtime, dentry->d_inode->i_atime); | 348 | dentry->d_inode->i_mtime, dentry->d_inode->i_atime); |
@@ -402,8 +406,10 @@ smb_file_permission(struct inode *inode, int mask, struct nameidata *nd) | |||
402 | const struct file_operations smb_file_operations = | 406 | const struct file_operations smb_file_operations = |
403 | { | 407 | { |
404 | .llseek = remote_llseek, | 408 | .llseek = remote_llseek, |
405 | .read = smb_file_read, | 409 | .read = do_sync_read, |
406 | .write = smb_file_write, | 410 | .aio_read = smb_file_aio_read, |
411 | .write = do_sync_write, | ||
412 | .aio_write = smb_file_aio_write, | ||
407 | .ioctl = smb_ioctl, | 413 | .ioctl = smb_ioctl, |
408 | .mmap = smb_file_mmap, | 414 | .mmap = smb_file_mmap, |
409 | .open = smb_file_open, | 415 | .open = smb_file_open, |