diff options
author | Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> | 2008-04-17 10:38:59 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2008-04-17 10:38:59 -0400 |
commit | 9a0762c5af40e4aa64fef999967459c98e6ae4c9 (patch) | |
tree | a674077f5a3b840e31f0706d074e01fa4dd18abc /fs | |
parent | 4ddfef7b41aebbbede73f361cb938800ba3072dc (diff) |
ext4: Convert list_for_each_rcu() to list_for_each_entry_rcu()
The list_for_each_entry_rcu() primitive should be used instead of
list_for_each_rcu(), as the former is easier to use and provides
better type safety.
http://groups.google.com/group/linux.kernel/browse_thread/thread/45749c83451cebeb/0633a65759ce7713?lnk=raot
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Roel Kluin <12o3l@tiscali.nl>
Signed-off-by: Mingming Cao <cmm@us.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ext4/mballoc.c | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index 66e1451f64e7..aaaccf5986f9 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c | |||
@@ -3149,10 +3149,10 @@ ext4_mb_normalize_request(struct ext4_allocation_context *ac, | |||
3149 | { | 3149 | { |
3150 | int bsbits, max; | 3150 | int bsbits, max; |
3151 | ext4_lblk_t end; | 3151 | ext4_lblk_t end; |
3152 | struct list_head *cur; | ||
3153 | loff_t size, orig_size, start_off; | 3152 | loff_t size, orig_size, start_off; |
3154 | ext4_lblk_t start, orig_start; | 3153 | ext4_lblk_t start, orig_start; |
3155 | struct ext4_inode_info *ei = EXT4_I(ac->ac_inode); | 3154 | struct ext4_inode_info *ei = EXT4_I(ac->ac_inode); |
3155 | struct ext4_prealloc_space *pa; | ||
3156 | 3156 | ||
3157 | /* do normalize only data requests, metadata requests | 3157 | /* do normalize only data requests, metadata requests |
3158 | do not need preallocation */ | 3158 | do not need preallocation */ |
@@ -3238,12 +3238,9 @@ ext4_mb_normalize_request(struct ext4_allocation_context *ac, | |||
3238 | 3238 | ||
3239 | /* check we don't cross already preallocated blocks */ | 3239 | /* check we don't cross already preallocated blocks */ |
3240 | rcu_read_lock(); | 3240 | rcu_read_lock(); |
3241 | list_for_each_rcu(cur, &ei->i_prealloc_list) { | 3241 | list_for_each_entry_rcu(pa, &ei->i_prealloc_list, pa_inode_list) { |
3242 | struct ext4_prealloc_space *pa; | ||
3243 | unsigned long pa_end; | 3242 | unsigned long pa_end; |
3244 | 3243 | ||
3245 | pa = list_entry(cur, struct ext4_prealloc_space, pa_inode_list); | ||
3246 | |||
3247 | if (pa->pa_deleted) | 3244 | if (pa->pa_deleted) |
3248 | continue; | 3245 | continue; |
3249 | spin_lock(&pa->pa_lock); | 3246 | spin_lock(&pa->pa_lock); |
@@ -3285,10 +3282,8 @@ ext4_mb_normalize_request(struct ext4_allocation_context *ac, | |||
3285 | 3282 | ||
3286 | /* XXX: extra loop to check we really don't overlap preallocations */ | 3283 | /* XXX: extra loop to check we really don't overlap preallocations */ |
3287 | rcu_read_lock(); | 3284 | rcu_read_lock(); |
3288 | list_for_each_rcu(cur, &ei->i_prealloc_list) { | 3285 | list_for_each_entry_rcu(pa, &ei->i_prealloc_list, pa_inode_list) { |
3289 | struct ext4_prealloc_space *pa; | ||
3290 | unsigned long pa_end; | 3286 | unsigned long pa_end; |
3291 | pa = list_entry(cur, struct ext4_prealloc_space, pa_inode_list); | ||
3292 | spin_lock(&pa->pa_lock); | 3287 | spin_lock(&pa->pa_lock); |
3293 | if (pa->pa_deleted == 0) { | 3288 | if (pa->pa_deleted == 0) { |
3294 | pa_end = pa->pa_lstart + pa->pa_len; | 3289 | pa_end = pa->pa_lstart + pa->pa_len; |
@@ -3416,7 +3411,6 @@ ext4_mb_use_preallocated(struct ext4_allocation_context *ac) | |||
3416 | struct ext4_inode_info *ei = EXT4_I(ac->ac_inode); | 3411 | struct ext4_inode_info *ei = EXT4_I(ac->ac_inode); |
3417 | struct ext4_locality_group *lg; | 3412 | struct ext4_locality_group *lg; |
3418 | struct ext4_prealloc_space *pa; | 3413 | struct ext4_prealloc_space *pa; |
3419 | struct list_head *cur; | ||
3420 | 3414 | ||
3421 | /* only data can be preallocated */ | 3415 | /* only data can be preallocated */ |
3422 | if (!(ac->ac_flags & EXT4_MB_HINT_DATA)) | 3416 | if (!(ac->ac_flags & EXT4_MB_HINT_DATA)) |
@@ -3424,8 +3418,7 @@ ext4_mb_use_preallocated(struct ext4_allocation_context *ac) | |||
3424 | 3418 | ||
3425 | /* first, try per-file preallocation */ | 3419 | /* first, try per-file preallocation */ |
3426 | rcu_read_lock(); | 3420 | rcu_read_lock(); |
3427 | list_for_each_rcu(cur, &ei->i_prealloc_list) { | 3421 | list_for_each_entry_rcu(pa, &ei->i_prealloc_list, pa_inode_list) { |
3428 | pa = list_entry(cur, struct ext4_prealloc_space, pa_inode_list); | ||
3429 | 3422 | ||
3430 | /* all fields in this condition don't change, | 3423 | /* all fields in this condition don't change, |
3431 | * so we can skip locking for them */ | 3424 | * so we can skip locking for them */ |
@@ -3457,8 +3450,7 @@ ext4_mb_use_preallocated(struct ext4_allocation_context *ac) | |||
3457 | return 0; | 3450 | return 0; |
3458 | 3451 | ||
3459 | rcu_read_lock(); | 3452 | rcu_read_lock(); |
3460 | list_for_each_rcu(cur, &lg->lg_prealloc_list) { | 3453 | list_for_each_entry_rcu(pa, &lg->lg_prealloc_list, pa_inode_list) { |
3461 | pa = list_entry(cur, struct ext4_prealloc_space, pa_inode_list); | ||
3462 | spin_lock(&pa->pa_lock); | 3454 | spin_lock(&pa->pa_lock); |
3463 | if (pa->pa_deleted == 0 && pa->pa_free >= ac->ac_o_ex.fe_len) { | 3455 | if (pa->pa_deleted == 0 && pa->pa_free >= ac->ac_o_ex.fe_len) { |
3464 | atomic_inc(&pa->pa_count); | 3456 | atomic_inc(&pa->pa_count); |