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) ...@@ -511,10 +511,26 @@ static void __write_metapage(metapage_t * mp)
jFYI(1, ("__write_metapage done\n")); 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) void release_metapage(metapage_t * mp)
{ {
log_t *log; log_t *log;
struct inode *ip;
jFYI(1, jFYI(1,
("release_metapage: mp = 0x%p, flag = 0x%lx\n", mp, ("release_metapage: mp = 0x%p, flag = 0x%lx\n", mp,
...@@ -528,8 +544,6 @@ void release_metapage(metapage_t * mp) ...@@ -528,8 +544,6 @@ void release_metapage(metapage_t * mp)
return; return;
} }
ip = (struct inode *) mp->mapping->host;
assert(mp->count); assert(mp->count);
if (--mp->count || atomic_read(&mp->nohomeok)) { if (--mp->count || atomic_read(&mp->nohomeok)) {
unlock_metapage(mp); unlock_metapage(mp);
......
...@@ -84,33 +84,27 @@ extern metapage_t *__get_metapage(struct inode *inode, ...@@ -84,33 +84,27 @@ extern metapage_t *__get_metapage(struct inode *inode,
__get_metapage(inode, lblock, size, absolute, TRUE) __get_metapage(inode, lblock, size, absolute, TRUE)
extern void release_metapage(metapage_t *); extern void release_metapage(metapage_t *);
extern void hold_metapage(metapage_t *, int);
#define flush_metapage(mp) \ static inline void write_metapage(metapage_t *mp)
{\ {
set_bit(META_dirty, &(mp)->flag);\ set_bit(META_dirty, &mp->flag);
set_bit(META_sync, &(mp)->flag);\ release_metapage(mp);
release_metapage(mp);\
} }
#define sync_metapage(mp) \ static inline void flush_metapage(metapage_t *mp)
generic_buffer_fdatasync((struct inode *)mp->mapping->host,\ {
mp->page->index, mp->page->index + 1) set_bit(META_sync, &mp->flag);
write_metapage(mp);
#define write_metapage(mp) \
{\
set_bit(META_dirty, &(mp)->flag);\
release_metapage(mp);\
} }
#define discard_metapage(mp) \ static inline void discard_metapage(metapage_t *mp)
{\ {
clear_bit(META_dirty, &(mp)->flag);\ clear_bit(META_dirty, &mp->flag);
set_bit(META_discard, &(mp)->flag);\ set_bit(META_discard, &mp->flag);
release_metapage(mp);\ release_metapage(mp);
} }
extern void hold_metapage(metapage_t *, int);
/* /*
* This routine uses hash to explicitly find small number of pages * 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