linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Liu Bo <liubo2009@cn.fujitsu.com>
To: <linux-btrfs@vger.kernel.org>
Subject: [PATCH 09/10] Btrfs: use PagePrivate2 to check ordered data
Date: Tue, 27 Mar 2012 14:44:37 +0800	[thread overview]
Message-ID: <1332830678-3992-10-git-send-email-liubo2009@cn.fujitsu.com> (raw)
In-Reply-To: <1332830678-3992-1-git-send-email-liubo2009@cn.fujitsu.com>

If a page has PagePrivate2 flag, it still remains as ordered data,
so we can check this flag directly instead of looking up an ordered
extent.

Signed-off-by: Liu Bo <liubo2009@cn.fujitsu.com>
---
 fs/btrfs/inode.c |   45 +++++++++++++++------------------------------
 1 files changed, 15 insertions(+), 30 deletions(-)

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 7f5018d..bacf441 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -6345,8 +6345,6 @@ static int btrfs_releasepage(struct page *page, gfp_t gfp_flags)
 static void btrfs_invalidatepage(struct page *page, unsigned long offset)
 {
 	struct extent_io_tree *tree;
-	struct btrfs_ordered_extent *ordered;
-	struct extent_state *cached_state = NULL;
 	u64 page_start = page_offset(page);
 	u64 page_end = page_start + PAGE_CACHE_SIZE - 1;
 
@@ -6365,35 +6363,22 @@ static void btrfs_invalidatepage(struct page *page, unsigned long offset)
 		btrfs_releasepage(page, GFP_NOFS);
 		return;
 	}
-	lock_extent_bits(tree, page_start, page_end, 0, &cached_state,
-			 GFP_NOFS);
-	ordered = btrfs_lookup_ordered_extent(page->mapping->host,
-					   page_offset(page));
-	if (ordered) {
-		/*
-		 * IO on this page will never be started, so we need
-		 * to account for any ordered extents now
-		 */
-		clear_extent_bit(tree, page_start, page_end,
-				 EXTENT_DIRTY | EXTENT_DELALLOC |
-				 EXTENT_LOCKED | EXTENT_DO_ACCOUNTING, 1, 0,
-				 &cached_state, GFP_NOFS);
-		/*
-		 * whoever cleared the private bit is responsible
-		 * for the finish_ordered_io
-		 */
-		if (TestClearPagePrivate2(page)) {
-			btrfs_finish_ordered_io(page->mapping->host,
-						page_start, page_end);
-		}
-		btrfs_put_ordered_extent(ordered);
-		cached_state = NULL;
-		lock_extent_bits(tree, page_start, page_end, 0, &cached_state,
-				 GFP_NOFS);
-	}
+	/*
+	 * IO on this page will never be started, so we need
+	 * to account for any ordered extents now
+	 */
 	clear_extent_bit(tree, page_start, page_end,
-		 EXTENT_LOCKED | EXTENT_DIRTY | EXTENT_DELALLOC |
-		 EXTENT_DO_ACCOUNTING, 1, 1, &cached_state, GFP_NOFS);
+			 EXTENT_DIRTY | EXTENT_DELALLOC |
+			 EXTENT_LOCKED | EXTENT_DO_ACCOUNTING, 1, 1,
+			 NULL, GFP_NOFS);
+	/*
+	 * whoever cleared the private bit is responsible
+	 * for the finish_ordered_io
+	 */
+	if (TestClearPagePrivate2(page)) {
+		btrfs_finish_ordered_io(page->mapping->host,
+					page_start, page_end);
+	}
 	__btrfs_releasepage(page, GFP_NOFS);
 
 	ClearPageChecked(page);
-- 
1.6.5.2


  parent reply	other threads:[~2012-03-27  6:44 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-27  6:44 [PATCH 00/10] several fixes and cleanups Liu Bo
2012-03-27  6:44 ` [PATCH 01/10] Btrfs: show useful info in space reservation tracepoint Liu Bo
2012-03-27  6:44 ` [PATCH 02/10][RESEND] Btrfs: fix deadlock during allocating chunks Liu Bo
2012-03-27  6:44 ` [PATCH 03/10] Btrfs: fix race between direct io and autodefrag Liu Bo
2012-03-27  6:44 ` [PATCH 04/10] Btrfs: fix the mismatch of page->mapping Liu Bo
2012-03-27  6:44 ` [PATCH 05/10][RESEND] Btrfs: fix recursive defragment with autodefrag option Liu Bo
2012-03-27  6:44 ` [PATCH 06/10] Btrfs: add a check to decide if we should defrag the range Liu Bo
2012-03-27  6:44 ` [PATCH 07/10] Btrfs: do not bother to defrag an extent if it is a big real extent Liu Bo
2012-03-27  6:44 ` [PATCH 08/10] Btrfs: update to the right index of defragment Liu Bo
2012-03-27  6:44 ` Liu Bo [this message]
2012-03-27  6:44 ` [PATCH 10/10] Btrfs: drop cache with VACANCY em when we fail to start a transaction Liu Bo
2012-03-29 14:01   ` Chris Mason
2012-03-30  1:08     ` Liu Bo

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=1332830678-3992-10-git-send-email-liubo2009@cn.fujitsu.com \
    --to=liubo2009@cn.fujitsu.com \
    --cc=linux-btrfs@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).