diff options
author | Weston Andros Adamson <dros@primarydata.com> | 2016-04-01 11:42:29 -0400 |
---|---|---|
committer | Anna Schumaker <Anna.Schumaker@Netapp.com> | 2016-05-09 09:05:40 -0400 |
commit | ed3743a6d4f309f5278c87a69e3125382b78455c (patch) | |
tree | a055a589e5059ad9dda70690602b95c77356525b /fs/nfs/direct.c | |
parent | 1b1bc66bb4ebd737fb750b0e1afc753098f4a1b2 (diff) |
nfs: add debug to directio "good_bytes" counting
This will pop a warning if we count too many good bytes.
Signed-off-by: Weston Andros Adamson <dros@primarydata.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Diffstat (limited to 'fs/nfs/direct.c')
-rw-r--r-- | fs/nfs/direct.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c index c93826e4a8c6..f79d98ae4c10 100644 --- a/fs/nfs/direct.c +++ b/fs/nfs/direct.c | |||
@@ -87,6 +87,7 @@ struct nfs_direct_req { | |||
87 | int mirror_count; | 87 | int mirror_count; |
88 | 88 | ||
89 | ssize_t count, /* bytes actually processed */ | 89 | ssize_t count, /* bytes actually processed */ |
90 | max_count, /* max expected count */ | ||
90 | bytes_left, /* bytes left to be sent */ | 91 | bytes_left, /* bytes left to be sent */ |
91 | io_start, /* start of IO */ | 92 | io_start, /* start of IO */ |
92 | error; /* any reported error */ | 93 | error; /* any reported error */ |
@@ -123,6 +124,8 @@ nfs_direct_good_bytes(struct nfs_direct_req *dreq, struct nfs_pgio_header *hdr) | |||
123 | int i; | 124 | int i; |
124 | ssize_t count; | 125 | ssize_t count; |
125 | 126 | ||
127 | WARN_ON_ONCE(dreq->count >= dreq->max_count); | ||
128 | |||
126 | if (dreq->mirror_count == 1) { | 129 | if (dreq->mirror_count == 1) { |
127 | dreq->mirrors[hdr->pgio_mirror_idx].count += hdr->good_bytes; | 130 | dreq->mirrors[hdr->pgio_mirror_idx].count += hdr->good_bytes; |
128 | dreq->count += hdr->good_bytes; | 131 | dreq->count += hdr->good_bytes; |
@@ -593,7 +596,7 @@ ssize_t nfs_file_direct_read(struct kiocb *iocb, struct iov_iter *iter, | |||
593 | goto out_unlock; | 596 | goto out_unlock; |
594 | 597 | ||
595 | dreq->inode = inode; | 598 | dreq->inode = inode; |
596 | dreq->bytes_left = count; | 599 | dreq->bytes_left = dreq->max_count = count; |
597 | dreq->io_start = pos; | 600 | dreq->io_start = pos; |
598 | dreq->ctx = get_nfs_open_context(nfs_file_open_context(iocb->ki_filp)); | 601 | dreq->ctx = get_nfs_open_context(nfs_file_open_context(iocb->ki_filp)); |
599 | l_ctx = nfs_get_lock_context(dreq->ctx); | 602 | l_ctx = nfs_get_lock_context(dreq->ctx); |
@@ -1026,7 +1029,7 @@ ssize_t nfs_file_direct_write(struct kiocb *iocb, struct iov_iter *iter) | |||
1026 | goto out_unlock; | 1029 | goto out_unlock; |
1027 | 1030 | ||
1028 | dreq->inode = inode; | 1031 | dreq->inode = inode; |
1029 | dreq->bytes_left = iov_iter_count(iter); | 1032 | dreq->bytes_left = dreq->max_count = iov_iter_count(iter); |
1030 | dreq->io_start = pos; | 1033 | dreq->io_start = pos; |
1031 | dreq->ctx = get_nfs_open_context(nfs_file_open_context(iocb->ki_filp)); | 1034 | dreq->ctx = get_nfs_open_context(nfs_file_open_context(iocb->ki_filp)); |
1032 | l_ctx = nfs_get_lock_context(dreq->ctx); | 1035 | l_ctx = nfs_get_lock_context(dreq->ctx); |