linux/include/linux/drbd_limits.h

/* SPDX-License-Identifier: GPL-2.0-only */
/*
  drbd_limits.h
  This file is part of DRBD by Philipp Reisner and Lars Ellenberg.
*/

/*
 * Our current limitations.
 * Some of them are hard limits,
 * some of them are arbitrary range limits, that make it easier to provide
 * feedback about nonsense settings for certain configurable values.
 */

#ifndef DRBD_LIMITS_H
#define DRBD_LIMITS_H

#define DEBUG_RANGE_CHECK

#define DRBD_MINOR_COUNT_MIN
#define DRBD_MINOR_COUNT_MAX
#define DRBD_MINOR_COUNT_DEF
#define DRBD_MINOR_COUNT_SCALE

#define DRBD_VOLUME_MAX

#define DRBD_DIALOG_REFRESH_MIN
#define DRBD_DIALOG_REFRESH_MAX
#define DRBD_DIALOG_REFRESH_SCALE

/* valid port number */
#define DRBD_PORT_MIN
#define DRBD_PORT_MAX
#define DRBD_PORT_SCALE

/* startup { */
  /* if you want more than 3.4 days, disable */
#define DRBD_WFC_TIMEOUT_MIN
#define DRBD_WFC_TIMEOUT_MAX
#define DRBD_WFC_TIMEOUT_DEF
#define DRBD_WFC_TIMEOUT_SCALE

#define DRBD_DEGR_WFC_TIMEOUT_MIN
#define DRBD_DEGR_WFC_TIMEOUT_MAX
#define DRBD_DEGR_WFC_TIMEOUT_DEF
#define DRBD_DEGR_WFC_TIMEOUT_SCALE

#define DRBD_OUTDATED_WFC_TIMEOUT_MIN
#define DRBD_OUTDATED_WFC_TIMEOUT_MAX
#define DRBD_OUTDATED_WFC_TIMEOUT_DEF
#define DRBD_OUTDATED_WFC_TIMEOUT_SCALE
/* }*/

/* net { */
  /* timeout, unit centi seconds
   * more than one minute timeout is not useful */
#define DRBD_TIMEOUT_MIN
#define DRBD_TIMEOUT_MAX
#define DRBD_TIMEOUT_DEF
#define DRBD_TIMEOUT_SCALE

 /* If backing disk takes longer than disk_timeout, mark the disk as failed */
#define DRBD_DISK_TIMEOUT_MIN
#define DRBD_DISK_TIMEOUT_MAX
#define DRBD_DISK_TIMEOUT_DEF
#define DRBD_DISK_TIMEOUT_SCALE

  /* active connection retries when C_WF_CONNECTION */
#define DRBD_CONNECT_INT_MIN
#define DRBD_CONNECT_INT_MAX
#define DRBD_CONNECT_INT_DEF
#define DRBD_CONNECT_INT_SCALE

  /* keep-alive probes when idle */
#define DRBD_PING_INT_MIN
#define DRBD_PING_INT_MAX
#define DRBD_PING_INT_DEF
#define DRBD_PING_INT_SCALE

 /* timeout for the ping packets.*/
#define DRBD_PING_TIMEO_MIN
#define DRBD_PING_TIMEO_MAX
#define DRBD_PING_TIMEO_DEF
#define DRBD_PING_TIMEO_SCALE

  /* max number of write requests between write barriers */
#define DRBD_MAX_EPOCH_SIZE_MIN
#define DRBD_MAX_EPOCH_SIZE_MAX
#define DRBD_MAX_EPOCH_SIZE_DEF
#define DRBD_MAX_EPOCH_SIZE_SCALE

  /* I don't think that a tcp send buffer of more than 10M is useful */
#define DRBD_SNDBUF_SIZE_MIN
#define DRBD_SNDBUF_SIZE_MAX
#define DRBD_SNDBUF_SIZE_DEF
#define DRBD_SNDBUF_SIZE_SCALE

#define DRBD_RCVBUF_SIZE_MIN
#define DRBD_RCVBUF_SIZE_MAX
#define DRBD_RCVBUF_SIZE_DEF
#define DRBD_RCVBUF_SIZE_SCALE

  /* @4k PageSize -> 128kB - 512MB */
#define DRBD_MAX_BUFFERS_MIN
#define DRBD_MAX_BUFFERS_MAX
#define DRBD_MAX_BUFFERS_DEF
#define DRBD_MAX_BUFFERS_SCALE

  /* @4k PageSize -> 4kB - 512MB */
#define DRBD_UNPLUG_WATERMARK_MIN
#define DRBD_UNPLUG_WATERMARK_MAX
#define DRBD_UNPLUG_WATERMARK_DEF
#define DRBD_UNPLUG_WATERMARK_SCALE

  /* 0 is disabled.
   * 200 should be more than enough even for very short timeouts */
#define DRBD_KO_COUNT_MIN
#define DRBD_KO_COUNT_MAX
#define DRBD_KO_COUNT_DEF
#define DRBD_KO_COUNT_SCALE
/* } */

/* syncer { */
  /* FIXME allow rate to be zero? */
#define DRBD_RESYNC_RATE_MIN
/* channel bonding 10 GbE, or other hardware */
#define DRBD_RESYNC_RATE_MAX
#define DRBD_RESYNC_RATE_DEF
#define DRBD_RESYNC_RATE_SCALE

#define DRBD_AL_EXTENTS_MIN
  /* we use u16 as "slot number", (u16)~0 is "FREE".
   * If you use >= 292 kB on-disk ring buffer,
   * this is the maximum you can use: */
#define DRBD_AL_EXTENTS_MAX
#define DRBD_AL_EXTENTS_DEF
#define DRBD_AL_EXTENTS_SCALE

#define DRBD_MINOR_NUMBER_MIN
#define DRBD_MINOR_NUMBER_MAX
#define DRBD_MINOR_NUMBER_DEF
#define DRBD_MINOR_NUMBER_SCALE

/* } */

/* drbdsetup XY resize -d Z
 * you are free to reduce the device size to nothing, if you want to.
 * the upper limit with 64bit kernel, enough ram and flexible meta data
 * is 1 PiB, currently. */
/* DRBD_MAX_SECTORS */
#define DRBD_DISK_SIZE_MIN
#define DRBD_DISK_SIZE_MAX
#define DRBD_DISK_SIZE_DEF
#define DRBD_DISK_SIZE_SCALE

#define DRBD_ON_IO_ERROR_DEF
#define DRBD_FENCING_DEF
#define DRBD_AFTER_SB_0P_DEF
#define DRBD_AFTER_SB_1P_DEF
#define DRBD_AFTER_SB_2P_DEF
#define DRBD_RR_CONFLICT_DEF
#define DRBD_ON_NO_DATA_DEF
#define DRBD_ON_CONGESTION_DEF
#define DRBD_READ_BALANCING_DEF

#define DRBD_MAX_BIO_BVECS_MIN
#define DRBD_MAX_BIO_BVECS_MAX
#define DRBD_MAX_BIO_BVECS_DEF
#define DRBD_MAX_BIO_BVECS_SCALE

#define DRBD_C_PLAN_AHEAD_MIN
#define DRBD_C_PLAN_AHEAD_MAX
#define DRBD_C_PLAN_AHEAD_DEF
#define DRBD_C_PLAN_AHEAD_SCALE

#define DRBD_C_DELAY_TARGET_MIN
#define DRBD_C_DELAY_TARGET_MAX
#define DRBD_C_DELAY_TARGET_DEF
#define DRBD_C_DELAY_TARGET_SCALE

#define DRBD_C_FILL_TARGET_MIN
#define DRBD_C_FILL_TARGET_MAX
#define DRBD_C_FILL_TARGET_DEF
#define DRBD_C_FILL_TARGET_SCALE

#define DRBD_C_MAX_RATE_MIN
#define DRBD_C_MAX_RATE_MAX
#define DRBD_C_MAX_RATE_DEF
#define DRBD_C_MAX_RATE_SCALE

#define DRBD_C_MIN_RATE_MIN
#define DRBD_C_MIN_RATE_MAX
#define DRBD_C_MIN_RATE_DEF
#define DRBD_C_MIN_RATE_SCALE

#define DRBD_CONG_FILL_MIN
#define DRBD_CONG_FILL_MAX
#define DRBD_CONG_FILL_DEF
#define DRBD_CONG_FILL_SCALE

#define DRBD_CONG_EXTENTS_MIN
#define DRBD_CONG_EXTENTS_MAX
#define DRBD_CONG_EXTENTS_DEF
#define DRBD_CONG_EXTENTS_SCALE

#define DRBD_PROTOCOL_DEF

#define DRBD_DISK_BARRIER_DEF
#define DRBD_DISK_FLUSHES_DEF
#define DRBD_DISK_DRAIN_DEF
#define DRBD_MD_FLUSHES_DEF
#define DRBD_TCP_CORK_DEF
#define DRBD_AL_UPDATES_DEF

/* We used to ignore the discard_zeroes_data setting.
 * To not change established (and expected) behaviour,
 * by default assume that, for discard_zeroes_data=0,
 * we can make that an effective discard_zeroes_data=1,
 * if we only explicitly zero-out unaligned partial chunks. */
#define DRBD_DISCARD_ZEROES_IF_ALIGNED_DEF

/* Some backends pretend to support WRITE SAME,
 * but fail such requests when they are actually submitted.
 * This is to tell DRBD to not even try. */
#define DRBD_DISABLE_WRITE_SAME_DEF

#define DRBD_ALLOW_TWO_PRIMARIES_DEF
#define DRBD_ALWAYS_ASBP_DEF
#define DRBD_USE_RLE_DEF
#define DRBD_CSUMS_AFTER_CRASH_ONLY_DEF

#define DRBD_AL_STRIPES_MIN
#define DRBD_AL_STRIPES_MAX
#define DRBD_AL_STRIPES_DEF
#define DRBD_AL_STRIPES_SCALE

#define DRBD_AL_STRIPE_SIZE_MIN
#define DRBD_AL_STRIPE_SIZE_MAX
#define DRBD_AL_STRIPE_SIZE_DEF
#define DRBD_AL_STRIPE_SIZE_SCALE

#define DRBD_SOCKET_CHECK_TIMEO_MIN
#define DRBD_SOCKET_CHECK_TIMEO_MAX
#define DRBD_SOCKET_CHECK_TIMEO_DEF
#define DRBD_SOCKET_CHECK_TIMEO_SCALE

#define DRBD_RS_DISCARD_GRANULARITY_MIN
#define DRBD_RS_DISCARD_GRANULARITY_MAX
#define DRBD_RS_DISCARD_GRANULARITY_DEF
#define DRBD_RS_DISCARD_GRANULARITY_SCALE

#endif