aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorPeng Tao <bergwolf@gmail.com>2012-08-23 12:27:48 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-10-01 18:37:34 -0400
commit7acdb026818455638543b04b68d4a580c367fba8 (patch)
treea765a5fe13553aad3fc1aeb8c4e8685242654bde /fs
parent6f2ea7f2a3ff3cd342bface43f8b4bf5e431cf36 (diff)
NFSv41: fix DIO write_io calculation
pnfs_within_mdsthreshold() is called inside pg_init. We need to set read_io/write_io before that. Otherwise we fail pnfs_within_mdsthreshold() and IO goes to MDS. A simple test case: dd if=foo of=/mnt/pnfs/bar bs=10M count=1 oflag=direct Signed-off-by: Peng Tao <tao.peng@emc.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfs/direct.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
index 22130df1621..253d397780b 100644
--- a/fs/nfs/direct.c
+++ b/fs/nfs/direct.c
@@ -467,10 +467,10 @@ static ssize_t nfs_direct_read(struct kiocb *iocb, const struct iovec *iov,
467 if (!is_sync_kiocb(iocb)) 467 if (!is_sync_kiocb(iocb))
468 dreq->iocb = iocb; 468 dreq->iocb = iocb;
469 469
470 NFS_I(inode)->read_io += iov_length(iov, nr_segs);
470 result = nfs_direct_read_schedule_iovec(dreq, iov, nr_segs, pos, uio); 471 result = nfs_direct_read_schedule_iovec(dreq, iov, nr_segs, pos, uio);
471 if (!result) 472 if (!result)
472 result = nfs_direct_wait(dreq); 473 result = nfs_direct_wait(dreq);
473 NFS_I(inode)->read_io += result;
474out_release: 474out_release:
475 nfs_direct_req_release(dreq); 475 nfs_direct_req_release(dreq);
476out: 476out:
@@ -818,6 +818,7 @@ static ssize_t nfs_direct_write_schedule_iovec(struct nfs_direct_req *dreq,
818 get_dreq(dreq); 818 get_dreq(dreq);
819 atomic_inc(&inode->i_dio_count); 819 atomic_inc(&inode->i_dio_count);
820 820
821 NFS_I(dreq->inode)->write_io += iov_length(iov, nr_segs);
821 for (seg = 0; seg < nr_segs; seg++) { 822 for (seg = 0; seg < nr_segs; seg++) {
822 const struct iovec *vec = &iov[seg]; 823 const struct iovec *vec = &iov[seg];
823 result = nfs_direct_write_schedule_segment(&desc, vec, pos, uio); 824 result = nfs_direct_write_schedule_segment(&desc, vec, pos, uio);
@@ -829,7 +830,6 @@ static ssize_t nfs_direct_write_schedule_iovec(struct nfs_direct_req *dreq,
829 pos += vec->iov_len; 830 pos += vec->iov_len;
830 } 831 }
831 nfs_pageio_complete(&desc); 832 nfs_pageio_complete(&desc);
832 NFS_I(dreq->inode)->write_io += desc.pg_bytes_written;
833 833
834 /* 834 /*
835 * If no bytes were started, return the error, and let the 835 * If no bytes were started, return the error, and let the