direct.c (619d30b4b8c488042b4a720ca79dccc346d1a516) direct.c (a6cbcd4a4a85e2fdb0b3344b88df2e8b3d526b9e)
1/*
2 * linux/fs/nfs/direct.c
3 *
4 * Copyright (C) 2003 by Chuck Lever <cel@netapp.com>
5 *
6 * High-performance uncached I/O for the Linux NFS client
7 *
8 * There are important applications whose performance or correctness

--- 472 unchanged lines hidden (view full) ---

481 loff_t pos, bool uio)
482{
483 struct file *file = iocb->ki_filp;
484 struct address_space *mapping = file->f_mapping;
485 struct inode *inode = mapping->host;
486 struct nfs_direct_req *dreq;
487 struct nfs_lock_context *l_ctx;
488 ssize_t result = -EINVAL;
1/*
2 * linux/fs/nfs/direct.c
3 *
4 * Copyright (C) 2003 by Chuck Lever <cel@netapp.com>
5 *
6 * High-performance uncached I/O for the Linux NFS client
7 *
8 * There are important applications whose performance or correctness

--- 472 unchanged lines hidden (view full) ---

481 loff_t pos, bool uio)
482{
483 struct file *file = iocb->ki_filp;
484 struct address_space *mapping = file->f_mapping;
485 struct inode *inode = mapping->host;
486 struct nfs_direct_req *dreq;
487 struct nfs_lock_context *l_ctx;
488 ssize_t result = -EINVAL;
489 size_t count;
490
491 count = iov_length(iter->iov, iter->nr_segs);
489 size_t count = iov_iter_count(iter);
492 nfs_add_stats(mapping->host, NFSIOS_DIRECTREADBYTES, count);
493
494 dfprintk(FILE, "NFS: direct read(%pD2, %zd@%Ld)\n",
495 file, count, (long long) pos);
496
497 result = 0;
498 if (!count)
499 goto out;

--- 372 unchanged lines hidden (view full) ---

872 unsigned long seg;
873
874 NFS_PROTO(inode)->write_pageio_init(&desc, inode, FLUSH_COND_STABLE,
875 &nfs_direct_write_completion_ops);
876 desc.pg_dreq = dreq;
877 get_dreq(dreq);
878 atomic_inc(&inode->i_dio_count);
879
490 nfs_add_stats(mapping->host, NFSIOS_DIRECTREADBYTES, count);
491
492 dfprintk(FILE, "NFS: direct read(%pD2, %zd@%Ld)\n",
493 file, count, (long long) pos);
494
495 result = 0;
496 if (!count)
497 goto out;

--- 372 unchanged lines hidden (view full) ---

870 unsigned long seg;
871
872 NFS_PROTO(inode)->write_pageio_init(&desc, inode, FLUSH_COND_STABLE,
873 &nfs_direct_write_completion_ops);
874 desc.pg_dreq = dreq;
875 get_dreq(dreq);
876 atomic_inc(&inode->i_dio_count);
877
880 NFS_I(dreq->inode)->write_io += iov_length(iter->iov, iter->nr_segs);
878 NFS_I(dreq->inode)->write_io += iov_iter_count(iter);
881 for (seg = 0; seg < iter->nr_segs; seg++) {
882 const struct iovec *vec = &iter->iov[seg];
883 result = nfs_direct_write_schedule_segment(&desc, vec, pos, uio);
884 if (result < 0)
885 break;
886 requested_bytes += result;
887 if ((size_t)result < vec->iov_len)
888 break;

--- 42 unchanged lines hidden (view full) ---

931{
932 ssize_t result = -EINVAL;
933 struct file *file = iocb->ki_filp;
934 struct address_space *mapping = file->f_mapping;
935 struct inode *inode = mapping->host;
936 struct nfs_direct_req *dreq;
937 struct nfs_lock_context *l_ctx;
938 loff_t end;
879 for (seg = 0; seg < iter->nr_segs; seg++) {
880 const struct iovec *vec = &iter->iov[seg];
881 result = nfs_direct_write_schedule_segment(&desc, vec, pos, uio);
882 if (result < 0)
883 break;
884 requested_bytes += result;
885 if ((size_t)result < vec->iov_len)
886 break;

--- 42 unchanged lines hidden (view full) ---

929{
930 ssize_t result = -EINVAL;
931 struct file *file = iocb->ki_filp;
932 struct address_space *mapping = file->f_mapping;
933 struct inode *inode = mapping->host;
934 struct nfs_direct_req *dreq;
935 struct nfs_lock_context *l_ctx;
936 loff_t end;
939 size_t count;
940
941 count = iov_length(iter->iov, iter->nr_segs);
937 size_t count = iov_iter_count(iter);
942 end = (pos + count - 1) >> PAGE_CACHE_SHIFT;
943
944 nfs_add_stats(mapping->host, NFSIOS_DIRECTWRITTENBYTES, count);
945
946 dfprintk(FILE, "NFS: direct write(%pD2, %zd@%Ld)\n",
947 file, count, (long long) pos);
948
949 result = generic_write_checks(file, &pos, &count, 0);

--- 99 unchanged lines hidden ---
938 end = (pos + count - 1) >> PAGE_CACHE_SHIFT;
939
940 nfs_add_stats(mapping->host, NFSIOS_DIRECTWRITTENBYTES, count);
941
942 dfprintk(FILE, "NFS: direct write(%pD2, %zd@%Ld)\n",
943 file, count, (long long) pos);
944
945 result = generic_write_checks(file, &pos, &count, 0);

--- 99 unchanged lines hidden ---