Commit d73065e6 authored by David Howells's avatar David Howells

afs: Use alternative invalidation to using launder_folio

Use writepages-based flushing invalidation instead of
invalidate_inode_pages2() and ->launder_folio().  This will allow
->launder_folio() to be removed eventually.
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: Jeff Layton <jlayton@kernel.org>
cc: linux-afs@lists.infradead.org
cc: netfs@lists.linux.dev
cc: linux-fsdevel@vger.kernel.org
parent 40fb4828
...@@ -54,7 +54,6 @@ const struct address_space_operations afs_file_aops = { ...@@ -54,7 +54,6 @@ const struct address_space_operations afs_file_aops = {
.read_folio = netfs_read_folio, .read_folio = netfs_read_folio,
.readahead = netfs_readahead, .readahead = netfs_readahead,
.dirty_folio = netfs_dirty_folio, .dirty_folio = netfs_dirty_folio,
.launder_folio = netfs_launder_folio,
.release_folio = netfs_release_folio, .release_folio = netfs_release_folio,
.invalidate_folio = netfs_invalidate_folio, .invalidate_folio = netfs_invalidate_folio,
.migrate_folio = filemap_migrate_folio, .migrate_folio = filemap_migrate_folio,
......
...@@ -916,7 +916,6 @@ struct afs_operation { ...@@ -916,7 +916,6 @@ struct afs_operation {
loff_t pos; loff_t pos;
loff_t size; loff_t size;
loff_t i_size; loff_t i_size;
bool laundering; /* Laundering page, PG_writeback not set */
} store; } store;
struct { struct {
struct iattr *attr; struct iattr *attr;
......
...@@ -365,9 +365,9 @@ static void afs_zap_data(struct afs_vnode *vnode) ...@@ -365,9 +365,9 @@ static void afs_zap_data(struct afs_vnode *vnode)
* written back in a regular file and completely discard the pages in a * written back in a regular file and completely discard the pages in a
* directory or symlink */ * directory or symlink */
if (S_ISREG(vnode->netfs.inode.i_mode)) if (S_ISREG(vnode->netfs.inode.i_mode))
invalidate_remote_inode(&vnode->netfs.inode); filemap_invalidate_inode(&vnode->netfs.inode, true, 0, LLONG_MAX);
else else
invalidate_inode_pages2(vnode->netfs.inode.i_mapping); filemap_invalidate_inode(&vnode->netfs.inode, false, 0, LLONG_MAX);
} }
/* /*
......
...@@ -75,8 +75,7 @@ static void afs_store_data_success(struct afs_operation *op) ...@@ -75,8 +75,7 @@ static void afs_store_data_success(struct afs_operation *op)
op->ctime = op->file[0].scb.status.mtime_client; op->ctime = op->file[0].scb.status.mtime_client;
afs_vnode_commit_status(op, &op->file[0]); afs_vnode_commit_status(op, &op->file[0]);
if (!afs_op_error(op)) { if (!afs_op_error(op)) {
if (!op->store.laundering) afs_pages_written_back(vnode, op->store.pos, op->store.size);
afs_pages_written_back(vnode, op->store.pos, op->store.size);
afs_stat_v(vnode, n_stores); afs_stat_v(vnode, n_stores);
atomic_long_add(op->store.size, &afs_v2net(vnode)->n_store_bytes); atomic_long_add(op->store.size, &afs_v2net(vnode)->n_store_bytes);
} }
...@@ -91,8 +90,7 @@ static const struct afs_operation_ops afs_store_data_operation = { ...@@ -91,8 +90,7 @@ static const struct afs_operation_ops afs_store_data_operation = {
/* /*
* write to a file * write to a file
*/ */
static int afs_store_data(struct afs_vnode *vnode, struct iov_iter *iter, loff_t pos, static int afs_store_data(struct afs_vnode *vnode, struct iov_iter *iter, loff_t pos)
bool laundering)
{ {
struct afs_operation *op; struct afs_operation *op;
struct afs_wb_key *wbk = NULL; struct afs_wb_key *wbk = NULL;
...@@ -123,7 +121,6 @@ static int afs_store_data(struct afs_vnode *vnode, struct iov_iter *iter, loff_t ...@@ -123,7 +121,6 @@ static int afs_store_data(struct afs_vnode *vnode, struct iov_iter *iter, loff_t
op->file[0].modification = true; op->file[0].modification = true;
op->store.pos = pos; op->store.pos = pos;
op->store.size = size; op->store.size = size;
op->store.laundering = laundering;
op->flags |= AFS_OPERATION_UNINTR; op->flags |= AFS_OPERATION_UNINTR;
op->ops = &afs_store_data_operation; op->ops = &afs_store_data_operation;
...@@ -168,8 +165,7 @@ static void afs_upload_to_server(struct netfs_io_subrequest *subreq) ...@@ -168,8 +165,7 @@ static void afs_upload_to_server(struct netfs_io_subrequest *subreq)
subreq->rreq->debug_id, subreq->debug_index, subreq->io_iter.count); subreq->rreq->debug_id, subreq->debug_index, subreq->io_iter.count);
trace_netfs_sreq(subreq, netfs_sreq_trace_submit); trace_netfs_sreq(subreq, netfs_sreq_trace_submit);
ret = afs_store_data(vnode, &subreq->io_iter, subreq->start, ret = afs_store_data(vnode, &subreq->io_iter, subreq->start);
subreq->rreq->origin == NETFS_LAUNDER_WRITE);
netfs_write_subrequest_terminated(subreq, ret < 0 ? ret : subreq->len, netfs_write_subrequest_terminated(subreq, ret < 0 ? ret : subreq->len,
false); false);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment