4186 rcu_read_lock();
4187 list_for_each_entry_rcu(tmp_pa, &lg->lg_prealloc_list[order],
4188 pa_inode_list) {
4189 spin_lock(&tmp_pa->pa_lock);
4190 if (tmp_pa->pa_deleted) {
4191 spin_unlock(&pa->pa_lock);
4192 continue;
4193 }
4194 if (!added && pa->pa_free < tmp_pa->pa_free) {
4195
4196 list_add_tail_rcu(&pa->pa_inode_list,
4197 &tmp_pa->pa_inode_list);
4198 added = 1;
4199
4200
4201
4202
4203 }
4204 spin_unlock(&tmp_pa->pa_lock);
4205 lg_prealloc_count++;
4206 }
4207 if (!added)
4208 list_add_tail_rcu(&pa->pa_inode_list,
4209 &lg->lg_prealloc_list[order]);
4210 rcu_read_unlock();
4211
4212
4213 if (lg_prealloc_count > 8) {
4214 ext4_mb_discard_lg_preallocations(sb, lg,
4215 order, lg_prealloc_count);
4216 return;
4217 }
4218 return ;
4219}
4220
4221
4222
4223
4224static int ext4_mb_release_context(struct ext4_allocation_context *ac)
4225{
4226 struct ext4_prealloc_space *pa = ac->ac_pa;