// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2014 Anna Schumaker <Anna.Schumaker@Netapp.com>
*/
#include <linux/fs.h>
#include <linux/sunrpc/addr.h>
#include <linux/sunrpc/sched.h>
#include <linux/nfs.h>
#include <linux/nfs3.h>
#include <linux/nfs4.h>
#include <linux/nfs_xdr.h>
#include <linux/nfs_fs.h>
#include "nfs4_fs.h"
#include "nfs42.h"
#include "iostat.h"
#include "pnfs.h"
#include "nfs4session.h"
#include "internal.h"
#include "delegation.h"
#include "nfs4trace.h"
#define NFSDBG_FACILITY NFSDBG_PROC
static int nfs42_do_offload_cancel_async(struct file *dst, nfs4_stateid *std);
static void nfs42_set_netaddr(struct file *filep, struct nfs42_netaddr *naddr)
{
struct nfs_client *clp = (NFS_SERVER(file_inode(filep)))->nfs_client;
unsigned short port = 2049;
rcu_read_lock();
naddr->netid_len = scnprintf(naddr->netid,
sizeof(naddr->netid), "%s",
rpc_peeraddr2str(clp->cl_rpcclient,
RPC_DISPLAY_NETID));
naddr->addr_len = scnprintf(naddr->addr,
sizeof(naddr->addr),
"%s.%u.%u",
rpc_peeraddr2str(clp->cl_rpcclient,
RPC_DISPLAY_ADDR),
port >> 8, port & 255);
rcu_read_unlock();
}
static int _nfs42_proc_fallocate(struct rpc_message *msg, struct file *filep,
struct nfs_lock_context *lock, loff_t offset, loff_t len)
{
struct inode *inode = file_inode(filep);
struct nfs_server *server = NFS_SERVER(inode);
u32 bitmask[3];
struct nfs42_falloc_args args = {
.falloc_fh = NFS_FH(inode),
.falloc_offset = offset,
.falloc_length = len