0001
0002
0003
0004
0005
0006 #ifndef __XFS_IALLOC_H__
0007 #define __XFS_IALLOC_H__
0008
0009 struct xfs_buf;
0010 struct xfs_dinode;
0011 struct xfs_imap;
0012 struct xfs_mount;
0013 struct xfs_trans;
0014 struct xfs_btree_cur;
0015
0016
0017 #define XFS_INODE_BIG_CLUSTER_SIZE 8192
0018
0019 struct xfs_icluster {
0020 bool deleted;
0021 xfs_ino_t first_ino;
0022 uint64_t alloc;
0023
0024 };
0025
0026
0027
0028
0029 static inline struct xfs_dinode *
0030 xfs_make_iptr(struct xfs_mount *mp, struct xfs_buf *b, int o)
0031 {
0032 return xfs_buf_offset(b, o << (mp)->m_sb.sb_inodelog);
0033 }
0034
0035
0036
0037
0038
0039 int xfs_dialloc(struct xfs_trans **tpp, xfs_ino_t parent, umode_t mode,
0040 xfs_ino_t *new_ino);
0041
0042 int xfs_difree(struct xfs_trans *tp, struct xfs_perag *pag,
0043 xfs_ino_t ino, struct xfs_icluster *ifree);
0044
0045
0046
0047
0048 int
0049 xfs_imap(
0050 struct xfs_mount *mp,
0051 struct xfs_trans *tp,
0052 xfs_ino_t ino,
0053 struct xfs_imap *imap,
0054 uint flags);
0055
0056
0057
0058
0059 void
0060 xfs_ialloc_log_agi(
0061 struct xfs_trans *tp,
0062 struct xfs_buf *bp,
0063 uint32_t fields);
0064
0065 int xfs_read_agi(struct xfs_perag *pag, struct xfs_trans *tp,
0066 struct xfs_buf **agibpp);
0067 int xfs_ialloc_read_agi(struct xfs_perag *pag, struct xfs_trans *tp,
0068 struct xfs_buf **agibpp);
0069
0070
0071
0072
0073 int xfs_inobt_lookup(struct xfs_btree_cur *cur, xfs_agino_t ino,
0074 xfs_lookup_t dir, int *stat);
0075
0076
0077
0078
0079 int xfs_inobt_get_rec(struct xfs_btree_cur *cur,
0080 xfs_inobt_rec_incore_t *rec, int *stat);
0081
0082
0083
0084
0085 int xfs_ialloc_inode_init(struct xfs_mount *mp, struct xfs_trans *tp,
0086 struct list_head *buffer_list, int icount,
0087 xfs_agnumber_t agno, xfs_agblock_t agbno,
0088 xfs_agblock_t length, unsigned int gen);
0089
0090
0091 union xfs_btree_rec;
0092 void xfs_inobt_btrec_to_irec(struct xfs_mount *mp,
0093 const union xfs_btree_rec *rec,
0094 struct xfs_inobt_rec_incore *irec);
0095 int xfs_ialloc_has_inodes_at_extent(struct xfs_btree_cur *cur,
0096 xfs_agblock_t bno, xfs_extlen_t len, bool *exists);
0097 int xfs_ialloc_has_inode_record(struct xfs_btree_cur *cur, xfs_agino_t low,
0098 xfs_agino_t high, bool *exists);
0099 int xfs_ialloc_count_inodes(struct xfs_btree_cur *cur, xfs_agino_t *count,
0100 xfs_agino_t *freecount);
0101 int xfs_inobt_insert_rec(struct xfs_btree_cur *cur, uint16_t holemask,
0102 uint8_t count, int32_t freecount, xfs_inofree_t free,
0103 int *stat);
0104
0105 int xfs_ialloc_cluster_alignment(struct xfs_mount *mp);
0106 void xfs_ialloc_setup_geometry(struct xfs_mount *mp);
0107 xfs_ino_t xfs_ialloc_calc_rootino(struct xfs_mount *mp, int sunit);
0108
0109 int xfs_ialloc_check_shrink(struct xfs_trans *tp, xfs_agnumber_t agno,
0110 struct xfs_buf *agibp, xfs_agblock_t new_length);
0111
0112 #endif