aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/cifsfs.c
diff options
context:
space:
mode:
authorSteve French <sfrench@us.ibm.com>2005-11-17 20:03:00 -0500
committerSteve French <sfrench@us.ibm.com>2005-11-17 20:03:00 -0500
commit87c89dd7330735d70cc9912483f6f4c7bc3ff19c (patch)
tree4c41a67499a0f2c06cc4da3a8fd419f7548c63b6 /fs/cifs/cifsfs.c
parent9e294f1c4d4a5fc0068fcb21f5809ff6e88e49bc (diff)
[CIFS] Vectored and async i/o turned on and correct the
writev and aio_write to flush properly. This is Christoph's patch merged with the new nobrl file operations Signed-off-by: Dave Kleikamp <shaggy@austin.ibm.com> From: Christoph Hellwig <hch@lst.de> - support vectored and async aio ops unconditionally - this is above the pagecache and transparent to the fs - remove cifs_read_wrapper. it was only doing silly checks and calling generic_file_write in all cases. - use do_sync_read/do_sync_write as read/write operations. They call ->readv/->writev which we now always implemente. - add the filemap_fdatawrite calls to writev/aio_write which were missing previously compared to plain write. no idea what the point behind them is, but let's be consistent at least.. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Steven French <sfrench@us.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org>
Diffstat (limited to 'fs/cifs/cifsfs.c')
-rw-r--r--fs/cifs/cifsfs.c117
1 files changed, 45 insertions, 72 deletions
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index 1433455c61ea..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
486static ssize_t 486static ssize_t cifs_file_writev(struct file *file, const struct iovec *iov,
487cifs_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
514static ssize_t 498static ssize_t cifs_file_aio_write(struct kiocb *iocb, const char __user *buf,
515cifs_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
537static struct file_system_type cifs_fs_type = { 510static 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
596struct file_operations cifs_file_ops = { 569struct 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};
@@ -636,43 +609,43 @@ struct file_operations cifs_file_direct_ops = {
636#endif /* CONFIG_CIFS_EXPERIMENTAL */ 609#endif /* CONFIG_CIFS_EXPERIMENTAL */
637}; 610};
638struct file_operations cifs_file_nobrl_ops = { 611struct file_operations cifs_file_nobrl_ops = {
639 .read = cifs_read_wrapper, 612 .read = do_sync_read,
640 .write = cifs_write_wrapper, 613 .write = do_sync_write,
641 .open = cifs_open, 614 .readv = generic_file_readv,
642 .release = cifs_close, 615 .writev = cifs_file_writev,
643 .fsync = cifs_fsync, 616 .aio_read = generic_file_aio_read,
644 .flush = cifs_flush, 617 .aio_write = cifs_file_aio_write,
645 .mmap = cifs_file_mmap, 618 .open = cifs_open,
646 .sendfile = generic_file_sendfile, 619 .release = cifs_close,
620 .fsync = cifs_fsync,
621 .flush = cifs_flush,
622 .mmap = cifs_file_mmap,
623 .sendfile = generic_file_sendfile,
647#ifdef CONFIG_CIFS_POSIX 624#ifdef CONFIG_CIFS_POSIX
648 .ioctl = cifs_ioctl, 625 .ioctl = cifs_ioctl,
649#endif /* CONFIG_CIFS_POSIX */ 626#endif /* CONFIG_CIFS_POSIX */
650 627
651#ifdef CONFIG_CIFS_EXPERIMENTAL 628#ifdef CONFIG_CIFS_EXPERIMENTAL
652 .readv = generic_file_readv, 629 .dir_notify = cifs_dir_notify,
653 .writev = generic_file_writev,
654 .aio_read = generic_file_aio_read,
655 .aio_write = generic_file_aio_write,
656 .dir_notify = cifs_dir_notify,
657#endif /* CONFIG_CIFS_EXPERIMENTAL */ 630#endif /* CONFIG_CIFS_EXPERIMENTAL */
658}; 631};
659 632
660struct file_operations cifs_file_direct_nobrl_ops = { 633struct file_operations cifs_file_direct_nobrl_ops = {
661 /* no mmap, no aio, no readv - 634 /* no mmap, no aio, no readv -
662 BB reevaluate whether they can be done with directio, no cache */ 635 BB reevaluate whether they can be done with directio, no cache */
663 .read = cifs_user_read, 636 .read = cifs_user_read,
664 .write = cifs_user_write, 637 .write = cifs_user_write,
665 .open = cifs_open, 638 .open = cifs_open,
666 .release = cifs_close, 639 .release = cifs_close,
667 .fsync = cifs_fsync, 640 .fsync = cifs_fsync,
668 .flush = cifs_flush, 641 .flush = cifs_flush,
669 .sendfile = generic_file_sendfile, /* BB removeme BB */ 642 .sendfile = generic_file_sendfile, /* BB removeme BB */
670#ifdef CONFIG_CIFS_POSIX 643#ifdef CONFIG_CIFS_POSIX
671 .ioctl = cifs_ioctl, 644 .ioctl = cifs_ioctl,
672#endif /* CONFIG_CIFS_POSIX */ 645#endif /* CONFIG_CIFS_POSIX */
673 646
674#ifdef CONFIG_CIFS_EXPERIMENTAL 647#ifdef CONFIG_CIFS_EXPERIMENTAL
675 .dir_notify = cifs_dir_notify, 648 .dir_notify = cifs_dir_notify,
676#endif /* CONFIG_CIFS_EXPERIMENTAL */ 649#endif /* CONFIG_CIFS_EXPERIMENTAL */
677}; 650};
678 651