linux/fs/nfs/nfs4session.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * fs/nfs/nfs4session.c
 *
 * Copyright (c) 2012 Trond Myklebust <[email protected]>
 *
 */
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/string.h>
#include <linux/printk.h>
#include <linux/slab.h>
#include <linux/sunrpc/sched.h>
#include <linux/sunrpc/bc_xprt.h>
#include <linux/nfs.h>
#include <linux/nfs4.h>
#include <linux/nfs_fs.h>
#include <linux/module.h>

#include "nfs4_fs.h"
#include "internal.h"
#include "nfs4session.h"
#include "callback.h"

#define NFSDBG_FACILITY

static void nfs4_init_slot_table(struct nfs4_slot_table *tbl, const char *queue)
{}

/*
 * nfs4_shrink_slot_table - free retired slots from the slot table
 */
static void nfs4_shrink_slot_table(struct nfs4_slot_table  *tbl, u32 newsize)
{}

/**
 * nfs4_slot_tbl_drain_complete - wake waiters when drain is complete
 * @tbl: controlling slot table
 *
 */
void nfs4_slot_tbl_drain_complete(struct nfs4_slot_table *tbl)
{}

/*
 * nfs4_free_slot - free a slot and efficiently update slot table.
 *
 * freeing a slot is trivially done by clearing its respective bit
 * in the bitmap.
 * If the freed slotid equals highest_used_slotid we want to update it
 * so that the server would be able to size down the slot table if needed,
 * otherwise we know that the highest_used_slotid is still in use.
 * When updating highest_used_slotid there may be "holes" in the bitmap
 * so we need to scan down from highest_used_slotid to 0 looking for the now
 * highest slotid in use.
 * If none found, highest_used_slotid is set to NFS4_NO_SLOT.
 *
 * Must be called while holding tbl->slot_tbl_lock
 */
void nfs4_free_slot(struct nfs4_slot_table *tbl, struct nfs4_slot *slot)
{}

static struct nfs4_slot *nfs4_new_slot(struct nfs4_slot_table  *tbl,
		u32 slotid, u32 seq_init, gfp_t gfp_mask)
{}

static struct nfs4_slot *nfs4_find_or_create_slot(struct nfs4_slot_table  *tbl,
		u32 slotid, u32 seq_init, gfp_t gfp_mask)
{}

static void nfs4_lock_slot(struct nfs4_slot_table *tbl,
		struct nfs4_slot *slot)
{}

/*
 * nfs4_try_to_lock_slot - Given a slot try to allocate it
 *
 * Note: must be called with the slot_tbl_lock held.
 */
bool nfs4_try_to_lock_slot(struct nfs4_slot_table *tbl, struct nfs4_slot *slot)
{}

/*
 * nfs4_lookup_slot - Find a slot but don't allocate it
 *
 * Note: must be called with the slot_tbl_lock held.
 */
struct nfs4_slot *nfs4_lookup_slot(struct nfs4_slot_table *tbl, u32 slotid)
{}

static int nfs4_slot_get_seqid(struct nfs4_slot_table  *tbl, u32 slotid,
		u32 *seq_nr)
	__must_hold(&tbl->slot_tbl_lock)
{}

/*
 * nfs4_slot_seqid_in_use - test if a slot sequence id is still in use
 *
 * Given a slot table, slot id and sequence number, determine if the
 * RPC call in question is still in flight. This function is mainly
 * intended for use by the callback channel.
 */
static bool nfs4_slot_seqid_in_use(struct nfs4_slot_table *tbl,
		u32 slotid, u32 seq_nr)
{}

/*
 * nfs4_slot_wait_on_seqid - wait until a slot sequence id is complete
 *
 * Given a slot table, slot id and sequence number, wait until the
 * corresponding RPC call completes. This function is mainly
 * intended for use by the callback channel.
 */
int nfs4_slot_wait_on_seqid(struct nfs4_slot_table *tbl,
		u32 slotid, u32 seq_nr,
		unsigned long timeout)
{}

/*
 * nfs4_alloc_slot - efficiently look for a free slot
 *
 * nfs4_alloc_slot looks for an unset bit in the used_slots bitmap.
 * If found, we mark the slot as used, update the highest_used_slotid,
 * and respectively set up the sequence operation args.
 *
 * Note: must be called with under the slot_tbl_lock.
 */
struct nfs4_slot *nfs4_alloc_slot(struct nfs4_slot_table *tbl)
{}

static int nfs4_grow_slot_table(struct nfs4_slot_table *tbl,
		 u32 max_reqs, u32 ivalue)
{}

static void nfs4_reset_slot_table(struct nfs4_slot_table *tbl,
		u32 server_highest_slotid,
		u32 ivalue)
{}

/*
 * (re)Initialise a slot table
 */
static int nfs4_realloc_slot_table(struct nfs4_slot_table *tbl,
		u32 max_reqs, u32 ivalue)
{}

/*
 * nfs4_release_slot_table - release all slot table entries
 */
static void nfs4_release_slot_table(struct nfs4_slot_table *tbl)
{}

/**
 * nfs4_shutdown_slot_table - release resources attached to a slot table
 * @tbl: slot table to shut down
 *
 */
void nfs4_shutdown_slot_table(struct nfs4_slot_table *tbl)
{}

/**
 * nfs4_setup_slot_table - prepare a stand-alone slot table for use
 * @tbl: slot table to set up
 * @max_reqs: maximum number of requests allowed
 * @queue: name to give RPC wait queue
 *
 * Returns zero on success, or a negative errno.
 */
int nfs4_setup_slot_table(struct nfs4_slot_table *tbl, unsigned int max_reqs,
		const char *queue)
{}

static bool nfs41_assign_slot(struct rpc_task *task, void *pslot)
{}

static bool __nfs41_wake_and_assign_slot(struct nfs4_slot_table *tbl,
		struct nfs4_slot *slot)
{}

bool nfs41_wake_and_assign_slot(struct nfs4_slot_table *tbl,
		struct nfs4_slot *slot)
{}

static bool nfs41_try_wake_next_slot_table_entry(struct nfs4_slot_table *tbl)
{}

void nfs41_wake_slot_table(struct nfs4_slot_table *tbl)
{}

#if defined(CONFIG_NFS_V4_1)

static void nfs41_set_max_slotid_locked(struct nfs4_slot_table *tbl,
		u32 target_highest_slotid)
{}

/* Update the client's idea of target_highest_slotid */
static void nfs41_set_target_slotid_locked(struct nfs4_slot_table *tbl,
		u32 target_highest_slotid)
{}

void nfs41_set_target_slotid(struct nfs4_slot_table *tbl,
		u32 target_highest_slotid)
{}

static void nfs41_set_server_slotid_locked(struct nfs4_slot_table *tbl,
		u32 highest_slotid)
{}

static s32 nfs41_derivative_target_slotid(s32 s1, s32 s2)
{}

static int nfs41_sign_s32(s32 s1)
{}

static bool nfs41_same_sign_or_zero_s32(s32 s1, s32 s2)
{}

/* Try to eliminate outliers by checking for sharp changes in the
 * derivatives and second derivatives
 */
static bool nfs41_is_outlier_target_slotid(struct nfs4_slot_table *tbl,
		u32 new_target)
{}

void nfs41_update_target_slotid(struct nfs4_slot_table *tbl,
		struct nfs4_slot *slot,
		struct nfs4_sequence_res *res)
{}

static void nfs4_release_session_slot_tables(struct nfs4_session *session)
{}

/*
 * Initialize or reset the forechannel and backchannel tables
 */
int nfs4_setup_session_slot_tables(struct nfs4_session *ses)
{}

struct nfs4_session *nfs4_alloc_session(struct nfs_client *clp)
{}

static void nfs4_destroy_session_slot_tables(struct nfs4_session *session)
{}

void nfs4_destroy_session(struct nfs4_session *session)
{}

/*
 * With sessions, the client is not marked ready until after a
 * successful EXCHANGE_ID and CREATE_SESSION.
 *
 * Map errors cl_cons_state errors to EPROTONOSUPPORT to indicate
 * other versions of NFS can be tried.
 */
static int nfs41_check_session_ready(struct nfs_client *clp)
{}

int nfs4_init_session(struct nfs_client *clp)
{}

int nfs4_init_ds_session(struct nfs_client *clp, unsigned long lease_time)
{}
EXPORT_SYMBOL_GPL();

#endif	/* defined(CONFIG_NFS_V4_1) */