diff options
Diffstat (limited to 'fs/cifs/cifsfs.c')
-rw-r--r-- | fs/cifs/cifsfs.c | 107 |
1 files changed, 60 insertions, 47 deletions
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 682b0235ad9a..51548ed2e9cc 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c | |||
@@ -483,57 +483,30 @@ cifs_get_sb(struct file_system_type *fs_type, | |||
483 | return sb; | 483 | return sb; |
484 | } | 484 | } |
485 | 485 | ||
486 | static ssize_t | 486 | static ssize_t cifs_file_writev(struct file *file, const struct iovec *iov, |
487 | cifs_read_wrapper(struct file * file, char __user *read_data, size_t read_size, | 487 | unsigned long nr_segs, loff_t *ppos) |
488 | loff_t * poffset) | ||
489 | { | 488 | { |
490 | if(file->f_dentry == NULL) | 489 | struct inode *inode = file->f_dentry->d_inode; |
491 | return -EIO; | 490 | ssize_t written; |
492 | else if(file->f_dentry->d_inode == NULL) | ||
493 | return -EIO; | ||
494 | |||
495 | cFYI(1,("In read_wrapper size %zd at %lld",read_size,*poffset)); | ||
496 | 491 | ||
497 | if(CIFS_I(file->f_dentry->d_inode)->clientCanCacheRead) { | 492 | written = generic_file_writev(file, iov, nr_segs, ppos); |
498 | return generic_file_read(file,read_data,read_size,poffset); | 493 | if (!CIFS_I(inode)->clientCanCacheAll) |
499 | } else { | 494 | filemap_fdatawrite(inode->i_mapping); |
500 | /* BB do we need to lock inode from here until after invalidate? */ | 495 | return written; |
501 | /* if(file->f_dentry->d_inode->i_mapping) { | ||
502 | filemap_fdatawrite(file->f_dentry->d_inode->i_mapping); | ||
503 | filemap_fdatawait(file->f_dentry->d_inode->i_mapping); | ||
504 | }*/ | ||
505 | /* cifs_revalidate(file->f_dentry);*/ /* BB fixme */ | ||
506 | |||
507 | /* BB we should make timer configurable - perhaps | ||
508 | by simply calling cifs_revalidate here */ | ||
509 | /* invalidate_remote_inode(file->f_dentry->d_inode);*/ | ||
510 | return generic_file_read(file,read_data,read_size,poffset); | ||
511 | } | ||
512 | } | 496 | } |
513 | 497 | ||
514 | static ssize_t | 498 | static ssize_t cifs_file_aio_write(struct kiocb *iocb, const char __user *buf, |
515 | cifs_write_wrapper(struct file * file, const char __user *write_data, | 499 | size_t count, loff_t pos) |
516 | size_t write_size, loff_t * poffset) | ||
517 | { | 500 | { |
501 | struct inode *inode = iocb->ki_filp->f_dentry->d_inode; | ||
518 | ssize_t written; | 502 | ssize_t written; |
519 | 503 | ||
520 | if(file->f_dentry == NULL) | 504 | written = generic_file_aio_write(iocb, buf, count, pos); |
521 | return -EIO; | 505 | if (!CIFS_I(inode)->clientCanCacheAll) |
522 | else if(file->f_dentry->d_inode == NULL) | 506 | filemap_fdatawrite(inode->i_mapping); |
523 | return -EIO; | ||
524 | |||
525 | cFYI(1,("In write_wrapper size %zd at %lld",write_size,*poffset)); | ||
526 | |||
527 | written = generic_file_write(file,write_data,write_size,poffset); | ||
528 | if(!CIFS_I(file->f_dentry->d_inode)->clientCanCacheAll) { | ||
529 | if(file->f_dentry->d_inode->i_mapping) { | ||
530 | filemap_fdatawrite(file->f_dentry->d_inode->i_mapping); | ||
531 | } | ||
532 | } | ||
533 | return written; | 507 | return written; |
534 | } | 508 | } |
535 | 509 | ||
536 | |||
537 | static struct file_system_type cifs_fs_type = { | 510 | static struct file_system_type cifs_fs_type = { |
538 | .owner = THIS_MODULE, | 511 | .owner = THIS_MODULE, |
539 | .name = "cifs", | 512 | .name = "cifs", |
@@ -594,8 +567,12 @@ struct inode_operations cifs_symlink_inode_ops = { | |||
594 | }; | 567 | }; |
595 | 568 | ||
596 | struct file_operations cifs_file_ops = { | 569 | struct file_operations cifs_file_ops = { |
597 | .read = cifs_read_wrapper, | 570 | .read = do_sync_read, |
598 | .write = cifs_write_wrapper, | 571 | .write = do_sync_write, |
572 | .readv = generic_file_readv, | ||
573 | .writev = cifs_file_writev, | ||
574 | .aio_read = generic_file_aio_read, | ||
575 | .aio_write = cifs_file_aio_write, | ||
599 | .open = cifs_open, | 576 | .open = cifs_open, |
600 | .release = cifs_close, | 577 | .release = cifs_close, |
601 | .lock = cifs_lock, | 578 | .lock = cifs_lock, |
@@ -608,10 +585,6 @@ struct file_operations cifs_file_ops = { | |||
608 | #endif /* CONFIG_CIFS_POSIX */ | 585 | #endif /* CONFIG_CIFS_POSIX */ |
609 | 586 | ||
610 | #ifdef CONFIG_CIFS_EXPERIMENTAL | 587 | #ifdef CONFIG_CIFS_EXPERIMENTAL |
611 | .readv = generic_file_readv, | ||
612 | .writev = generic_file_writev, | ||
613 | .aio_read = generic_file_aio_read, | ||
614 | .aio_write = generic_file_aio_write, | ||
615 | .dir_notify = cifs_dir_notify, | 588 | .dir_notify = cifs_dir_notify, |
616 | #endif /* CONFIG_CIFS_EXPERIMENTAL */ | 589 | #endif /* CONFIG_CIFS_EXPERIMENTAL */ |
617 | }; | 590 | }; |
@@ -635,6 +608,46 @@ struct file_operations cifs_file_direct_ops = { | |||
635 | .dir_notify = cifs_dir_notify, | 608 | .dir_notify = cifs_dir_notify, |
636 | #endif /* CONFIG_CIFS_EXPERIMENTAL */ | 609 | #endif /* CONFIG_CIFS_EXPERIMENTAL */ |
637 | }; | 610 | }; |
611 | struct file_operations cifs_file_nobrl_ops = { | ||
612 | .read = do_sync_read, | ||
613 | .write = do_sync_write, | ||
614 | .readv = generic_file_readv, | ||
615 | .writev = cifs_file_writev, | ||
616 | .aio_read = generic_file_aio_read, | ||
617 | .aio_write = cifs_file_aio_write, | ||
618 | .open = cifs_open, | ||
619 | .release = cifs_close, | ||
620 | .fsync = cifs_fsync, | ||
621 | .flush = cifs_flush, | ||
622 | .mmap = cifs_file_mmap, | ||
623 | .sendfile = generic_file_sendfile, | ||
624 | #ifdef CONFIG_CIFS_POSIX | ||
625 | .ioctl = cifs_ioctl, | ||
626 | #endif /* CONFIG_CIFS_POSIX */ | ||
627 | |||
628 | #ifdef CONFIG_CIFS_EXPERIMENTAL | ||
629 | .dir_notify = cifs_dir_notify, | ||
630 | #endif /* CONFIG_CIFS_EXPERIMENTAL */ | ||
631 | }; | ||
632 | |||
633 | struct file_operations cifs_file_direct_nobrl_ops = { | ||
634 | /* no mmap, no aio, no readv - | ||
635 | BB reevaluate whether they can be done with directio, no cache */ | ||
636 | .read = cifs_user_read, | ||
637 | .write = cifs_user_write, | ||
638 | .open = cifs_open, | ||
639 | .release = cifs_close, | ||
640 | .fsync = cifs_fsync, | ||
641 | .flush = cifs_flush, | ||
642 | .sendfile = generic_file_sendfile, /* BB removeme BB */ | ||
643 | #ifdef CONFIG_CIFS_POSIX | ||
644 | .ioctl = cifs_ioctl, | ||
645 | #endif /* CONFIG_CIFS_POSIX */ | ||
646 | |||
647 | #ifdef CONFIG_CIFS_EXPERIMENTAL | ||
648 | .dir_notify = cifs_dir_notify, | ||
649 | #endif /* CONFIG_CIFS_EXPERIMENTAL */ | ||
650 | }; | ||
638 | 651 | ||
639 | struct file_operations cifs_dir_ops = { | 652 | struct file_operations cifs_dir_ops = { |
640 | .readdir = cifs_readdir, | 653 | .readdir = cifs_readdir, |