ext4: reorganize if statement of ext4_mb_release_context()
PATCH v2 1/3 ext4: reorganize if statement of ext4_mb_release_context()
Reorganize the if statement of ext4_mb_release_context(), make it easier to read.
---
fs/ext4/mballoc.c | 27 +++++++++++++--------------
1 file changed, 13 insertions(+), 14 deletions(-)
fs/ext4/mballoc.c +0 -0
@@ -4564,20 +4564,19 @@ static int ext4_mb_release_context(struct ext4_allocation_context *ac)
pa->pa_free -= ac->ac_b_ex.fe_len; pa->pa_len -= ac->ac_b_ex.fe_len; 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
- * make sure the list to which we are adding
- * doesn't grow big.
- */
- if ((pa->pa_type == MB_GROUP_PA) && likely(pa->pa_free)) { - spin_lock(pa->pa_obj_lock);
- list_del_rcu(&pa->pa_inode_list);
- spin_unlock(pa->pa_obj_lock);
- ext4_mb_add_n_trim(ac);
+
+ /*
+ * We want to add the pa to the right bucket. + * Remove it from the list and while adding + * make sure the list to which we are adding + * doesn't grow big.
+ */
+ if (likely(pa->pa_free)) {
+ spin_lock(pa->pa_obj_lock);
+ list_del_rcu(&pa->pa_inode_list);
+ spin_unlock(pa->pa_obj_lock);
+ ext4_mb_add_n_trim(ac);
+ }
}
ext4_mb_put_pa(ac, ac->ac_sb, pa);
}
Signature · 1 line
1.8.3.1
Quoted 5 lines · brookxu
Reorganize the if statement of
ext4_mb_release_context(), make it easier to read.Signed-off-by Chunguang Xu <[email protected]>
Quoted 44 lines
--- fs/ext4/mballoc.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-)fs/ext4/mballoc.c +13
-15@@ -4564,20 +4564,19 @@ static int ext4_mb_release_context(struct ext4_allocation_context *ac) pa->pa_free -= ac->ac_b_ex.fe_len; pa->pa_len -= ac->ac_b_ex.fe_len;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 -* make sure the list to which we are adding -* doesn't grow big. -*/ -if ((pa->pa_type ==MB_GROUP_PA ) &&likely (pa->pa_free)) { -spin_lock (pa->pa_obj_lock); -list_del_rcu (&pa->pa_inode_list); -spin_unlock (pa->pa_obj_lock); -ext4_mb_add_n_trim (ac); + +/* +* We want to add the pa to the right bucket. +* Remove it from the list and while adding +* make sure the list to which we are adding +* doesn't grow big. +*/ +if (likely (pa->pa_free)) { +spin_lock (pa->pa_obj_lock); +list_del_rcu (&pa->pa_inode_list); +spin_unlock (pa->pa_obj_lock); +ext4_mb_add_n_trim (ac); + } }ext4_mb_put_pa (ac, ac->ac_sb, pa); } --
Quoted 2 lines
1.8.3.1
Cheers, Andreas