/* * Groups can have passive and active references. * * For passive references the code freeing a group is responsible for cleaning * up objects that hold the passive references (e.g. cached buffers). * Routines manipulating passive references are xfs_group_get, xfs_group_hold * and xfs_group_put. * * Active references are for short term access to the group for walking trees or * accessing state. If a group is being shrunk or offlined, the lookup will fail * to find that group and return NULL instead. * Routines manipulating active references are xfs_group_grab and * xfs_group_rele.
*/
rcu_read_lock();
xg = xa_load(&mp->m_groups[type].xa, index); if (xg) {
trace_xfs_group_grab(xg, _RET_IP_); if (!atomic_inc_not_zero(&xg->xg_active_ref))
xg = NULL;
}
rcu_read_unlock(); return xg;
}
/* * Iterate to the next group. To start the iteration at @start_index, a %NULL * @xg is passed, else the previous group returned from this function. The * caller should break out of the loop when this returns %NULL. If the caller * wants to break out of a loop that did not finish it needs to release the * active reference to @xg using xfs_group_rele() itself.
*/ struct xfs_group *
xfs_group_next_range( struct xfs_mount *mp, struct xfs_group *xg,
uint32_t start_index,
uint32_t end_index, enum xfs_group_type type)
{
uint32_t index = start_index;
if (xg) {
index = xg->xg_gno + 1;
xfs_group_rele(xg);
} if (index > end_index) return NULL; return xfs_group_grab(mp, index, type);
}
/* * Find the next group after @xg, or the first group if @xg is NULL.
*/ struct xfs_group *
xfs_group_grab_next_mark( struct xfs_mount *mp, struct xfs_group *xg,
xa_mark_t mark, enum xfs_group_type type)
{ unsignedlong index = 0;
if (xg) {
index = xg->xg_gno + 1;
xfs_group_rele(xg);
}
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.