erst_record_id_cache
static struct erst_record_id_cache erst_record_id_cache = {
.lock = __MUTEX_INITIALIZER(erst_record_id_cache.lock),
rc = mutex_lock_interruptible(&erst_record_id_cache.lock);
erst_record_id_cache.refcount++;
mutex_unlock(&erst_record_id_cache.lock);
entries = erst_record_id_cache.entries;
for (i = 0; i < erst_record_id_cache.len; i++) {
if (i < erst_record_id_cache.len)
if (erst_record_id_cache.len >= erst_record_id_cache.size) {
new_size = erst_record_id_cache.size * 2;
if (new_size <= erst_record_id_cache.size) {
erst_record_id_cache.len * sizeof(entries[0]));
erst_record_id_cache.entries = entries = new_entries;
erst_record_id_cache.size = new_size;
erst_record_id_cache.len++;
BUG_ON(!erst_record_id_cache.refcount);
BUG_ON(*pos < 0 || *pos > erst_record_id_cache.len);
mutex_lock(&erst_record_id_cache.lock);
entries = erst_record_id_cache.entries;
for (; *pos < erst_record_id_cache.len; (*pos)++)
if (*pos < erst_record_id_cache.len) {
*record_id = erst_record_id_cache.entries[*pos];
mutex_unlock(&erst_record_id_cache.lock);
if (erst_record_id_cache.refcount)
entries = erst_record_id_cache.entries;
for (i = 0; i < erst_record_id_cache.len; i++) {
erst_record_id_cache.len = wpos;
mutex_lock(&erst_record_id_cache.lock);
erst_record_id_cache.refcount--;
BUG_ON(erst_record_id_cache.refcount < 0);
mutex_unlock(&erst_record_id_cache.lock);
mutex_lock(&erst_record_id_cache.lock);
entries = erst_record_id_cache.entries;
for (i = 0; i < erst_record_id_cache.len; i++) {
mutex_unlock(&erst_record_id_cache.lock);
rc = mutex_lock_interruptible(&erst_record_id_cache.lock);
entries = erst_record_id_cache.entries;
for (i = 0; i < erst_record_id_cache.len; i++) {
mutex_unlock(&erst_record_id_cache.lock);