Commit 49afbe6c authored by Linus Torvalds's avatar Linus Torvalds

Merge http://jfs.bkbits.net/linux-2.5

into penguin.transmeta.com:/home/penguin/torvalds/repositories/kernel/linux
parents f3ef7ee5 44af83d0
...@@ -102,6 +102,8 @@ struct file_operations jfs_file_operations = { ...@@ -102,6 +102,8 @@ struct file_operations jfs_file_operations = {
.llseek = generic_file_llseek, .llseek = generic_file_llseek,
.write = generic_file_write, .write = generic_file_write,
.read = generic_file_read, .read = generic_file_read,
.aio_read = generic_file_aio_read,
.aio_write = generic_file_aio_write,
.mmap = generic_file_mmap, .mmap = generic_file_mmap,
.readv = generic_file_readv, .readv = generic_file_readv,
.writev = generic_file_writev, .writev = generic_file_writev,
......
...@@ -184,9 +184,9 @@ static void lbmWrite(struct jfs_log * log, struct lbuf * bp, int flag, int cant_ ...@@ -184,9 +184,9 @@ static void lbmWrite(struct jfs_log * log, struct lbuf * bp, int flag, int cant_
static void lbmDirectWrite(struct jfs_log * log, struct lbuf * bp, int flag); static void lbmDirectWrite(struct jfs_log * log, struct lbuf * bp, int flag);
static int lbmIOWait(struct lbuf * bp, int flag); static int lbmIOWait(struct lbuf * bp, int flag);
static bio_end_io_t lbmIODone; static bio_end_io_t lbmIODone;
static void lbmStartIO(struct lbuf * bp);
static void lmGCwrite(struct jfs_log * log, int cant_block);
void lbmStartIO(struct lbuf * bp);
void lmGCwrite(struct jfs_log * log, int cant_block);
/* /*
...@@ -744,7 +744,7 @@ int lmGroupCommit(struct jfs_log * log, struct tblock * tblk) ...@@ -744,7 +744,7 @@ int lmGroupCommit(struct jfs_log * log, struct tblock * tblk)
* LOGGC_LOCK must be held by caller. * LOGGC_LOCK must be held by caller.
* N.B. LOG_LOCK is NOT held during lmGroupCommit(). * N.B. LOG_LOCK is NOT held during lmGroupCommit().
*/ */
void lmGCwrite(struct jfs_log * log, int cant_write) static void lmGCwrite(struct jfs_log * log, int cant_write)
{ {
struct lbuf *bp; struct lbuf *bp;
struct logpage *lp; struct logpage *lp;
...@@ -893,8 +893,7 @@ void lmPostGC(struct lbuf * bp) ...@@ -893,8 +893,7 @@ void lmPostGC(struct lbuf * bp)
*/ */
if ((tblk = log->cqueue.head) && if ((tblk = log->cqueue.head) &&
((log->gcrtc > 0) || (tblk->bp->l_wqnext != NULL) || ((log->gcrtc > 0) || (tblk->bp->l_wqnext != NULL) ||
test_bit(log_SYNCBARRIER, &log->flag) || test_bit(log_FLUSH, &log->flag)))
test_bit(log_QUIESCE, &log->flag)))
/* /*
* Call lmGCwrite with new group leader * Call lmGCwrite with new group leader
*/ */
...@@ -902,11 +901,13 @@ void lmPostGC(struct lbuf * bp) ...@@ -902,11 +901,13 @@ void lmPostGC(struct lbuf * bp)
/* no transaction are ready yet (transactions are only just /* no transaction are ready yet (transactions are only just
* queued (GC_QUEUE) and not entered for group commit yet). * queued (GC_QUEUE) and not entered for group commit yet).
* let the first transaction entering group commit * the first transaction entering group commit
* will elect hetself as new group leader. * will elect herself as new group leader.
*/ */
else else {
log->cflag &= ~logGC_PAGEOUT; log->cflag &= ~logGC_PAGEOUT;
clear_bit(log_FLUSH, &log->flag);
}
//LOGGC_UNLOCK(log); //LOGGC_UNLOCK(log);
spin_unlock_irqrestore(&log->gclock, flags); spin_unlock_irqrestore(&log->gclock, flags);
...@@ -1049,18 +1050,12 @@ int lmLogSync(struct jfs_log * log, int nosyncwait) ...@@ -1049,18 +1050,12 @@ int lmLogSync(struct jfs_log * log, int nosyncwait)
set_bit(log_SYNCBARRIER, &log->flag); set_bit(log_SYNCBARRIER, &log->flag);
jFYI(1, ("log barrier on: lsn=0x%x syncpt=0x%x\n", lsn, jFYI(1, ("log barrier on: lsn=0x%x syncpt=0x%x\n", lsn,
log->syncpt)); log->syncpt));
/*
* We may have to initiate group commit
*/
jfs_flush_journal(log, 0);
} }
/*
* We may have to initiate group commit
*/
LOGGC_LOCK(log);
if (log->cqueue.head && !(log->cflag & logGC_PAGEOUT)) {
log->cflag |= logGC_PAGEOUT;
lmGCwrite(log, 0);
}
LOGGC_UNLOCK(log);
return lsn; return lsn;
} }
...@@ -1416,21 +1411,22 @@ int lmLogClose(struct super_block *sb, struct jfs_log * log) ...@@ -1416,21 +1411,22 @@ int lmLogClose(struct super_block *sb, struct jfs_log * log)
/* /*
* NAME: lmLogWait() * NAME: jfs_flush_journal()
* *
* FUNCTION: wait for all outstanding log records to be written to disk * FUNCTION: initiate write of any outstanding transactions to the journal
* and optionally wait until they are all written to disk
*/ */
void lmLogWait(struct jfs_log *log) void jfs_flush_journal(struct jfs_log *log, int wait)
{ {
int i; int i;
jFYI(1, ("lmLogWait: log:0x%p\n", log)); jFYI(1, ("jfs_flush_journal: log:0x%p wait=%d\n", log, wait));
/* /*
* This ensures that we will keep writing to the journal as long * This ensures that we will keep writing to the journal as long
* as there are unwritten commit records * as there are unwritten commit records
*/ */
set_bit(log_QUIESCE, &log->flag); set_bit(log_FLUSH, &log->flag);
/* /*
* Initiate I/O on outstanding transactions * Initiate I/O on outstanding transactions
...@@ -1442,6 +1438,9 @@ void lmLogWait(struct jfs_log *log) ...@@ -1442,6 +1438,9 @@ void lmLogWait(struct jfs_log *log)
} }
LOGGC_UNLOCK(log); LOGGC_UNLOCK(log);
if (!wait)
return;
if (log->cqueue.head || !list_empty(&log->synclist)) { if (log->cqueue.head || !list_empty(&log->synclist)) {
/* /*
* If there was very recent activity, we may need to wait * If there was very recent activity, we may need to wait
...@@ -1459,7 +1458,7 @@ void lmLogWait(struct jfs_log *log) ...@@ -1459,7 +1458,7 @@ void lmLogWait(struct jfs_log *log)
assert(log->cqueue.head == NULL); assert(log->cqueue.head == NULL);
assert(list_empty(&log->synclist)); assert(list_empty(&log->synclist));
clear_bit(log_QUIESCE, &log->flag); /* Probably not needed */ clear_bit(log_FLUSH, &log->flag);
} }
/* /*
...@@ -1488,7 +1487,7 @@ int lmLogShutdown(struct jfs_log * log) ...@@ -1488,7 +1487,7 @@ int lmLogShutdown(struct jfs_log * log)
jFYI(1, ("lmLogShutdown: log:0x%p\n", log)); jFYI(1, ("lmLogShutdown: log:0x%p\n", log));
lmLogWait(log); jfs_flush_journal(log, 1);
/* /*
* We need to make sure all of the "written" metapages * We need to make sure all of the "written" metapages
...@@ -1946,7 +1945,7 @@ static void lbmDirectWrite(struct jfs_log * log, struct lbuf * bp, int flag) ...@@ -1946,7 +1945,7 @@ static void lbmDirectWrite(struct jfs_log * log, struct lbuf * bp, int flag)
* *
* serialization: LCACHE_LOCK() is NOT held during log i/o; * serialization: LCACHE_LOCK() is NOT held during log i/o;
*/ */
void lbmStartIO(struct lbuf * bp) static void lbmStartIO(struct lbuf * bp)
{ {
struct bio *bio; struct bio *bio;
struct jfs_log *log = bp->l_log; struct jfs_log *log = bp->l_log;
......
...@@ -424,6 +424,7 @@ struct jfs_log { ...@@ -424,6 +424,7 @@ struct jfs_log {
#define log_INLINELOG 1 #define log_INLINELOG 1
#define log_SYNCBARRIER 2 #define log_SYNCBARRIER 2
#define log_QUIESCE 3 #define log_QUIESCE 3
#define log_FLUSH 4
/* /*
* group commit flag * group commit flag
...@@ -501,11 +502,11 @@ struct logsyncblk { ...@@ -501,11 +502,11 @@ struct logsyncblk {
} }
extern int lmLogOpen(struct super_block *sb, struct jfs_log ** log); extern int lmLogOpen(struct super_block *sb, struct jfs_log ** log);
extern void lmLogWait(struct jfs_log * log);
extern int lmLogClose(struct super_block *sb, struct jfs_log * log); extern int lmLogClose(struct super_block *sb, struct jfs_log * log);
extern int lmLogSync(struct jfs_log * log, int nosyncwait); extern int lmLogSync(struct jfs_log * log, int nosyncwait);
extern int lmLogShutdown(struct jfs_log * log); extern int lmLogShutdown(struct jfs_log * log);
extern int lmLogInit(struct jfs_log * log); extern int lmLogInit(struct jfs_log * log);
extern int lmLogFormat(struct jfs_log *log, s64 logAddress, int logSize); extern int lmLogFormat(struct jfs_log *log, s64 logAddress, int logSize);
extern void jfs_flush_journal(struct jfs_log * log, int wait);
#endif /* _H_JFS_LOGMGR */ #endif /* _H_JFS_LOGMGR */
...@@ -158,7 +158,6 @@ struct { ...@@ -158,7 +158,6 @@ struct {
* external references * external references
*/ */
extern int lmGroupCommit(struct jfs_log *, struct tblock *); extern int lmGroupCommit(struct jfs_log *, struct tblock *);
extern int lmGCwrite(struct jfs_log *, int);
extern void lmSync(struct jfs_log *); extern void lmSync(struct jfs_log *);
extern int jfs_commit_inode(struct inode *, int); extern int jfs_commit_inode(struct inode *, int);
extern int jfs_stop_threads; extern int jfs_stop_threads;
...@@ -2969,12 +2968,7 @@ void txQuiesce(struct super_block *sb) ...@@ -2969,12 +2968,7 @@ void txQuiesce(struct super_block *sb)
/* /*
* We may need to kick off the group commit * We may need to kick off the group commit
*/ */
spin_lock_irq(&log->gclock); // LOGGC_LOCK jfs_flush_journal(log, 0);
if (log->cqueue.head && !(log->cflag & logGC_PAGEOUT)) {
log->cflag |= logGC_PAGEOUT;
lmGCwrite(log, 0);
}
spin_unlock_irq(&log->gclock); // LOGGC_UNLOCK
} }
/* /*
......
...@@ -69,7 +69,7 @@ int jfs_umount(struct super_block *sb) ...@@ -69,7 +69,7 @@ int jfs_umount(struct super_block *sb)
/* /*
* Wait for outstanding transactions to be written to log: * Wait for outstanding transactions to be written to log:
*/ */
lmLogWait(log); jfs_flush_journal(log, 1);
/* /*
* close fileset inode allocation map (aka fileset inode) * close fileset inode allocation map (aka fileset inode)
...@@ -153,7 +153,7 @@ int jfs_umount_rw(struct super_block *sb) ...@@ -153,7 +153,7 @@ int jfs_umount_rw(struct super_block *sb)
* *
* remove file system from log active file system list. * remove file system from log active file system list.
*/ */
lmLogWait(log); jfs_flush_journal(log, 1);
/* /*
* Make sure all metadata makes it to disk * Make sure all metadata makes it to disk
......
...@@ -514,7 +514,7 @@ int jfs_extendfs(struct super_block *sb, s64 newLVSize, int newLogSize) ...@@ -514,7 +514,7 @@ int jfs_extendfs(struct super_block *sb, s64 newLVSize, int newLogSize)
mark_buffer_dirty(bh); mark_buffer_dirty(bh);
ll_rw_block(WRITE, 1, &bh2); ll_rw_block(WRITE, 1, &bh2);
wait_on_buffer(bh2); wait_on_buffer(bh2);
brelse(bh); brelse(bh2);
} }
/* write primary superblock */ /* write primary superblock */
......
...@@ -382,6 +382,17 @@ static struct super_block *jfs_get_sb(struct file_system_type *fs_type, ...@@ -382,6 +382,17 @@ static struct super_block *jfs_get_sb(struct file_system_type *fs_type,
return get_sb_bdev(fs_type, flags, dev_name, data, jfs_fill_super); return get_sb_bdev(fs_type, flags, dev_name, data, jfs_fill_super);
} }
static int jfs_sync_fs(struct super_block *sb, int wait)
{
struct jfs_log *log = JFS_SBI(sb)->log;
/* log == NULL indicates read-only mount */
if (log)
jfs_flush_journal(log, wait);
return 0;
}
static struct super_operations jfs_super_operations = { static struct super_operations jfs_super_operations = {
.alloc_inode = jfs_alloc_inode, .alloc_inode = jfs_alloc_inode,
.destroy_inode = jfs_destroy_inode, .destroy_inode = jfs_destroy_inode,
...@@ -389,6 +400,7 @@ static struct super_operations jfs_super_operations = { ...@@ -389,6 +400,7 @@ static struct super_operations jfs_super_operations = {
.write_inode = jfs_write_inode, .write_inode = jfs_write_inode,
.delete_inode = jfs_delete_inode, .delete_inode = jfs_delete_inode,
.put_super = jfs_put_super, .put_super = jfs_put_super,
.sync_fs = jfs_sync_fs,
.write_super_lockfs = jfs_write_super_lockfs, .write_super_lockfs = jfs_write_super_lockfs,
.unlockfs = jfs_unlockfs, .unlockfs = jfs_unlockfs,
.statfs = jfs_statfs, .statfs = jfs_statfs,
......
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