/* Initialize some range of incore rtgroup objects. */ int
xfs_initialize_rtgroups( struct xfs_mount *mp,
xfs_rgnumber_t first_rgno,
xfs_rgnumber_t end_rgno,
xfs_rtbxlen_t rextents)
{
xfs_rgnumber_t index; int error;
if (first_rgno >= end_rgno) return 0;
for (index = first_rgno; index < end_rgno; index++) {
error = xfs_rtgroup_alloc(mp, index, end_rgno, rextents); if (error) goto out_unwind_new_rtgs;
}
/* * Update the rt extent count of the previous tail rtgroup if it changed during * recovery (i.e. recovery of a growfs).
*/ int
xfs_update_last_rtgroup_size( struct xfs_mount *mp,
xfs_rgnumber_t prev_rgcount)
{ struct xfs_rtgroup *rtg;
/* * Join realtime group metadata inodes to the transaction. The ILOCKs will be * released on transaction commit.
*/ void
xfs_rtgroup_trans_join( struct xfs_trans *tp, struct xfs_rtgroup *rtg, unsignedint rtglock_flags)
{
ASSERT(!(rtglock_flags & ~XFS_RTGLOCK_ALL_FLAGS));
ASSERT(!(rtglock_flags & XFS_RTGLOCK_BITMAP_SHARED));
/* * Most of the time each of the RTG inode locks are only taken one at a time. * But when committing deferred ops, more than one of a kind can be taken. * However, deferred rt ops will be committed in rgno order so there is no * potential for deadlocks. The code here is needed to tell lockdep about this * order.
*/ staticinlinevoid
xfs_rtginode_lockdep_setup( struct xfs_inode *ip,
xfs_rgnumber_t rgno, enum xfs_rtg_inodes type)
{
lockdep_set_class_and_subclass(&ip->i_lock, &xfs_rtginode_lock_class,
type);
lock_set_cmp_fn(&ip->i_lock, xfs_rtginode_ilock_cmp_fn,
xfs_rtginode_ilock_print_fn);
} #else #define xfs_rtginode_lockdep_setup(ip, rgno, type) do { } while (0) #endif/* CONFIG_PROVE_LOCKING */
struct xfs_rtginode_ops { constchar *name; /* short name */
enum xfs_metafile_type metafile_type;
unsignedint sick; /* rtgroup sickness flag */
unsignedint fmt_mask; /* all valid data fork formats */
/* Does the fs have this feature? */ bool (*enabled)(conststruct xfs_mount *mp);
/* Create this rtgroup metadata inode and initialize it. */ int (*create)(struct xfs_rtgroup *rtg, struct xfs_inode *ip, struct xfs_trans *tp, bool init);
};
/* Return the shortname of this rtgroup inode. */ constchar *
xfs_rtginode_name( enum xfs_rtg_inodes type)
{ return xfs_rtginode_ops[type].name;
}
/* Return the metafile type of this rtgroup inode. */ enum xfs_metafile_type
xfs_rtginode_metafile_type( enum xfs_rtg_inodes type)
{ return xfs_rtginode_ops[type].metafile_type;
}
/* Should this rtgroup inode be present? */ bool
xfs_rtginode_enabled( struct xfs_rtgroup *rtg, enum xfs_rtg_inodes type)
{ conststruct xfs_rtginode_ops *ops = &xfs_rtginode_ops[type];
if (!ops->enabled) returntrue; return ops->enabled(rtg_mount(rtg));
}
/* Load and existing rtgroup inode into the rtgroup structure. */ int
xfs_rtginode_load( struct xfs_rtgroup *rtg, enum xfs_rtg_inodes type, struct xfs_trans *tp)
{ struct xfs_mount *mp = tp->t_mountp; struct xfs_inode *ip; conststruct xfs_rtginode_ops *ops = &xfs_rtginode_ops[type]; int error;
if (!xfs_rtginode_enabled(rtg, type)) return 0;
if (!xfs_has_rtgroups(mp)) {
xfs_ino_t ino;
switch (type) { case XFS_RTGI_BITMAP:
ino = mp->m_sb.sb_rbmino; break; case XFS_RTGI_SUMMARY:
ino = mp->m_sb.sb_rsumino; break; default: /* None of the other types exist on !rtgroups */ return 0;
}
out_cancel:
xfs_metadir_cancel(&upd, error); /* Have to finish setting up the inode to ensure it's deleted. */ if (upd.ip) {
xfs_finish_inode_setup(upd.ip);
xfs_irele(upd.ip);
}
out_path:
kfree(upd.path); return error;
}
/* Create the parent directory for all rtgroup inodes and load it. */ int
xfs_rtginode_mkdir_parent( struct xfs_mount *mp)
{ if (!mp->m_metadirip) {
xfs_fs_mark_sick(mp, XFS_SICK_FS_METADIR); return -EFSCORRUPTED;
}
/* * The metadata uuid is the fs uuid if the metauuid feature is not * enabled.
*/ if (dsb->sb_features_incompat &
cpu_to_be32(XFS_SB_FEAT_INCOMPAT_META_UUID))
meta_uuid = &dsb->sb_meta_uuid; else
meta_uuid = &dsb->sb_uuid;
memcpy(&rsb->rsb_meta_uuid, meta_uuid, sizeof(rsb->rsb_meta_uuid));
}
/* * Update the realtime superblock from a filesystem superblock and log it to * the given transaction.
*/ struct xfs_buf *
xfs_log_rtsb( struct xfs_trans *tp, conststruct xfs_buf *sb_bp)
{ struct xfs_buf *rtsb_bp;
if (!xfs_has_rtsb(tp->t_mountp)) return NULL;
rtsb_bp = xfs_trans_getrtsb(tp); if (!rtsb_bp) { /* * It's possible for the rtgroups feature to be enabled but * there is no incore rt superblock buffer if the rt geometry * was specified at mkfs time but the rt section has not yet * been attached. In this case, rblocks must be zero.
*/
ASSERT(tp->t_mountp->m_sb.sb_rblocks == 0); return NULL;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.