[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <158861253114.340223.7031203580922376614.stgit@warthog.procyon.org.uk>
Date: Mon, 04 May 2020 18:15:31 +0100
From: David Howells <dhowells@...hat.com>
To: Trond Myklebust <trondmy@...merspace.com>,
Anna Schumaker <anna.schumaker@...app.com>,
Steve French <sfrench@...ba.org>,
Jeff Layton <jlayton@...hat.com>
Cc: dhowells@...hat.com, Matthew Wilcox <willy@...radead.org>,
Alexander Viro <viro@...iv.linux.org.uk>,
linux-afs@...ts.infradead.org, linux-nfs@...r.kernel.org,
linux-cifs@...r.kernel.org, ceph-devel@...r.kernel.org,
v9fs-developer@...ts.sourceforge.net,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [RFC PATCH 53/61] afs: Note the amount transferred in fetch-data
delivery
Note the amount of data transferred in the fscache request op structure in
the delivery/decode routines for the various FetchData operations.
Also, we need to exclude the excess from this value and then we need to use
this in directory read rather than actual_len.
Signed-off-by: David Howells <dhowells@...hat.com>
---
fs/afs/dir.c | 9 ++++-----
fs/afs/fsclient.c | 5 +++++
fs/afs/yfsclient.c | 5 +++++
3 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/fs/afs/dir.c b/fs/afs/dir.c
index 0b3f33269fdd..577c975c13b0 100644
--- a/fs/afs/dir.c
+++ b/fs/afs/dir.c
@@ -211,9 +211,8 @@ static void afs_dir_dump(struct afs_vnode *dvnode, struct afs_read *req)
pr_warn("DIR %llx:%llx f=%llx l=%llx al=%llx\n",
dvnode->fid.vid, dvnode->fid.vnode,
req->file_size, req->cache.len, req->actual_len);
- pr_warn("DIR %llx %x %zx %zx\n",
- req->cache.pos, req->cache.nr_pages,
- req->iter->iov_offset, iov_iter_count(req->iter));
+ pr_warn("DIR %llx %x %llx\n",
+ req->cache.pos, req->cache.nr_pages, req->cache.transferred);
xas_for_each(&xas, page, last) {
if (xas_retry(&xas, page))
@@ -323,7 +322,7 @@ static struct afs_read *afs_read_dir(struct afs_vnode *dvnode, struct key *key)
nr_pages = (i_size + PAGE_SIZE - 1) / PAGE_SIZE;
- req->actual_len = i_size; /* May change */
+ req->cache.transferred = i_size; /* May change */
req->cache.len = nr_pages * PAGE_SIZE; /* We can ask for more than there is */
req->data_version = dvnode->status.data_version; /* May change */
iov_iter_mapping(&req->def_iter, READ, dvnode->vfs_inode.i_mapping,
@@ -548,7 +547,7 @@ static int afs_dir_iterate(struct inode *dir, struct dir_context *ctx,
/* walk through the blocks in sequence */
ret = 0;
- while (ctx->pos < req->actual_len) {
+ while (ctx->pos < req->cache.transferred) {
blkoff = ctx->pos & ~(sizeof(union afs_xdr_dir_block) - 1);
/* Fetch the appropriate page from the directory and re-add it
diff --git a/fs/afs/fsclient.c b/fs/afs/fsclient.c
index c9789294fc68..62cc8072874b 100644
--- a/fs/afs/fsclient.c
+++ b/fs/afs/fsclient.c
@@ -417,6 +417,11 @@ static int afs_deliver_fs_fetch_data(struct afs_call *call)
break;
}
+ /* Pass the call's ref on the read request descriptor to the completion
+ * handler.
+ */
+ req->cache.transferred = min(req->actual_len, req->cache.len);
+ set_bit(FSCACHE_IO_DATA_FROM_SERVER, &req->cache.flags);
if (req->cache.io_done)
req->cache.io_done(&req->cache);
diff --git a/fs/afs/yfsclient.c b/fs/afs/yfsclient.c
index 6ea97233c0d2..fb3f006be31c 100644
--- a/fs/afs/yfsclient.c
+++ b/fs/afs/yfsclient.c
@@ -531,6 +531,11 @@ static int yfs_deliver_fs_fetch_data64(struct afs_call *call)
break;
}
+ /* Pass the call's ref on the read request descriptor to the completion
+ * handler.
+ */
+ req->cache.transferred = min(req->actual_len, req->cache.len);
+ set_bit(FSCACHE_IO_DATA_FROM_SERVER, &req->cache.flags);
if (req->cache.io_done)
req->cache.io_done(&req->cache);
Powered by blists - more mailing lists