From 005c470888ac2c04ba9263845d0ed3b19e9e6c69 Mon Sep 17 00:00:00 2001 From: Qu Wenruo Date: Tue, 27 Jan 2015 11:12:43 +0800 Subject: [PATCH] btrfs-progs: Move (set/clear_)extent_buffer_uptodate() to extent_io.h. 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 Signed-off-by: David Sterba --- 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 66aa214..5d49710 100644 --- a/extent_io.c +++ b/extent_io.c @@ -827,29 +827,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 3ded493..27c4b69 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.7.4