/* SPDX-License-Identifier: GPL-2.0-or-later */ /* NFS filesystem cache interface definitions * * Copyright (C) 2008 Red Hat, Inc. All Rights Reserved. * Written by David Howells (dhowells@redhat.com)
*/
/* * Definition of the auxiliary data attached to NFS inode storage objects * within the cache. * * The contents of this struct are recorded in the on-disk local cache in the * auxiliary data attached to the data storage object backing an inode. This * permits coherency to be managed when a new inode binds to an already extant * cache object.
*/ struct nfs_fscache_inode_auxdata {
s64 mtime_sec;
s64 mtime_nsec;
s64 ctime_sec;
s64 ctime_nsec;
u64 change_attr;
};
struct nfs_netfs_io_data { /* * NFS may split a netfs_io_subrequest into multiple RPCs, each * with their own read completion. In netfs, we can only call * netfs_subreq_terminated() once for each subrequest. Use the * refcount here to double as a marker of the last RPC completion, * and only call netfs via netfs_subreq_terminated() once.
*/
refcount_t refcount; struct netfs_io_subrequest *sreq;
/* * Final disposition of the netfs_io_subrequest, sent in * netfs_subreq_terminated()
*/
atomic64_t transferred; int error;
};
staticinlinevoid nfs_netfs_put(struct nfs_netfs_io_data *netfs)
{ /* Only the last RPC completion should call netfs_subreq_terminated() */ if (!refcount_dec_and_test(&netfs->refcount)) return;
/* * The NFS pageio interface may read a complete page, even when netfs * only asked for a partial page. Specifically, this may be seen when * one thread is truncating a file while another one is reading the last * page of the file. * Correct the final length here to be no larger than the netfs subrequest * length, and thus avoid netfs's "Subreq overread" warning message.
*/
netfs->sreq->transferred = min_t(s64, netfs->sreq->len,
atomic64_read(&netfs->transferred));
netfs->sreq->error = netfs->error;
netfs_read_subreq_terminated(netfs->sreq);
kfree(netfs);
} staticinlinevoid nfs_netfs_inode_init(struct nfs_inode *nfsi)
{
netfs_inode_init(&nfsi->netfs, &nfs_netfs_ops, false);
} externvoid nfs_netfs_initiate_read(struct nfs_pgio_header *hdr); externvoid nfs_netfs_read_completion(struct nfs_pgio_header *hdr); externint nfs_netfs_folio_unlock(struct folio *folio);
if (NFS_SERVER(inode)->nfs_client->rpc_ops->version == 4)
auxdata->change_attr = inode_peek_iversion_raw(inode);
}
/* * Invalidate the contents of fscache for this inode. This will not sleep.
*/ staticinlinevoid nfs_fscache_invalidate(struct inode *inode, int flags)
{ struct nfs_fscache_inode_auxdata auxdata; struct fscache_cookie *cookie = netfs_i_cookie(&NFS_I(inode)->netfs);
/* * indicate the client caching state as readable text
*/ staticinlineconstchar *nfs_server_fscache_state(struct nfs_server *server)
{ if (server->fscache) return"yes"; return"no ";
}
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.0Bemerkung:
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.