linux/fs/xfs/libxfs/xfs_trans_resv.h

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

struct xfs_mount;

/*
 * structure for maintaining pre-calculated transaction reservations.
 */
struct xfs_trans_res {};

struct xfs_trans_resv {};

/* shorthand way of accessing reservation structure */
#define M_RES(mp)

/*
 * Per-directory log reservation for any directory change.
 * dir blocks: (1 btree block per level + data block + free block) * dblock size
 * bmap btree: (levels + 2) * max depth * block size
 * v2 directory blocks can be fragmented below the dirblksize down to the fsb
 * size, so account for that in the DAENTER macros.
 */
#define XFS_DIROP_LOG_RES(mp)
#define XFS_DIROP_LOG_COUNT(mp)

/*
 * Various log count values.
 */
#define XFS_DEFAULT_LOG_COUNT
#define XFS_DEFAULT_PERM_LOG_COUNT
#define XFS_ITRUNCATE_LOG_COUNT
#define XFS_INACTIVE_LOG_COUNT
#define XFS_CREATE_LOG_COUNT
#define XFS_CREATE_TMPFILE_LOG_COUNT
#define XFS_MKDIR_LOG_COUNT
#define XFS_SYMLINK_LOG_COUNT
#define XFS_REMOVE_LOG_COUNT
#define XFS_LINK_LOG_COUNT
#define XFS_RENAME_LOG_COUNT
#define XFS_WRITE_LOG_COUNT
#define XFS_ADDAFORK_LOG_COUNT
#define XFS_ATTRINVAL_LOG_COUNT
#define XFS_ATTRSET_LOG_COUNT
#define XFS_ATTRRM_LOG_COUNT

/*
 * Original log operation counts were overestimated in the early days of
 * reflink.  These are retained here purely for minimum log size calculations
 * and must not be used for runtime reservations.
 */
#define XFS_ITRUNCATE_LOG_COUNT_REFLINK
#define XFS_WRITE_LOG_COUNT_REFLINK

void xfs_trans_resv_calc(struct xfs_mount *mp, struct xfs_trans_resv *resp);
uint xfs_allocfree_block_count(struct xfs_mount *mp, uint num_ops);

unsigned int xfs_calc_itruncate_reservation_minlogsize(struct xfs_mount *mp);
unsigned int xfs_calc_write_reservation_minlogsize(struct xfs_mount *mp);
unsigned int xfs_calc_qm_dqalloc_reservation_minlogsize(struct xfs_mount *mp);

#endif	/* __XFS_TRANS_RESV_H__ */