Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 44858
b: refs/heads/master
c: fba2591
h: refs/heads/master
v: v3
  • Loading branch information
Linus Torvalds committed Dec 21, 2006
1 parent 1d8f65a commit 8b42e4c
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 48 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: 46d2277c796f9f4937bfa668c40b2e3f43e93dd0
refs/heads/master: fba2591bf4e418b6c3f9f8794c9dd8fe40ae7bd9
2 changes: 1 addition & 1 deletion trunk/fs/hugetlbfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ static int hugetlbfs_commit_write(struct file *file,

static void truncate_huge_page(struct page *page)
{
clear_page_dirty(page);
cancel_dirty_page(page, /* No IO accounting for huge pages? */0);
ClearPageUptodate(page);
remove_from_page_cache(page);
put_page(page);
Expand Down
8 changes: 2 additions & 6 deletions trunk/include/linux/page-flags.h
Original file line number Diff line number Diff line change
Expand Up @@ -253,15 +253,11 @@ static inline void SetPageUptodate(struct page *page)

struct page; /* forward declaration */

int test_clear_page_dirty(struct page *page);
extern void cancel_dirty_page(struct page *page, unsigned int account_size);

int test_clear_page_writeback(struct page *page);
int test_set_page_writeback(struct page *page);

static inline void clear_page_dirty(struct page *page)
{
test_clear_page_dirty(page);
}

static inline void set_page_writeback(struct page *page)
{
test_set_page_writeback(page);
Expand Down
32 changes: 0 additions & 32 deletions trunk/mm/page-writeback.c
Original file line number Diff line number Diff line change
Expand Up @@ -844,38 +844,6 @@ int set_page_dirty_lock(struct page *page)
}
EXPORT_SYMBOL(set_page_dirty_lock);

/*
* Clear a page's dirty flag, while caring for dirty memory accounting.
* Returns true if the page was previously dirty.
*/
int test_clear_page_dirty(struct page *page)
{
struct address_space *mapping = page_mapping(page);
unsigned long flags;

if (!mapping)
return TestClearPageDirty(page);

write_lock_irqsave(&mapping->tree_lock, flags);
if (TestClearPageDirty(page)) {
radix_tree_tag_clear(&mapping->page_tree,
page_index(page), PAGECACHE_TAG_DIRTY);
write_unlock_irqrestore(&mapping->tree_lock, flags);
/*
* We can continue to use `mapping' here because the
* page is locked, which pins the address_space
*/
if (mapping_cap_account_dirty(mapping)) {
page_mkclean(page);
dec_zone_page_state(page, NR_FILE_DIRTY);
}
return 1;
}
write_unlock_irqrestore(&mapping->tree_lock, flags);
return 0;
}
EXPORT_SYMBOL(test_clear_page_dirty);

/*
* Clear a page's dirty flag, while caring for dirty memory accounting.
* Returns true if the page was previously dirty.
Expand Down
25 changes: 17 additions & 8 deletions trunk/mm/truncate.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,20 @@ static inline void truncate_partial_page(struct page *page, unsigned partial)
do_invalidatepage(page, partial);
}

void cancel_dirty_page(struct page *page, unsigned int account_size)
{
/* If we're cancelling the page, it had better not be mapped any more */
if (page_mapped(page)) {
static unsigned int warncount;

WARN_ON(++warncount < 5);
}

if (TestClearPageDirty(page) && account_size)
task_io_account_cancelled_write(account_size);
}


/*
* If truncate cannot remove the fs-private metadata from the page, the page
* becomes anonymous. It will be left on the LRU and may even be mapped into
Expand All @@ -70,8 +84,8 @@ truncate_complete_page(struct address_space *mapping, struct page *page)
if (PagePrivate(page))
do_invalidatepage(page, 0);

if (test_clear_page_dirty(page))
task_io_account_cancelled_write(PAGE_CACHE_SIZE);
cancel_dirty_page(page, PAGE_CACHE_SIZE);

ClearPageUptodate(page);
ClearPageMappedToDisk(page);
remove_from_page_cache(page);
Expand Down Expand Up @@ -350,7 +364,6 @@ int invalidate_inode_pages2_range(struct address_space *mapping,
for (i = 0; !ret && i < pagevec_count(&pvec); i++) {
struct page *page = pvec.pages[i];
pgoff_t page_index;
int was_dirty;

lock_page(page);
if (page->mapping != mapping) {
Expand Down Expand Up @@ -386,12 +399,8 @@ int invalidate_inode_pages2_range(struct address_space *mapping,
PAGE_CACHE_SIZE, 0);
}
}
was_dirty = test_clear_page_dirty(page);
if (!invalidate_complete_page2(mapping, page)) {
if (was_dirty)
set_page_dirty(page);
if (!invalidate_complete_page2(mapping, page))
ret = -EIO;
}
unlock_page(page);
}
pagevec_release(&pvec);
Expand Down

0 comments on commit 8b42e4c

Please sign in to comment.