[BACK]Return to xfs_rtalloc.h CVS log [TXT][DIR] Up to [Development] / xfs-linux-nodel

File: [Development] / xfs-linux-nodel / xfs_rtalloc.h (download)

Revision 1.11, Tue Oct 31 06:13:30 1995 UTC (21 years, 11 months ago) by ack
Branch: MAIN
Changes since 1.10: +2 -10 lines

auto-merge of changes from /proj/banyan/isms/irix/kern/fs/xfs/RCS/xfs_rtalloc.h,v
> ----------------------------
> revision 1.12
> date: 1995/10/31 00:18:00;  author: doucette;  state: Exp;  lines: +0 -9
> Remove XFS_RTWORD_LL define's uses, it's always FALSE now.
> The idea won't work on big-endian machines with the bit numbering
> this code uses.
> ----------------------------
> revision 1.11
> date: 1995/10/26 22:41:47;  author: doucette;  state: Exp;  lines: +2 -1
> Add a define for default rt extsize.
> =============================================================================

#ifndef _FS_XFS_RTALLOC_H
#define	_FS_XFS_RTALLOC_H

#ident	"$Revision$"

struct xfs_mount;
struct xfs_trans;

/* Min and max rt extent sizes, specified in bytes */
#define	XFS_MAX_RTEXTSIZE	(1024 * 1024 * 1024)	/* 1GB */
#define	XFS_DFL_RTEXTSIZE	(64 * 1024)	        /* 64KB */
#define	XFS_MIN_RTEXTSIZE	(4 * 1024)		/* 4KB */

/*
 * Constants for bit manipulations.
 */
#define	XFS_NBBYLOG	3		/* log2(NBBY) */
#define	XFS_WORDLOG	2		/* log2(sizeof(xfs_rtword_t)) */
#define	XFS_NBWORDLOG	(XFS_NBBYLOG + XFS_WORDLOG)
#define	XFS_NBWORD	(1 << XFS_NBWORDLOG)
#define	XFS_WORDMASK	((1 << XFS_WORDLOG) - 1)

#define	XFS_BLOCKSIZE(mp)	((mp)->m_sb.sb_blocksize)
#define	XFS_BLOCKMASK(mp)	((mp)->m_blockmask)
#define	XFS_BLOCKWSIZE(mp)	((mp)->m_blockwsize)
#define	XFS_BLOCKWMASK(mp)	((mp)->m_blockwmask)

/*
 * Summary and bit manipulation macros.
 */
#define	XFS_SUMOFFS(mp,ls,bb)	((ls) * (mp)->m_sb.sb_rbmblocks + (bb))
#define	XFS_SUMOFFSTOBLOCK(mp,s)	\
	(((s) * sizeof(xfs_suminfo_t)) >> (mp)->m_sb.sb_blocklog)
#define	XFS_SUMPTR(mp,bp,so)	\
	((xfs_suminfo_t *)((char *)bp->b_un.b_addr + \
		(((so) * sizeof(xfs_suminfo_t)) & XFS_BLOCKMASK(mp))))

#define	XFS_BITTOBLOCK(mp,bi)	((bi) >> (mp)->m_blkbit_log)
#define	XFS_BLOCKTOBIT(mp,bb)	((bb) << (mp)->m_blkbit_log)
#define	XFS_BITTOWORD(mp,bi)	(((bi) >> XFS_NBWORDLOG) & XFS_BLOCKWMASK(mp))

#define	XFS_RTMIN(a,b)	((a) < (b) ? (a) : (b))
#define	XFS_RTMAX(a,b)	((a) > (b) ? (a) : (b))

#define	XFS_RTLOBIT(w)	xfs_lowbit32(w)
#define	XFS_RTHIBIT(w)	xfs_highbit32(w)

#if XFS_BIG_FILESYSTEMS
#define	XFS_RTBLOCKLOG(b)	xfs_highbit64(b)
#else
#define	XFS_RTBLOCKLOG(b)	xfs_highbit32(b)
#endif

/*
 * Function prototypes for exported functions.
 */

#ifndef SIM
/*
 * Allocate an extent in the realtime subvolume, with the usual allocation
 * parameters.  The length units are all in realtime extents, as is the
 * result block number.
 */
int					/* error */
xfs_rtallocate_extent(
	struct xfs_trans	*tp,	/* transaction pointer */
	xfs_rtblock_t		bno,	/* starting block number to allocate */
	xfs_extlen_t		minlen,	/* minimum length to allocate */
	xfs_extlen_t		maxlen,	/* maximum length to allocate */
	xfs_extlen_t		*len,	/* out: actual length allocated */
	xfs_alloctype_t		type,	/* allocation type XFS_ALLOCTYPE... */
	int			wasdel,	/* was a delayed allocation extent */
	xfs_extlen_t		prod,	/* extent product factor */
	xfs_rtblock_t		*rtblock); /* out: start block allocated */
#endif	/* !SIM */

/*
 * Free an extent in the realtime subvolume.  Length is expressed in
 * realtime extents, as is the block number.
 */
int					/* error */
xfs_rtfree_extent(
	struct xfs_trans	*tp,	/* transaction pointer */
	xfs_rtblock_t		bno,	/* starting block number to free */
	xfs_extlen_t		len);	/* length of extent freed */

#ifdef XFSDEBUG
/*
 * Debug code: print out the value of a range in the bitmap.
 */
void
xfs_rtprint_range(
	struct xfs_mount	*mp,	/* file system mount structure */
	struct xfs_trans	*tp,	/* transaction pointer */
	xfs_rtblock_t		start,	/* starting block to print */
	xfs_extlen_t		len);	/* length to print */

/*
 * Debug code: print the summary file.
 */
void
xfs_rtprint_summary(
	struct xfs_mount	*mp,	/* file system mount structure */
	struct xfs_trans	*tp);	/* transaction pointer */
#endif	/* XFSDEBUG */

#endif	/* !_FS_XFS_RTALLOC_H */