Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 258958
b: refs/heads/master
c: d515afe
h: refs/heads/master
v: v3
  • Loading branch information
Hugh Dickins authored and Linus Torvalds committed Jul 26, 2011
1 parent 25e88d1 commit d41817f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 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: d0823576bf4b8eafce1b56f98613465a0352a376
refs/heads/master: d515afe88a32e567c550e3db914f3e378f86453a
14 changes: 6 additions & 8 deletions trunk/mm/shmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,7 @@ static void shmem_free_blocks(struct inode *inode, long pages)
struct shmem_sb_info *sbinfo = SHMEM_SB(inode->i_sb);
if (sbinfo->max_blocks) {
percpu_counter_add(&sbinfo->used_blocks, -pages);
spin_lock(&inode->i_lock);
inode->i_blocks -= pages*BLOCKS_PER_PAGE;
spin_unlock(&inode->i_lock);
}
}

Expand Down Expand Up @@ -432,9 +430,7 @@ static swp_entry_t *shmem_swp_alloc(struct shmem_inode_info *info, unsigned long
sbinfo->max_blocks - 1) >= 0)
return ERR_PTR(-ENOSPC);
percpu_counter_inc(&sbinfo->used_blocks);
spin_lock(&inode->i_lock);
inode->i_blocks += BLOCKS_PER_PAGE;
spin_unlock(&inode->i_lock);
}

spin_unlock(&info->lock);
Expand Down Expand Up @@ -1421,9 +1417,7 @@ static int shmem_getpage(struct inode *inode, unsigned long idx,
shmem_acct_block(info->flags))
goto nospace;
percpu_counter_inc(&sbinfo->used_blocks);
spin_lock(&inode->i_lock);
inode->i_blocks += BLOCKS_PER_PAGE;
spin_unlock(&inode->i_lock);
} else if (shmem_acct_block(info->flags))
goto nospace;

Expand All @@ -1434,8 +1428,10 @@ static int shmem_getpage(struct inode *inode, unsigned long idx,
spin_unlock(&info->lock);
filepage = shmem_alloc_page(gfp, info, idx);
if (!filepage) {
spin_lock(&info->lock);
shmem_unacct_blocks(info->flags, 1);
shmem_free_blocks(inode, 1);
spin_unlock(&info->lock);
error = -ENOMEM;
goto failed;
}
Expand All @@ -1449,8 +1445,10 @@ static int shmem_getpage(struct inode *inode, unsigned long idx,
current->mm, GFP_KERNEL);
if (error) {
page_cache_release(filepage);
spin_lock(&info->lock);
shmem_unacct_blocks(info->flags, 1);
shmem_free_blocks(inode, 1);
spin_unlock(&info->lock);
filepage = NULL;
goto failed;
}
Expand Down Expand Up @@ -1480,10 +1478,10 @@ static int shmem_getpage(struct inode *inode, unsigned long idx,
* be done automatically.
*/
if (ret) {
spin_unlock(&info->lock);
page_cache_release(filepage);
shmem_unacct_blocks(info->flags, 1);
shmem_free_blocks(inode, 1);
spin_unlock(&info->lock);
page_cache_release(filepage);
filepage = NULL;
if (error)
goto failed;
Expand Down

0 comments on commit d41817f

Please sign in to comment.