The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/nfs/nfs_fha.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*-
    2  * Copyright (c) 2008 Isilon Inc http://www.isilon.com/
    3  *
    4  * Redistribution and use in source and binary forms, with or without
    5  * modification, are permitted provided that the following conditions
    6  * are met:
    7  * 1. Redistributions of source code must retain the above copyright
    8  *    notice, this list of conditions and the following disclaimer.
    9  * 2. Redistributions in binary form must reproduce the above copyright
   10  *    notice, this list of conditions and the following disclaimer in the
   11  *    documentation and/or other materials provided with the distribution.
   12  *
   13  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   14  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   15  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   16  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   17  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   18  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   19  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   20  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   21  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   22  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   23  * SUCH DAMAGE.
   24  */
   25 /* $FreeBSD: releng/10.0/sys/nfs/nfs_fha.h 249596 2013-04-17 22:42:43Z ken $ */
   26 
   27 #ifndef _NFS_FHA_H
   28 #define _NFS_FHA_H 1
   29 
   30 #ifdef  _KERNEL
   31 
   32 /* Sysctl defaults. */
   33 #define FHA_DEF_ENABLE                  1
   34 #define FHA_DEF_BIN_SHIFT               22 /* 4MB */
   35 #define FHA_DEF_MAX_NFSDS_PER_FH        8
   36 #define FHA_DEF_MAX_REQS_PER_NFSD       0  /* Unlimited */
   37 
   38 /* This is the global structure that represents the state of the fha system. */
   39 struct fha_global {
   40         struct fha_hash_entry_list *hashtable;
   41         u_long hashmask;
   42 };
   43 
   44 struct fha_ctls {
   45         int      enable;
   46         uint32_t bin_shift;
   47         uint32_t max_nfsds_per_fh;
   48         uint32_t max_reqs_per_nfsd;
   49 };
   50 
   51 /*
   52  * These are the entries in the filehandle hash.  They talk about a specific
   53  * file, requests against which are being handled by one or more nfsds.  We
   54  * keep a chain of nfsds against the file. We only have more than one if reads
   55  * are ongoing, and then only if the reads affect disparate regions of the
   56  * file.
   57  *
   58  * In general, we want to assign a new request to an existing nfsd if it is
   59  * going to contend with work happening already on that nfsd, or if the
   60  * operation is a read and the nfsd is already handling a proximate read.  We
   61  * do this to avoid jumping around in the read stream unnecessarily, and to
   62  * avoid contention between threads over single files.
   63  */
   64 struct fha_hash_entry {
   65         LIST_ENTRY(fha_hash_entry) link;
   66         u_int64_t fh;
   67         u_int32_t num_rw;
   68         u_int32_t num_exclusive;
   69         u_int8_t num_threads;
   70         struct svcthread_list threads;
   71 };
   72 
   73 LIST_HEAD(fha_hash_entry_list, fha_hash_entry);
   74 
   75 /* A structure used for passing around data internally. */
   76 struct fha_info {
   77         u_int64_t fh;
   78         off_t offset;
   79         int locktype;
   80 };
   81 
   82 struct fha_callbacks {
   83         rpcproc_t (*get_procnum)(rpcproc_t procnum);
   84         int (*realign)(struct mbuf **mb, int malloc_flags);
   85         int (*get_fh)(fhandle_t *fh, int v3, struct mbuf **md, caddr_t *dpos);
   86         int (*is_read)(rpcproc_t procnum);
   87         int (*is_write)(rpcproc_t procnum);
   88         int (*get_offset)(struct mbuf **md, caddr_t *dpos, int v3, struct
   89                           fha_info *info);
   90         int (*no_offset)(rpcproc_t procnum);
   91         void (*set_locktype)(rpcproc_t procnum, struct fha_info *info);
   92         int (*fhe_stats_sysctl)(SYSCTL_HANDLER_ARGS);
   93 };
   94 
   95 struct fha_params {
   96         struct fha_global g_fha; 
   97         struct sysctl_ctx_list sysctl_ctx;
   98         struct sysctl_oid *sysctl_tree;
   99         struct fha_ctls ctls;
  100         struct fha_callbacks callbacks;
  101         char server_name[32];
  102         SVCPOOL **pool;
  103 };
  104 
  105 void fha_nd_complete(SVCTHREAD *, struct svc_req *);
  106 SVCTHREAD *fha_assign(SVCTHREAD *, struct svc_req *, struct fha_params *);
  107 void fha_init(struct fha_params *softc);
  108 void fha_uninit(struct fha_params *softc);
  109 int fhe_stats_sysctl(SYSCTL_HANDLER_ARGS, struct fha_params *softc);
  110 
  111 #endif /* _KERNEL */
  112 #endif /* _NFS_FHA_H_ */

Cache object: e0dc819bca4ae3dea98550f938008133


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.