diff options
author | Peng Tao <bergwolf@gmail.com> | 2012-09-25 02:55:57 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-10-08 19:31:55 -0400 |
commit | 35754bc00e94e598c432ad02f7a3d3063c4402e3 (patch) | |
tree | f950c3108074aae7b14a4354ed9af370047f0460 /fs/nfs | |
parent | 19c54abab79404c027ff61f13468e78a3e2a0065 (diff) |
NFS: track direct IO left bytes
Signed-off-by: Peng Tao <tao.peng@emc.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r-- | fs/nfs/direct.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c index 253d397780b1..4be8673ee18d 100644 --- a/fs/nfs/direct.c +++ b/fs/nfs/direct.c | |||
@@ -78,6 +78,7 @@ struct nfs_direct_req { | |||
78 | atomic_t io_count; /* i/os we're waiting for */ | 78 | atomic_t io_count; /* i/os we're waiting for */ |
79 | spinlock_t lock; /* protect completion state */ | 79 | spinlock_t lock; /* protect completion state */ |
80 | ssize_t count, /* bytes actually processed */ | 80 | ssize_t count, /* bytes actually processed */ |
81 | bytes_left, /* bytes left to be sent */ | ||
81 | error; /* any reported error */ | 82 | error; /* any reported error */ |
82 | struct completion completion; /* wait for i/o completion */ | 83 | struct completion completion; /* wait for i/o completion */ |
83 | 84 | ||
@@ -390,6 +391,7 @@ static ssize_t nfs_direct_read_schedule_segment(struct nfs_pageio_descriptor *de | |||
390 | user_addr += req_len; | 391 | user_addr += req_len; |
391 | pos += req_len; | 392 | pos += req_len; |
392 | count -= req_len; | 393 | count -= req_len; |
394 | dreq->bytes_left -= req_len; | ||
393 | } | 395 | } |
394 | /* The nfs_page now hold references to these pages */ | 396 | /* The nfs_page now hold references to these pages */ |
395 | nfs_direct_release_pages(pagevec, npages); | 397 | nfs_direct_release_pages(pagevec, npages); |
@@ -457,6 +459,7 @@ static ssize_t nfs_direct_read(struct kiocb *iocb, const struct iovec *iov, | |||
457 | goto out; | 459 | goto out; |
458 | 460 | ||
459 | dreq->inode = inode; | 461 | dreq->inode = inode; |
462 | dreq->bytes_left = iov_length(iov, nr_segs); | ||
460 | dreq->ctx = get_nfs_open_context(nfs_file_open_context(iocb->ki_filp)); | 463 | dreq->ctx = get_nfs_open_context(nfs_file_open_context(iocb->ki_filp)); |
461 | l_ctx = nfs_get_lock_context(dreq->ctx); | 464 | l_ctx = nfs_get_lock_context(dreq->ctx); |
462 | if (IS_ERR(l_ctx)) { | 465 | if (IS_ERR(l_ctx)) { |
@@ -710,6 +713,7 @@ static ssize_t nfs_direct_write_schedule_segment(struct nfs_pageio_descriptor *d | |||
710 | user_addr += req_len; | 713 | user_addr += req_len; |
711 | pos += req_len; | 714 | pos += req_len; |
712 | count -= req_len; | 715 | count -= req_len; |
716 | dreq->bytes_left -= req_len; | ||
713 | } | 717 | } |
714 | /* The nfs_page now hold references to these pages */ | 718 | /* The nfs_page now hold references to these pages */ |
715 | nfs_direct_release_pages(pagevec, npages); | 719 | nfs_direct_release_pages(pagevec, npages); |
@@ -860,6 +864,7 @@ static ssize_t nfs_direct_write(struct kiocb *iocb, const struct iovec *iov, | |||
860 | goto out; | 864 | goto out; |
861 | 865 | ||
862 | dreq->inode = inode; | 866 | dreq->inode = inode; |
867 | dreq->bytes_left = count; | ||
863 | dreq->ctx = get_nfs_open_context(nfs_file_open_context(iocb->ki_filp)); | 868 | dreq->ctx = get_nfs_open_context(nfs_file_open_context(iocb->ki_filp)); |
864 | l_ctx = nfs_get_lock_context(dreq->ctx); | 869 | l_ctx = nfs_get_lock_context(dreq->ctx); |
865 | if (IS_ERR(l_ctx)) { | 870 | if (IS_ERR(l_ctx)) { |