Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 95037
b: refs/heads/master
c: 9a0762c
h: refs/heads/master
i:
  95035: db7d756
v: v3
  • Loading branch information
Aneesh Kumar K.V authored and Theodore Ts'o committed Apr 17, 2008
1 parent b737321 commit 4a3ba3d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4ddfef7b41aebbbede73f361cb938800ba3072dc
refs/heads/master: 9a0762c5af40e4aa64fef999967459c98e6ae4c9
18 changes: 5 additions & 13 deletions trunk/fs/ext4/mballoc.c
Original file line number Diff line number Diff line change
Expand Up @@ -3149,10 +3149,10 @@ ext4_mb_normalize_request(struct ext4_allocation_context *ac,
{
int bsbits, max;
ext4_lblk_t end;
struct list_head *cur;
loff_t size, orig_size, start_off;
ext4_lblk_t start, orig_start;
struct ext4_inode_info *ei = EXT4_I(ac->ac_inode);
struct ext4_prealloc_space *pa;

/* do normalize only data requests, metadata requests
do not need preallocation */
Expand Down Expand Up @@ -3238,12 +3238,9 @@ ext4_mb_normalize_request(struct ext4_allocation_context *ac,

/* check we don't cross already preallocated blocks */
rcu_read_lock();
list_for_each_rcu(cur, &ei->i_prealloc_list) {
struct ext4_prealloc_space *pa;
list_for_each_entry_rcu(pa, &ei->i_prealloc_list, pa_inode_list) {
unsigned long pa_end;

pa = list_entry(cur, struct ext4_prealloc_space, pa_inode_list);

if (pa->pa_deleted)
continue;
spin_lock(&pa->pa_lock);
Expand Down Expand Up @@ -3285,10 +3282,8 @@ ext4_mb_normalize_request(struct ext4_allocation_context *ac,

/* XXX: extra loop to check we really don't overlap preallocations */
rcu_read_lock();
list_for_each_rcu(cur, &ei->i_prealloc_list) {
struct ext4_prealloc_space *pa;
list_for_each_entry_rcu(pa, &ei->i_prealloc_list, pa_inode_list) {
unsigned long pa_end;
pa = list_entry(cur, struct ext4_prealloc_space, pa_inode_list);
spin_lock(&pa->pa_lock);
if (pa->pa_deleted == 0) {
pa_end = pa->pa_lstart + pa->pa_len;
Expand Down Expand Up @@ -3416,16 +3411,14 @@ ext4_mb_use_preallocated(struct ext4_allocation_context *ac)
struct ext4_inode_info *ei = EXT4_I(ac->ac_inode);
struct ext4_locality_group *lg;
struct ext4_prealloc_space *pa;
struct list_head *cur;

/* only data can be preallocated */
if (!(ac->ac_flags & EXT4_MB_HINT_DATA))
return 0;

/* first, try per-file preallocation */
rcu_read_lock();
list_for_each_rcu(cur, &ei->i_prealloc_list) {
pa = list_entry(cur, struct ext4_prealloc_space, pa_inode_list);
list_for_each_entry_rcu(pa, &ei->i_prealloc_list, pa_inode_list) {

/* all fields in this condition don't change,
* so we can skip locking for them */
Expand Down Expand Up @@ -3457,8 +3450,7 @@ ext4_mb_use_preallocated(struct ext4_allocation_context *ac)
return 0;

rcu_read_lock();
list_for_each_rcu(cur, &lg->lg_prealloc_list) {
pa = list_entry(cur, struct ext4_prealloc_space, pa_inode_list);
list_for_each_entry_rcu(pa, &lg->lg_prealloc_list, pa_inode_list) {
spin_lock(&pa->pa_lock);
if (pa->pa_deleted == 0 && pa->pa_free >= ac->ac_o_ex.fe_len) {
atomic_inc(&pa->pa_count);
Expand Down

0 comments on commit 4a3ba3d

Please sign in to comment.