Skip to content

Commit

Permalink
9p: Fix read/write debug statements to report server reply
Browse files Browse the repository at this point in the history
[ Upstream commit be3193e ]

Previous conversion to iov missed these debug statements which would now
always print the requested size instead of the actual server reply.

Write also added a loop in a much older commit but we didn't report
these, while reads do report each iteration -- it's more coherent to
keep reporting all requests to server so move that at the same time.

Fixes: 7f02464 ("9p: convert to advancing variant of iov_iter_get_pages_alloc()")
Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
Message-ID: <20240109-9p-rw-trace-v1-1-327178114257@codewreck.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
martinetd authored and gregkh committed Apr 10, 2024
1 parent f4a192c commit 40613ea
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions net/9p/client.c
Expand Up @@ -1583,7 +1583,7 @@ p9_client_read_once(struct p9_fid *fid, u64 offset, struct iov_iter *to,
received = rsize;
}

p9_debug(P9_DEBUG_9P, "<<< RREAD count %d\n", count);
p9_debug(P9_DEBUG_9P, "<<< RREAD count %d\n", received);

if (non_zc) {
int n = copy_to_iter(dataptr, received, to);
Expand All @@ -1609,9 +1609,6 @@ p9_client_write(struct p9_fid *fid, u64 offset, struct iov_iter *from, int *err)
int total = 0;
*err = 0;

p9_debug(P9_DEBUG_9P, ">>> TWRITE fid %d offset %llu count %zd\n",
fid->fid, offset, iov_iter_count(from));

while (iov_iter_count(from)) {
int count = iov_iter_count(from);
int rsize = fid->iounit;
Expand All @@ -1623,6 +1620,9 @@ p9_client_write(struct p9_fid *fid, u64 offset, struct iov_iter *from, int *err)
if (count < rsize)
rsize = count;

p9_debug(P9_DEBUG_9P, ">>> TWRITE fid %d offset %llu count %d (/%d)\n",
fid->fid, offset, rsize, count);

/* Don't bother zerocopy for small IO (< 1024) */
if (clnt->trans_mod->zc_request && rsize > 1024) {
req = p9_client_zc_rpc(clnt, P9_TWRITE, NULL, from, 0,
Expand Down Expand Up @@ -1650,7 +1650,7 @@ p9_client_write(struct p9_fid *fid, u64 offset, struct iov_iter *from, int *err)
written = rsize;
}

p9_debug(P9_DEBUG_9P, "<<< RWRITE count %d\n", count);
p9_debug(P9_DEBUG_9P, "<<< RWRITE count %d\n", written);

p9_req_put(clnt, req);
iov_iter_revert(from, count - written - iov_iter_count(from));
Expand Down

0 comments on commit 40613ea

Please sign in to comment.