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

Cache object: e6d486cf1e9480c8efbfd246dda412bd


[ 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.