diff options
author | Dave Kleikamp <shaggy@austin.ibm.com> | 2005-07-27 10:17:57 -0400 |
---|---|---|
committer | Dave Kleikamp <shaggy@austin.ibm.com> | 2005-07-27 10:17:57 -0400 |
commit | cbc3d65ebcb0c494183d45cf202a53352cbf3871 (patch) | |
tree | 4f05bef55fd76ddd7668187e84e7fbc16a4849f6 /fs/jfs/jfs_logmgr.c | |
parent | de8fd087b280797977b012a4275ee53ff2999f3f (diff) |
JFS: Improve sync barrier processing
Under heavy load, hot metadata pages are often locked by non-committed
transactions, making them difficult to flush to disk. This prevents
the sync point from advancing past a transaction that had modified the
page.
There is a point during the sync barrier processing where all
outstanding transactions have been committed to disk, but no new
transaction have been allowed to proceed. This is the best time
to write the metadata.
Signed-off-by: Dave Kleikamp <shaggy@austin.ibm.com>
Diffstat (limited to 'fs/jfs/jfs_logmgr.c')
-rw-r--r-- | fs/jfs/jfs_logmgr.c | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/fs/jfs/jfs_logmgr.c b/fs/jfs/jfs_logmgr.c index 22815e88e7cc..d27bac6acaa3 100644 --- a/fs/jfs/jfs_logmgr.c +++ b/fs/jfs/jfs_logmgr.c | |||
@@ -191,7 +191,7 @@ static int lbmIOWait(struct lbuf * bp, int flag); | |||
191 | static bio_end_io_t lbmIODone; | 191 | static bio_end_io_t lbmIODone; |
192 | static void lbmStartIO(struct lbuf * bp); | 192 | static void lbmStartIO(struct lbuf * bp); |
193 | static void lmGCwrite(struct jfs_log * log, int cant_block); | 193 | static void lmGCwrite(struct jfs_log * log, int cant_block); |
194 | static int lmLogSync(struct jfs_log * log, int nosyncwait); | 194 | static int lmLogSync(struct jfs_log * log, int hard_sync); |
195 | 195 | ||
196 | 196 | ||
197 | 197 | ||
@@ -915,19 +915,17 @@ static void lmPostGC(struct lbuf * bp) | |||
915 | * if new sync address is available | 915 | * if new sync address is available |
916 | * (normally the case if sync() is executed by back-ground | 916 | * (normally the case if sync() is executed by back-ground |
917 | * process). | 917 | * process). |
918 | * if not, explicitly run jfs_blogsync() to initiate | ||
919 | * getting of new sync address. | ||
920 | * calculate new value of i_nextsync which determines when | 918 | * calculate new value of i_nextsync which determines when |
921 | * this code is called again. | 919 | * this code is called again. |
922 | * | 920 | * |
923 | * PARAMETERS: log - log structure | 921 | * PARAMETERS: log - log structure |
924 | * nosyncwait - 1 if called asynchronously | 922 | * hard_sync - 1 to force all metadata to be written |
925 | * | 923 | * |
926 | * RETURN: 0 | 924 | * RETURN: 0 |
927 | * | 925 | * |
928 | * serialization: LOG_LOCK() held on entry/exit | 926 | * serialization: LOG_LOCK() held on entry/exit |
929 | */ | 927 | */ |
930 | static int lmLogSync(struct jfs_log * log, int nosyncwait) | 928 | static int lmLogSync(struct jfs_log * log, int hard_sync) |
931 | { | 929 | { |
932 | int logsize; | 930 | int logsize; |
933 | int written; /* written since last syncpt */ | 931 | int written; /* written since last syncpt */ |
@@ -941,11 +939,18 @@ static int lmLogSync(struct jfs_log * log, int nosyncwait) | |||
941 | unsigned long flags; | 939 | unsigned long flags; |
942 | 940 | ||
943 | /* push dirty metapages out to disk */ | 941 | /* push dirty metapages out to disk */ |
944 | list_for_each_entry(sbi, &log->sb_list, log_list) { | 942 | if (hard_sync) |
945 | filemap_flush(sbi->ipbmap->i_mapping); | 943 | list_for_each_entry(sbi, &log->sb_list, log_list) { |
946 | filemap_flush(sbi->ipimap->i_mapping); | 944 | filemap_fdatawrite(sbi->ipbmap->i_mapping); |
947 | filemap_flush(sbi->direct_inode->i_mapping); | 945 | filemap_fdatawrite(sbi->ipimap->i_mapping); |
948 | } | 946 | filemap_fdatawrite(sbi->direct_inode->i_mapping); |
947 | } | ||
948 | else | ||
949 | list_for_each_entry(sbi, &log->sb_list, log_list) { | ||
950 | filemap_flush(sbi->ipbmap->i_mapping); | ||
951 | filemap_flush(sbi->ipimap->i_mapping); | ||
952 | filemap_flush(sbi->direct_inode->i_mapping); | ||
953 | } | ||
949 | 954 | ||
950 | /* | 955 | /* |
951 | * forward syncpt | 956 | * forward syncpt |
@@ -1021,10 +1026,6 @@ static int lmLogSync(struct jfs_log * log, int nosyncwait) | |||
1021 | /* next syncpt trigger = written + more */ | 1026 | /* next syncpt trigger = written + more */ |
1022 | log->nextsync = written + more; | 1027 | log->nextsync = written + more; |
1023 | 1028 | ||
1024 | /* return if lmLogSync() from outside of transaction, e.g., sync() */ | ||
1025 | if (nosyncwait) | ||
1026 | return lsn; | ||
1027 | |||
1028 | /* if number of bytes written from last sync point is more | 1029 | /* if number of bytes written from last sync point is more |
1029 | * than 1/4 of the log size, stop new transactions from | 1030 | * than 1/4 of the log size, stop new transactions from |
1030 | * starting until all current transactions are completed | 1031 | * starting until all current transactions are completed |
@@ -1049,11 +1050,12 @@ static int lmLogSync(struct jfs_log * log, int nosyncwait) | |||
1049 | * | 1050 | * |
1050 | * FUNCTION: write log SYNCPT record for specified log | 1051 | * FUNCTION: write log SYNCPT record for specified log |
1051 | * | 1052 | * |
1052 | * PARAMETERS: log - log structure | 1053 | * PARAMETERS: log - log structure |
1054 | * hard_sync - set to 1 to force metadata to be written | ||
1053 | */ | 1055 | */ |
1054 | void jfs_syncpt(struct jfs_log *log) | 1056 | void jfs_syncpt(struct jfs_log *log, int hard_sync) |
1055 | { LOG_LOCK(log); | 1057 | { LOG_LOCK(log); |
1056 | lmLogSync(log, 1); | 1058 | lmLogSync(log, hard_sync); |
1057 | LOG_UNLOCK(log); | 1059 | LOG_UNLOCK(log); |
1058 | } | 1060 | } |
1059 | 1061 | ||