linux/fs/nfs/localio.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * NFS client support for local clients to bypass network stack
 *
 * Copyright (C) 2014 Weston Andros Adamson <[email protected]>
 * Copyright (C) 2019 Trond Myklebust <[email protected]>
 * Copyright (C) 2024 Mike Snitzer <[email protected]>
 * Copyright (C) 2024 NeilBrown <[email protected]>
 */

#include <linux/module.h>
#include <linux/errno.h>
#include <linux/vfs.h>
#include <linux/file.h>
#include <linux/inet.h>
#include <linux/sunrpc/addr.h>
#include <linux/inetdevice.h>
#include <net/addrconf.h>
#include <linux/nfs_common.h>
#include <linux/nfslocalio.h>
#include <linux/bvec.h>

#include <linux/nfs.h>
#include <linux/nfs_fs.h>
#include <linux/nfs_xdr.h>

#include "internal.h"
#include "pnfs.h"
#include "nfstrace.h"

#define NFSDBG_FACILITY

struct nfs_local_kiocb {};

struct nfs_local_fsync_ctx {};
static void nfs_local_fsync_work(struct work_struct *work);

static bool localio_enabled __read_mostly =;
module_param(localio_enabled, bool, 0644);

static inline bool nfs_client_is_local(const struct nfs_client *clp)
{}

bool nfs_server_is_local(const struct nfs_client *clp)
{}
EXPORT_SYMBOL_GPL();

/*
 * UUID_IS_LOCAL XDR functions
 */

static void localio_xdr_enc_uuidargs(struct rpc_rqst *req,
				     struct xdr_stream *xdr,
				     const void *data)
{}

static int localio_xdr_dec_uuidres(struct rpc_rqst *req,
				   struct xdr_stream *xdr,
				   void *result)
{}

static const struct rpc_procinfo nfs_localio_procedures[] =;

static unsigned int nfs_localio_counts[ARRAY_SIZE(nfs_localio_procedures)];
static const struct rpc_version nfslocalio_version1 =;

static const struct rpc_version *nfslocalio_version[] =;

extern const struct rpc_program nfslocalio_program;
static struct rpc_stat		nfslocalio_rpcstat =;

const struct rpc_program nfslocalio_program =;

/*
 * nfs_local_enable - enable local i/o for an nfs_client
 */
static void nfs_local_enable(struct nfs_client *clp)
{}

/*
 * nfs_local_disable - disable local i/o for an nfs_client
 */
void nfs_local_disable(struct nfs_client *clp)
{}

/*
 * nfs_init_localioclient - Initialise an NFS localio client connection
 */
static struct rpc_clnt *nfs_init_localioclient(struct nfs_client *clp)
{}

static bool nfs_server_uuid_is_local(struct nfs_client *clp)
{}

/*
 * nfs_local_probe - probe local i/o support for an nfs_server and nfs_client
 * - called after alloc_client and init_client (so cl_rpcclient exists)
 * - this function is idempotent, it can be called for old or new clients
 */
void nfs_local_probe(struct nfs_client *clp)
{}
EXPORT_SYMBOL_GPL();

/*
 * nfs_local_open_fh - open a local filehandle in terms of nfsd_file
 *
 * Returns a pointer to a struct nfsd_file or NULL
 */
struct nfsd_file *
nfs_local_open_fh(struct nfs_client *clp, const struct cred *cred,
		  struct nfs_fh *fh, const fmode_t mode)
{}
EXPORT_SYMBOL_GPL();

static struct bio_vec *
nfs_bvec_alloc_and_import_pagevec(struct page **pagevec,
		unsigned int npages, gfp_t flags)
{}

static void
nfs_local_iocb_free(struct nfs_local_kiocb *iocb)
{}

static struct nfs_local_kiocb *
nfs_local_iocb_alloc(struct nfs_pgio_header *hdr,
		     struct nfsd_file *localio, gfp_t flags)
{}

static void
nfs_local_iter_init(struct iov_iter *i, struct nfs_local_kiocb *iocb, int dir)
{}

static void
nfs_local_hdr_release(struct nfs_pgio_header *hdr,
		const struct rpc_call_ops *call_ops)
{}

static void
nfs_local_pgio_init(struct nfs_pgio_header *hdr,
		const struct rpc_call_ops *call_ops)
{}

static void
nfs_local_pgio_done(struct nfs_pgio_header *hdr, long status)
{}

static void
nfs_local_pgio_release(struct nfs_local_kiocb *iocb)
{}

static void
nfs_local_read_done(struct nfs_local_kiocb *iocb, long status)
{}

static void nfs_local_call_read(struct work_struct *work)
{}

static int
nfs_do_local_read(struct nfs_pgio_header *hdr,
		  struct nfsd_file *localio,
		  const struct rpc_call_ops *call_ops)
{}

static void
nfs_copy_boot_verifier(struct nfs_write_verifier *verifier, struct inode *inode)
{}

static void
nfs_reset_boot_verifier(struct inode *inode)
{}

static void
nfs_set_local_verifier(struct inode *inode,
		struct nfs_writeverf *verf,
		enum nfs3_stable_how how)
{}

/* Factored out from fs/nfsd/vfs.h:fh_getattr() */
static int __vfs_getattr(struct path *p, struct kstat *stat, int version)
{}

/* Copied from fs/nfsd/nfsfh.c:nfsd4_change_attribute() */
static u64 __nfsd4_change_attribute(const struct kstat *stat,
				    const struct inode *inode)
{}

static void nfs_local_vfs_getattr(struct nfs_local_kiocb *iocb)
{}

static void
nfs_local_write_done(struct nfs_local_kiocb *iocb, long status)
{}

static void nfs_local_call_write(struct work_struct *work)
{}

static int
nfs_do_local_write(struct nfs_pgio_header *hdr,
		   struct nfsd_file *localio,
		   const struct rpc_call_ops *call_ops)
{}

int nfs_local_doio(struct nfs_client *clp, struct nfsd_file *localio,
		   struct nfs_pgio_header *hdr,
		   const struct rpc_call_ops *call_ops)
{}

static void
nfs_local_init_commit(struct nfs_commit_data *data,
		const struct rpc_call_ops *call_ops)
{}

static int
nfs_local_run_commit(struct file *filp, struct nfs_commit_data *data)
{}

static void
nfs_local_commit_done(struct nfs_commit_data *data, int status)
{}

static void
nfs_local_release_commit_data(struct nfsd_file *localio,
		struct nfs_commit_data *data,
		const struct rpc_call_ops *call_ops)
{}

static struct nfs_local_fsync_ctx *
nfs_local_fsync_ctx_alloc(struct nfs_commit_data *data,
			  struct nfsd_file *localio, gfp_t flags)
{}

static void
nfs_local_fsync_ctx_kref_free(struct kref *kref)
{}

static void
nfs_local_fsync_ctx_put(struct nfs_local_fsync_ctx *ctx)
{}

static void
nfs_local_fsync_ctx_free(struct nfs_local_fsync_ctx *ctx)
{}

static void
nfs_local_fsync_work(struct work_struct *work)
{}

int nfs_local_commit(struct nfsd_file *localio,
		     struct nfs_commit_data *data,
		     const struct rpc_call_ops *call_ops, int how)
{}