Commit a0780cdf authored by Dave Kleikamp's avatar Dave Kleikamp

JFS: simplify sync_metapage

Submitted by Christoph Hellwig
parent e65af39e
......@@ -511,10 +511,26 @@ static void __write_metapage(metapage_t * mp)
jFYI(1, ("__write_metapage done\n"));
}
static inline void sync_metapage(metapage_t *mp)
{
struct page *page = mp->page;
page_cache_get(page);
lock_page(page);
/* we're done with this page - no need to check for errors */
if (page->buffers) {
writeout_one_page(page);
waitfor_one_page(page);
}
UnlockPage(page);
page_cache_release(page);
}
void release_metapage(metapage_t * mp)
{
log_t *log;
struct inode *ip;
jFYI(1,
("release_metapage: mp = 0x%p, flag = 0x%lx\n", mp,
......@@ -528,8 +544,6 @@ void release_metapage(metapage_t * mp)
return;
}
ip = (struct inode *) mp->mapping->host;
assert(mp->count);
if (--mp->count || atomic_read(&mp->nohomeok)) {
unlock_metapage(mp);
......
......@@ -84,33 +84,27 @@ extern metapage_t *__get_metapage(struct inode *inode,
__get_metapage(inode, lblock, size, absolute, TRUE)
extern void release_metapage(metapage_t *);
extern void hold_metapage(metapage_t *, int);
#define flush_metapage(mp) \
{\
set_bit(META_dirty, &(mp)->flag);\
set_bit(META_sync, &(mp)->flag);\
release_metapage(mp);\
static inline void write_metapage(metapage_t *mp)
{
set_bit(META_dirty, &mp->flag);
release_metapage(mp);
}
#define sync_metapage(mp) \
generic_buffer_fdatasync((struct inode *)mp->mapping->host,\
mp->page->index, mp->page->index + 1)
#define write_metapage(mp) \
{\
set_bit(META_dirty, &(mp)->flag);\
release_metapage(mp);\
static inline void flush_metapage(metapage_t *mp)
{
set_bit(META_sync, &mp->flag);
write_metapage(mp);
}
#define discard_metapage(mp) \
{\
clear_bit(META_dirty, &(mp)->flag);\
set_bit(META_discard, &(mp)->flag);\
release_metapage(mp);\
static inline void discard_metapage(metapage_t *mp)
{
clear_bit(META_dirty, &mp->flag);
set_bit(META_discard, &mp->flag);
release_metapage(mp);
}
extern void hold_metapage(metapage_t *, int);
/*
* This routine uses hash to explicitly find small number of pages
*/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment