buffer: make touch_buffer() an exported function

We want to add a trace point to touch_buffer() but macros and inline
functions defined in header files can't have tracing points.  Move
touch_buffer() to fs/buffer.c and make it a proper function.

The new exported function is also declared inline.  As most uses of
touch_buffer() are inside buffer.c with nilfs2 as the only other user,
the effect of this change should be negligible.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
Tejun Heo 2013-01-11 13:06:35 -08:00 committed by Jens Axboe
parent 8c1cf6bb02
commit f0059afd3e
2 changed files with 7 additions and 1 deletions

View File

@ -53,6 +53,12 @@ void init_buffer(struct buffer_head *bh, bh_end_io_t *handler, void *private)
} }
EXPORT_SYMBOL(init_buffer); EXPORT_SYMBOL(init_buffer);
inline void touch_buffer(struct buffer_head *bh)
{
mark_page_accessed(bh->b_page);
}
EXPORT_SYMBOL(touch_buffer);
static int sleep_on_buffer(void *word) static int sleep_on_buffer(void *word)
{ {
io_schedule(); io_schedule();

View File

@ -126,7 +126,6 @@ BUFFER_FNS(Write_EIO, write_io_error)
BUFFER_FNS(Unwritten, unwritten) BUFFER_FNS(Unwritten, unwritten)
#define bh_offset(bh) ((unsigned long)(bh)->b_data & ~PAGE_MASK) #define bh_offset(bh) ((unsigned long)(bh)->b_data & ~PAGE_MASK)
#define touch_buffer(bh) mark_page_accessed(bh->b_page)
/* If we *know* page->private refers to buffer_heads */ /* If we *know* page->private refers to buffer_heads */
#define page_buffers(page) \ #define page_buffers(page) \
@ -142,6 +141,7 @@ BUFFER_FNS(Unwritten, unwritten)
void mark_buffer_dirty(struct buffer_head *bh); void mark_buffer_dirty(struct buffer_head *bh);
void init_buffer(struct buffer_head *, bh_end_io_t *, void *); void init_buffer(struct buffer_head *, bh_end_io_t *, void *);
void touch_buffer(struct buffer_head *bh);
void set_bh_page(struct buffer_head *bh, void set_bh_page(struct buffer_head *bh,
struct page *page, unsigned long offset); struct page *page, unsigned long offset);
int try_to_free_buffers(struct page *); int try_to_free_buffers(struct page *);