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/contrib/openzfs/include/sys/mmp.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  * CDDL HEADER START
    3  *
    4  * This file and its contents are supplied under the terms of the
    5  * Common Development and Distribution License ("CDDL"), version 1.0.
    6  * You may only use this file in accordance with the terms of version
    7  * 1.0 of the CDDL.
    8  *
    9  * A full copy of the text of the CDDL should have accompanied this
   10  * source.  A copy of the CDDL is also available via the Internet at
   11  * http://www.illumos.org/license/CDDL.
   12  *
   13  * CDDL HEADER END
   14  */
   15 /*
   16  * Copyright (C) 2017 by Lawrence Livermore National Security, LLC.
   17  */
   18 
   19 #ifndef _SYS_MMP_H
   20 #define _SYS_MMP_H
   21 
   22 #include <sys/spa.h>
   23 #include <sys/zfs_context.h>
   24 #include <sys/uberblock_impl.h>
   25 
   26 #ifdef  __cplusplus
   27 extern "C" {
   28 #endif
   29 
   30 #define MMP_MIN_INTERVAL                100     /* ms */
   31 #define MMP_DEFAULT_INTERVAL            1000    /* ms */
   32 #define MMP_DEFAULT_IMPORT_INTERVALS    20
   33 #define MMP_DEFAULT_FAIL_INTERVALS      10
   34 #define MMP_MIN_FAIL_INTERVALS          2       /* min if != 0 */
   35 #define MMP_IMPORT_SAFETY_FACTOR        200     /* pct */
   36 #define MMP_INTERVAL_OK(interval)       MAX(interval, MMP_MIN_INTERVAL)
   37 #define MMP_FAIL_INTVS_OK(fails)        (fails == 0 ? 0 : MAX(fails, \
   38                                             MMP_MIN_FAIL_INTERVALS))
   39 
   40 typedef struct mmp_thread {
   41         kmutex_t        mmp_thread_lock; /* protect thread mgmt fields */
   42         kcondvar_t      mmp_thread_cv;
   43         kthread_t       *mmp_thread;
   44         uint8_t         mmp_thread_exiting;
   45         kmutex_t        mmp_io_lock;    /* protect below */
   46         hrtime_t        mmp_last_write; /* last successful MMP write */
   47         uint64_t        mmp_delay;      /* decaying avg ns between MMP writes */
   48         uberblock_t     mmp_ub;         /* last ub written by sync */
   49         zio_t           *mmp_zio_root;  /* root of mmp write zios */
   50         uint64_t        mmp_kstat_id;   /* unique id for next MMP write kstat */
   51         int             mmp_skip_error; /* reason for last skipped write */
   52         vdev_t          *mmp_last_leaf; /* last mmp write sent here */
   53         uint64_t        mmp_leaf_last_gen;      /* last mmp write sent here */
   54         uint32_t        mmp_seq;        /* intra-second update counter */
   55 } mmp_thread_t;
   56 
   57 
   58 extern void mmp_init(struct spa *spa);
   59 extern void mmp_fini(struct spa *spa);
   60 extern void mmp_thread_start(struct spa *spa);
   61 extern void mmp_thread_stop(struct spa *spa);
   62 extern void mmp_update_uberblock(struct spa *spa, struct uberblock *ub);
   63 extern void mmp_signal_all_threads(void);
   64 
   65 /* Global tuning */
   66 extern int param_set_multihost_interval(ZFS_MODULE_PARAM_ARGS);
   67 extern uint64_t zfs_multihost_interval;
   68 extern uint_t zfs_multihost_fail_intervals;
   69 extern uint_t zfs_multihost_import_intervals;
   70 
   71 #ifdef  __cplusplus
   72 }
   73 #endif
   74 
   75 #endif  /* _SYS_MMP_H */

Cache object: d11073fd2bab83a3b2add0dfe174cc67


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