ext4: reorganize if statement of ext4_mb_release_context()
Reorganize the if statement of ext4_mb_release_context(), make it easier to read. Signed-off-by: Chunguang Xu <brookxu@tencent.com> Link: https://lore.kernel.org/r/5439ac6f-db79-ad68-76c1-a4dda9aa0cc3@gmail.com Reviewed-by: Ritesh Harjani <riteshh@linux.ibm.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
This commit is contained in:
parent
c55ee7d202
commit
66d5e0277e
@ -2309,7 +2309,7 @@ ext4_mb_regular_allocator(struct ext4_allocation_context *ac)
|
|||||||
struct ext4_sb_info *sbi;
|
struct ext4_sb_info *sbi;
|
||||||
struct super_block *sb;
|
struct super_block *sb;
|
||||||
struct ext4_buddy e4b;
|
struct ext4_buddy e4b;
|
||||||
unsigned int lost;
|
int lost;
|
||||||
|
|
||||||
sb = ac->ac_sb;
|
sb = ac->ac_sb;
|
||||||
sbi = EXT4_SB(sb);
|
sbi = EXT4_SB(sb);
|
||||||
@ -2464,8 +2464,8 @@ repeat:
|
|||||||
* The only thing we can do is just take first
|
* The only thing we can do is just take first
|
||||||
* found block(s)
|
* found block(s)
|
||||||
*/
|
*/
|
||||||
lost = (unsigned int)atomic_inc_return(&sbi->s_mb_lost_chunks);
|
lost = atomic_inc_return(&sbi->s_mb_lost_chunks);
|
||||||
mb_debug(sb, "lost chunk, group: %u, start: %d, len: %d, lost: %u\n",
|
mb_debug(sb, "lost chunk, group: %u, start: %d, len: %d, lost: %d\n",
|
||||||
ac->ac_b_ex.fe_group, ac->ac_b_ex.fe_start,
|
ac->ac_b_ex.fe_group, ac->ac_b_ex.fe_start,
|
||||||
ac->ac_b_ex.fe_len, lost);
|
ac->ac_b_ex.fe_len, lost);
|
||||||
|
|
||||||
@ -4706,20 +4706,19 @@ static int ext4_mb_release_context(struct ext4_allocation_context *ac)
|
|||||||
pa->pa_free -= ac->ac_b_ex.fe_len;
|
pa->pa_free -= ac->ac_b_ex.fe_len;
|
||||||
pa->pa_len -= ac->ac_b_ex.fe_len;
|
pa->pa_len -= ac->ac_b_ex.fe_len;
|
||||||
spin_unlock(&pa->pa_lock);
|
spin_unlock(&pa->pa_lock);
|
||||||
}
|
|
||||||
}
|
/*
|
||||||
if (pa) {
|
* We want to add the pa to the right bucket.
|
||||||
/*
|
* Remove it from the list and while adding
|
||||||
* We want to add the pa to the right bucket.
|
* make sure the list to which we are adding
|
||||||
* Remove it from the list and while adding
|
* doesn't grow big.
|
||||||
* make sure the list to which we are adding
|
*/
|
||||||
* doesn't grow big.
|
if (likely(pa->pa_free)) {
|
||||||
*/
|
spin_lock(pa->pa_obj_lock);
|
||||||
if ((pa->pa_type == MB_GROUP_PA) && likely(pa->pa_free)) {
|
list_del_rcu(&pa->pa_inode_list);
|
||||||
spin_lock(pa->pa_obj_lock);
|
spin_unlock(pa->pa_obj_lock);
|
||||||
list_del_rcu(&pa->pa_inode_list);
|
ext4_mb_add_n_trim(ac);
|
||||||
spin_unlock(pa->pa_obj_lock);
|
}
|
||||||
ext4_mb_add_n_trim(ac);
|
|
||||||
}
|
}
|
||||||
ext4_mb_put_pa(ac, ac->ac_sb, pa);
|
ext4_mb_put_pa(ac, ac->ac_sb, pa);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user