linux/fs/xfs/xfs_mount.h

// SPDX-License-Identifier: GPL-2.0
/*
 * Copyright (c) 2000-2005 Silicon Graphics, Inc.
 * All Rights Reserved.
 */
#ifndef __XFS_MOUNT_H__
#define __XFS_MOUNT_H__

struct xlog;
struct xfs_inode;
struct xfs_mru_cache;
struct xfs_ail;
struct xfs_quotainfo;
struct xfs_da_geometry;
struct xfs_perag;

/* dynamic preallocation free space thresholds, 5% down to 1% */
enum {};

/*
 * Error Configuration
 *
 * Error classes define the subsystem the configuration belongs to.
 * Error numbers define the errors that are configurable.
 */
enum {};
enum {};

#define XFS_ERR_RETRY_FOREVER

/*
 * Although retry_timeout is in jiffies which is normally an unsigned long,
 * we limit the retry timeout to 86400 seconds, or one day.  So even a
 * signed 32-bit long is sufficient for a HZ value up to 24855.  Making it
 * signed lets us store the special "-1" value, meaning retry forever.
 */
struct xfs_error_cfg {};

/*
 * Per-cpu deferred inode inactivation GC lists.
 */
struct xfs_inodegc {};

/*
 * The struct xfsmount layout is optimised to separate read-mostly variables
 * from variables that are frequently modified. We put the read-mostly variables
 * first, then place all the other variables at the end.
 *
 * Typically, read-mostly variables are those that are set at mount time and
 * never changed again, or only change rarely as a result of things like sysfs
 * knobs being tweaked.
 */
xfs_mount_t;

#define M_IGEO(mp)

/*
 * Flags for m_features.
 *
 * These are all the active features in the filesystem, regardless of how
 * they are configured.
 */
#define XFS_FEAT_ATTR
#define XFS_FEAT_NLINK
#define XFS_FEAT_QUOTA
#define XFS_FEAT_ALIGN
#define XFS_FEAT_DALIGN
#define XFS_FEAT_LOGV2
#define XFS_FEAT_SECTOR
#define XFS_FEAT_EXTFLG
#define XFS_FEAT_ASCIICI
#define XFS_FEAT_LAZYSBCOUNT
#define XFS_FEAT_ATTR2
#define XFS_FEAT_PARENT
#define XFS_FEAT_PROJID32
#define XFS_FEAT_CRC
#define XFS_FEAT_V3INODES
#define XFS_FEAT_PQUOTINO
#define XFS_FEAT_FTYPE
#define XFS_FEAT_FINOBT
#define XFS_FEAT_RMAPBT
#define XFS_FEAT_REFLINK
#define XFS_FEAT_SPINODES
#define XFS_FEAT_META_UUID
#define XFS_FEAT_REALTIME
#define XFS_FEAT_INOBTCNT
#define XFS_FEAT_BIGTIME
#define XFS_FEAT_NEEDSREPAIR
#define XFS_FEAT_NREXT64
#define XFS_FEAT_EXCHANGE_RANGE

/* Mount features */
#define XFS_FEAT_NOATTR2
#define XFS_FEAT_NOALIGN
#define XFS_FEAT_ALLOCSIZE
#define XFS_FEAT_LARGE_IOSIZE
#define XFS_FEAT_WSYNC
#define XFS_FEAT_DIRSYNC
#define XFS_FEAT_DISCARD
#define XFS_FEAT_GRPID
#define XFS_FEAT_SMALL_INUMS
#define XFS_FEAT_IKEEP
#define XFS_FEAT_SWALLOC
#define XFS_FEAT_FILESTREAMS
#define XFS_FEAT_DAX_ALWAYS
#define XFS_FEAT_DAX_NEVER
#define XFS_FEAT_NORECOVERY
#define XFS_FEAT_NOUUID

#define __XFS_HAS_FEAT(name, NAME)

/* Some features can be added dynamically so they need a set wrapper, too. */
#define __XFS_ADD_FEAT(name, NAME)

/* Superblock features */
__XFS_ADD_FEAT()
__XFS_HAS_FEAT()
__XFS_ADD_FEAT()
__XFS_HAS_FEAT()
__XFS_HAS_FEAT()
__XFS_HAS_FEAT()
__XFS_HAS_FEAT()
__XFS_HAS_FEAT()
__XFS_HAS_FEAT()
__XFS_HAS_FEAT()
__XFS_HAS_FEAT()
__XFS_HAS_FEAT()
__XFS_HAS_FEAT()
__XFS_HAS_FEAT()
__XFS_HAS_FEAT()
__XFS_HAS_FEAT()
__XFS_HAS_FEAT()
__XFS_HAS_FEAT()
__XFS_HAS_FEAT()

/*
 * Some features are always on for v5 file systems, allow the compiler to
 * eliminiate dead code when building without v4 support.
 */
#define __XFS_HAS_V4_FEAT(name, NAME)

#define __XFS_ADD_V4_FEAT(name, NAME)

__XFS_HAS_V4_FEAT()
__XFS_HAS_V4_FEAT()
__XFS_HAS_V4_FEAT()
__XFS_HAS_V4_FEAT()
__XFS_ADD_V4_FEAT()
__XFS_ADD_V4_FEAT()
__XFS_HAS_V4_FEAT()
__XFS_HAS_V4_FEAT()
__XFS_HAS_V4_FEAT()

/*
 * Mount features
 *
 * These do not change dynamically - features that can come and go, such as 32
 * bit inodes and read-only state, are kept as operational state rather than
 * features.
 */
__XFS_HAS_FEAT()
__XFS_HAS_FEAT()
__XFS_HAS_FEAT()
__XFS_HAS_FEAT()
__XFS_HAS_FEAT()
__XFS_HAS_FEAT()
__XFS_HAS_FEAT()
__XFS_HAS_FEAT()
__XFS_HAS_FEAT()
__XFS_HAS_FEAT()
__XFS_HAS_FEAT()
__XFS_HAS_FEAT()
__XFS_HAS_FEAT()
__XFS_HAS_FEAT()
__XFS_HAS_FEAT()
__XFS_HAS_FEAT()

/*
 * Operational mount state flags
 *
 * Use these with atomic bit ops only!
 */
#define XFS_OPSTATE_UNMOUNTING
#define XFS_OPSTATE_CLEAN
#define XFS_OPSTATE_SHUTDOWN
#define XFS_OPSTATE_INODE32
#define XFS_OPSTATE_READONLY

/*
 * If set, inactivation worker threads will be scheduled to process queued
 * inodegc work.  If not, queued inodes remain in memory waiting to be
 * processed.
 */
#define XFS_OPSTATE_INODEGC_ENABLED
/*
 * If set, background speculative prealloc gc worker threads will be scheduled
 * to process queued blockgc work.  If not, inodes retain their preallocations
 * until explicitly deleted.
 */
#define XFS_OPSTATE_BLOCKGC_ENABLED

/* Kernel has logged a warning about online fsck being used on this fs. */
#define XFS_OPSTATE_WARNED_SCRUB
/* Kernel has logged a warning about shrink being used on this fs. */
#define XFS_OPSTATE_WARNED_SHRINK
/* Kernel has logged a warning about logged xattr updates being used. */
#define XFS_OPSTATE_WARNED_LARP
/* Mount time quotacheck is running */
#define XFS_OPSTATE_QUOTACHECK_RUNNING
/* Do we want to clear log incompat flags? */
#define XFS_OPSTATE_UNSET_LOG_INCOMPAT
/* Filesystem can use logged extended attributes */
#define XFS_OPSTATE_USE_LARP

#define __XFS_IS_OPSTATE(name, NAME)

__XFS_IS_OPSTATE()
__XFS_IS_OPSTATE()
__XFS_IS_OPSTATE()
__XFS_IS_OPSTATE()
__XFS_IS_OPSTATE()
__XFS_IS_OPSTATE()
__XFS_IS_OPSTATE()
#ifdef CONFIG_XFS_QUOTA
__XFS_IS_OPSTATE()
#else
#define xfs_is_quotacheck_running
#endif
__XFS_IS_OPSTATE()
__XFS_IS_OPSTATE()

static inline bool
xfs_should_warn(struct xfs_mount *mp, long nr)
{}

#define XFS_OPSTATE_STRINGS

/*
 * Max and min values for mount-option defined I/O
 * preallocation sizes.
 */
#define XFS_MAX_IO_LOG
#define XFS_MIN_IO_LOG

void xfs_do_force_shutdown(struct xfs_mount *mp, uint32_t flags, char *fname,
		int lnnum);
#define xfs_force_shutdown(m,f)

#define SHUTDOWN_META_IO_ERROR
#define SHUTDOWN_LOG_IO_ERROR
#define SHUTDOWN_FORCE_UMOUNT
#define SHUTDOWN_CORRUPT_INCORE
#define SHUTDOWN_CORRUPT_ONDISK
#define SHUTDOWN_DEVICE_REMOVED

#define XFS_SHUTDOWN_STRINGS

/*
 * Flags for xfs_mountfs
 */
#define XFS_MFSI_QUIET

static inline xfs_agnumber_t
xfs_daddr_to_agno(struct xfs_mount *mp, xfs_daddr_t d)
{}

static inline xfs_agblock_t
xfs_daddr_to_agbno(struct xfs_mount *mp, xfs_daddr_t d)
{}

extern void	xfs_uuid_table_free(void);
extern uint64_t xfs_default_resblks(xfs_mount_t *mp);
extern int	xfs_mountfs(xfs_mount_t *mp);
extern void	xfs_unmountfs(xfs_mount_t *);

/*
 * Deltas for the block count can vary from 1 to very large, but lock contention
 * only occurs on frequent small block count updates such as in the delayed
 * allocation path for buffered writes (page a time updates). Hence we set
 * a large batch count (1024) to minimise global counter updates except when
 * we get near to ENOSPC and we have to be very accurate with our updates.
 */
#define XFS_FDBLOCKS_BATCH

/*
 * Estimate the amount of free space that is not available to userspace and is
 * not explicitly reserved from the incore fdblocks.  This includes:
 *
 * - The minimum number of blocks needed to support splitting a bmap btree
 * - The blocks currently in use by the freespace btrees because they record
 *   the actual blocks that will fill per-AG metadata space reservations
 */
static inline uint64_t
xfs_fdblocks_unavailable(
	struct xfs_mount	*mp)
{}

int xfs_dec_freecounter(struct xfs_mount *mp, struct percpu_counter *counter,
		uint64_t delta, bool rsvd);
void xfs_add_freecounter(struct xfs_mount *mp, struct percpu_counter *counter,
		uint64_t delta);

static inline int xfs_dec_fdblocks(struct xfs_mount *mp, uint64_t delta,
		bool reserved)
{}

static inline void xfs_add_fdblocks(struct xfs_mount *mp, uint64_t delta)
{}

static inline int xfs_dec_frextents(struct xfs_mount *mp, uint64_t delta)
{}

static inline void xfs_add_frextents(struct xfs_mount *mp, uint64_t delta)
{}

extern int	xfs_readsb(xfs_mount_t *, int);
extern void	xfs_freesb(xfs_mount_t *);
extern bool	xfs_fs_writable(struct xfs_mount *mp, int level);
extern int	xfs_sb_validate_fsb_count(struct xfs_sb *, uint64_t);

extern int	xfs_dev_is_read_only(struct xfs_mount *, char *);

extern void	xfs_set_low_space_thresholds(struct xfs_mount *);

int	xfs_zero_extent(struct xfs_inode *ip, xfs_fsblock_t start_fsb,
			xfs_off_t count_fsb);

struct xfs_error_cfg * xfs_error_get_cfg(struct xfs_mount *mp,
		int error_class, int error);
void xfs_force_summary_recalc(struct xfs_mount *mp);
int xfs_add_incompat_log_feature(struct xfs_mount *mp, uint32_t feature);
bool xfs_clear_incompat_log_features(struct xfs_mount *mp);
void xfs_mod_delalloc(struct xfs_inode *ip, int64_t data_delta,
		int64_t ind_delta);

#endif	/* __XFS_MOUNT_H__ */