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

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

Revision 1.29, Tue Aug 8 00:56:24 1995 UTC (22 years, 2 months ago) by rcc
Branch: MAIN
Changes since 1.28: +2 -2 lines

284911 - bump up the inode cluster size to 8K

#ifndef _FS_XFS_IALLOC_H
#define	_FS_XFS_IALLOC_H

#ident	"$Revision: 1.28 $"

struct buf;
struct xfs_mount;
struct xfs_trans;

/*
 * Allocation parameters for inode allocation.
 */
#define	XFS_IALLOC_MAX(a,b)	((a) > (b) ? (a) : (b))
#define	XFS_IALLOC_INODES(mp)	\
	XFS_IALLOC_MAX(XFS_INODES_PER_CHUNK, (mp)->m_sb.sb_inopblock)
#define	XFS_IALLOC_BLOCKS(mp)	\
	(XFS_IALLOC_INODES(mp) >> (mp)->m_sb.sb_inopblog)

/*
 * For small block file systems, move inodes in clusters of this size.
 */
#define	XFS_INODE_CLUSTER_SIZE	8192

/*
 * Make an inode pointer out of the buffer/offset.
 */
#define	XFS_MAKE_IPTR(mp,b,o) \
	((xfs_dinode_t *)((b)->b_un.b_addr + ((o) << (mp)->m_sb.sb_inodelog)))

/*
 * Find a free (set) bit in the inode bitmask.
 */
#define	XFS_IALLOC_FIND_FREE(fp)	xfs_lowbit64(*(fp))

/*
 * Prototypes for visible xfs_ialloc.c routines.
 */

/*
 * Allocate an inode on disk.
 * Mode is used to tell whether the new inode will need space, and whether
 * it is a directory.
 *
 * To work within the constraint of one allocation per transaction,
 * xfs_dialloc() is designed to be called twice if it has to do an
 * allocation to make more free inodes.  If an inode is 
 * available without an allocation, agbp would be set to the current
 * agbp and alloc_done set to false.
 * If an allocation needed to be done, agbp would be set to the
 * inode header of the allocation group and alloc_done set to true.
 * The caller should then commit the current transaction and allocate a new
 * transaction.  xfs_dialloc() should then be called again with
 * the agbp value returned from the previous call.
 *
 * Once we successfully pick an inode its number is returned and the
 * on-disk data structures are updated.  The inode itself is not read
 * in, since doing so would break ordering constraints with xfs_reclaim.
 *
 * *agbp should be set to NULL on the first call, *alloc_done set to FALSE.
 */
int					/* error */
xfs_dialloc(
	struct xfs_trans *tp,		/* transaction pointer */
	xfs_ino_t	parent,		/* parent inode (directory) */
	mode_t		mode,		/* mode bits for new inode */
	struct buf	**agbp,		/* buf for a.g. inode header */
	boolean_t	*alloc_done,	/* an allocation was done to replenish
					   the free inodes */
	xfs_ino_t	*inop);		/* inode number allocated */
#ifndef SIM
/*
 * Free disk inode.  Carefully avoids touching the incore inode, all
 * manipulations incore are the caller's responsibility.
 * The on-disk inode is not changed by this operation, only the
 * btree (free inode mask) is changed.
 */
int					/* error */
xfs_difree(
	struct xfs_trans *tp,		/* transaction pointer */
	xfs_ino_t	inode);		/* inode to be freed */
#endif	/* !SIM */

/*
 * Return the location of the inode in bno/len/off,
 * for mapping it into a buffer.
 */
int
xfs_dilocate(
	struct xfs_mount *mp,		/* file system mount structure */
	struct xfs_trans *tp,		/* transaction pointer */
	xfs_ino_t	ino,		/* inode to locate */
	xfs_fsblock_t	*bno,		/* output: block containing inode */
	int		*len,		/* output: num blocks in cluster*/
	int		*off,		/* output: index in block of inode */
	uint		flags);		/* flags for inode btree lookup */

/*
 * Compute and fill in value of m_in_maxlevels.
 */
void
xfs_ialloc_compute_maxlevels(
	struct xfs_mount *mp);		/* file system mount structure */

/*
 * Log specified fields for the ag hdr (inode section)
 */
void
xfs_ialloc_log_agi(
	struct xfs_trans *tp,		/* transaction pointer */
	struct buf	*bp,		/* allocation group header buffer */
	int		fields);	/* bitmask of fields to log */

/*
 * Read in the allocation group header (inode allocation section)
 */
int					/* error */
xfs_ialloc_read_agi(
	struct xfs_mount *mp,		/* file system mount structure */
	struct xfs_trans *tp,		/* transaction pointer */
	xfs_agnumber_t	agno,		/* allocation group number */
	struct buf	**bpp);		/* allocation group hdr buf */

#endif	/* !_FS_XFS_IALLOC_H */