Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 139166
b: refs/heads/master
c: 2678958
h: refs/heads/master
v: v3
  • Loading branch information
Johannes Weiner authored and Linus Torvalds committed Apr 1, 2009
1 parent cb3ee2d commit 1c0484a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 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: 88c3bd707c2552bcef93cc3724647903aece159d
refs/heads/master: 2678958e1225f350806d90f211a3b475f64aee80
15 changes: 4 additions & 11 deletions trunk/fs/ramfs/file-nommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ const struct inode_operations ramfs_file_inode_operations = {
*/
int ramfs_nommu_expand_for_mapping(struct inode *inode, size_t newsize)
{
struct pagevec lru_pvec;
unsigned long npages, xpages, loop, limit;
struct page *pages;
unsigned order;
Expand Down Expand Up @@ -102,24 +101,20 @@ int ramfs_nommu_expand_for_mapping(struct inode *inode, size_t newsize)
memset(data, 0, newsize);

/* attach all the pages to the inode's address space */
pagevec_init(&lru_pvec, 0);
for (loop = 0; loop < npages; loop++) {
struct page *page = pages + loop;

ret = add_to_page_cache(page, inode->i_mapping, loop, GFP_KERNEL);
ret = add_to_page_cache_lru(page, inode->i_mapping, loop,
GFP_KERNEL);
if (ret < 0)
goto add_error;

if (!pagevec_add(&lru_pvec, page))
__pagevec_lru_add_file(&lru_pvec);

/* prevent the page from being discarded on memory pressure */
SetPageDirty(page);

unlock_page(page);
}

pagevec_lru_add_file(&lru_pvec);
return 0;

fsize_exceeded:
Expand All @@ -128,10 +123,8 @@ int ramfs_nommu_expand_for_mapping(struct inode *inode, size_t newsize)
return -EFBIG;

add_error:
pagevec_lru_add_file(&lru_pvec);
page_cache_release(pages + loop);
for (loop++; loop < npages; loop++)
__free_page(pages + loop);
while (loop < npages)
__free_page(pages + loop++);
return ret;
}

Expand Down

0 comments on commit 1c0484a

Please sign in to comment.