linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo@cn.fujitsu.com>
To: <linux-btrfs@vger.kernel.org>
Subject: [PATCH 2/2] btrfs-progs: Move (set/clear_)extent_buffer_uptodate() to extent_io.h.
Date: Tue, 27 Jan 2015 11:12:43 +0800	[thread overview]
Message-ID: <1422328363-11405-2-git-send-email-quwenruo@cn.fujitsu.com> (raw)
In-Reply-To: <1422328363-11405-1-git-send-email-quwenruo@cn.fujitsu.com>

Unlike kernel, these functions in userland just test/set/clear a member.
So move them to header to avoid extra function call cost.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
---
 extent_io.c | 23 -----------------------
 extent_io.h | 26 ++++++++++++++++++++++----
 2 files changed, 22 insertions(+), 27 deletions(-)

diff --git a/extent_io.c b/extent_io.c
index 3a8f96b..8176a51 100644
--- a/extent_io.c
+++ b/extent_io.c
@@ -829,29 +829,6 @@ int write_data_to_disk(struct btrfs_fs_info *info, void *buf, u64 offset,
 	return 0;
 }
 
-
-int set_extent_buffer_uptodate(struct extent_buffer *eb)
-{
-	eb->flags |= EXTENT_UPTODATE;
-	return 0;
-}
-
-int clear_extent_buffer_uptodate(struct extent_io_tree *tree,
-				struct extent_buffer *eb)
-{
-	eb->flags &= ~EXTENT_UPTODATE;
-	return 0;
-}
-
-int extent_buffer_uptodate(struct extent_buffer *eb)
-{
-	if (!eb || IS_ERR(eb))
-		return 0;
-	if (eb->flags & EXTENT_UPTODATE)
-		return 1;
-	return 0;
-}
-
 int set_extent_buffer_dirty(struct extent_buffer *eb)
 {
 	struct extent_io_tree *tree = eb->tree;
diff --git a/extent_io.h b/extent_io.h
index acc316e..2fe9dcd 100644
--- a/extent_io.h
+++ b/extent_io.h
@@ -100,10 +100,28 @@ int set_extent_dirty(struct extent_io_tree *tree, u64 start,
 		     u64 end, gfp_t mask);
 int clear_extent_dirty(struct extent_io_tree *tree, u64 start,
 		       u64 end, gfp_t mask);
-int extent_buffer_uptodate(struct extent_buffer *eb);
-int set_extent_buffer_uptodate(struct extent_buffer *eb);
-int clear_extent_buffer_uptodate(struct extent_io_tree *tree,
-				struct extent_buffer *eb);
+static inline int set_extent_buffer_uptodate(struct extent_buffer *eb)
+{
+	eb->flags |= EXTENT_UPTODATE;
+	return 0;
+}
+
+static inline int clear_extent_buffer_uptodate(struct extent_io_tree *tree,
+				struct extent_buffer *eb)
+{
+	eb->flags &= ~EXTENT_UPTODATE;
+	return 0;
+}
+
+static inline int extent_buffer_uptodate(struct extent_buffer *eb)
+{
+	if (!eb || IS_ERR(eb))
+		return 0;
+	if (eb->flags & EXTENT_UPTODATE)
+		return 1;
+	return 0;
+}
+
 int set_state_private(struct extent_io_tree *tree, u64 start, u64 xprivate);
 int get_state_private(struct extent_io_tree *tree, u64 start, u64 *xprivate);
 struct extent_buffer *find_extent_buffer(struct extent_io_tree *tree,
-- 
2.2.2


  reply	other threads:[~2015-01-27  3:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-27  3:12 [PATCH 1/2] btrfs-progs: read_tree_block() and read_node_slot() cleanup Qu Wenruo
2015-01-27  3:12 ` Qu Wenruo [this message]
2015-02-27 16:45   ` [PATCH 2/2] btrfs-progs: Move (set/clear_)extent_buffer_uptodate() to extent_io.h David Sterba
2015-01-27 16:48 ` [PATCH 1/2] btrfs-progs: read_tree_block() and read_node_slot() cleanup Noah Massey
2015-01-28  2:07   ` Qu Wenruo

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=1422328363-11405-2-git-send-email-quwenruo@cn.fujitsu.com \
    --to=quwenruo@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).