linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Chuck Lever <chuck.lever@oracle.com>
To: apkm@osdl.org
Cc: linux-mm@kvack.org, Trond.Myklebust@netapp.com, steved@redhat.com
Subject: [PATCH] Make invalidate_inode_pages2() work again
Date: Mon, 25 Sep 2006 19:15:58 -0400	[thread overview]
Message-ID: <20060925231557.32226.66866.stgit@ingres.dsl.sfldmi.ameritech.net> (raw)

A recent change to fix a problem with invalidate_inode_pages() has weakened
the behavior of invalidate_inode_pages2() inadvertently.  Add a flag to
tell the helper routines when stronger invalidation semantics are desired.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---

 mm/truncate.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/mm/truncate.c b/mm/truncate.c
index c6ab55e..b3097a2 100644
--- a/mm/truncate.c
+++ b/mm/truncate.c
@@ -59,7 +59,7 @@ truncate_complete_page(struct address_sp
  * Returns non-zero if the page was successfully invalidated.
  */
 static int
-invalidate_complete_page(struct address_space *mapping, struct page *page)
+invalidate_complete_page(struct address_space *mapping, struct page *page, int try_harder)
 {
 	if (page->mapping != mapping)
 		return 0;
@@ -70,7 +70,7 @@ invalidate_complete_page(struct address_
 	write_lock_irq(&mapping->tree_lock);
 	if (PageDirty(page))
 		goto failed;
-	if (page_count(page) != 2)	/* caller's ref + pagecache ref */
+	if (!try_harder && page_count(page) != 2)	/* caller's ref + pagecache ref */
 		goto failed;
 
 	BUG_ON(PagePrivate(page));
@@ -255,7 +255,7 @@ unsigned long invalidate_mapping_pages(s
 				goto unlock;
 			if (page_mapped(page))
 				goto unlock;
-			ret += invalidate_complete_page(mapping, page);
+			ret += invalidate_complete_page(mapping, page, 0);
 unlock:
 			unlock_page(page);
 			if (next > end)
@@ -339,7 +339,7 @@ int invalidate_inode_pages2_range(struct
 				}
 			}
 			was_dirty = test_clear_page_dirty(page);
-			if (!invalidate_complete_page(mapping, page)) {
+			if (!invalidate_complete_page(mapping, page, 1)) {
 				if (was_dirty)
 					set_page_dirty(page);
 				ret = -EIO;

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

             reply	other threads:[~2006-09-25 23:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-25 23:15 Chuck Lever [this message]
2006-09-25 23:59 ` Nick Piggin
2006-09-26  1:20   ` Trond Myklebust
2006-09-26  1:39     ` Nick Piggin
2006-09-26  6:24       ` Nick Piggin
2006-09-26  1:42     ` Andrew Morton
2006-09-26  1:54       ` Nick Piggin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060925231557.32226.66866.stgit@ingres.dsl.sfldmi.ameritech.net \
    --to=chuck.lever@oracle.com \
    --cc=Trond.Myklebust@netapp.com \
    --cc=apkm@osdl.org \
    --cc=chucklever@gmail.com \
    --cc=linux-mm@kvack.org \
    --cc=steved@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox