diff options
author | Josef Bacik <jbacik@redhat.com> | 2008-11-26 01:14:26 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2008-11-26 01:14:26 -0500 |
commit | e07f7183a486cf9783d1f8c9d2997b5b39eeb2d4 (patch) | |
tree | 74ed3a563add5fa57e80af03f3f712f2910ac39f /include/linux/jbd2.h | |
parent | 032115fcef837a00336ddf7bda584e89789ea498 (diff) |
jbd2: improve jbd2 fsync batching
This patch removes the static sleep time in favor of a more self
optimizing approach where we measure the average amount of time it
takes to commit a transaction to disk and the ammount of time a
transaction has been running. If somebody does a sync write or an
fsync() traditionally we would sleep for 1 jiffies, which depending on
the value of HZ could be a significant amount of time compared to how
long it takes to commit a transaction to the underlying storage. With
this patch instead of sleeping for a jiffie, we check to see if the
amount of time this transaction has been running is less than the
average commit time, and if it is we sleep for the delta using
schedule_hrtimeout to give us a higher precision sleep time. This
greatly benefits high end storage where you could end up sleeping for
longer than it takes to commit the transaction and therefore sitting
idle instead of allowing the transaction to be committed by keeping
the sleep time to a minimum so you are sure to always be doing
something.
Signed-off-by: Josef Bacik <jbacik@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'include/linux/jbd2.h')
-rw-r--r-- | include/linux/jbd2.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h index f36645745489..ab8cef130c28 100644 --- a/include/linux/jbd2.h +++ b/include/linux/jbd2.h | |||
@@ -638,6 +638,11 @@ struct transaction_s | |||
638 | unsigned long t_expires; | 638 | unsigned long t_expires; |
639 | 639 | ||
640 | /* | 640 | /* |
641 | * When this transaction started, in nanoseconds [no locking] | ||
642 | */ | ||
643 | ktime_t t_start_time; | ||
644 | |||
645 | /* | ||
641 | * How many handles used this transaction? [t_handle_lock] | 646 | * How many handles used this transaction? [t_handle_lock] |
642 | */ | 647 | */ |
643 | int t_handle_count; | 648 | int t_handle_count; |
@@ -939,8 +944,18 @@ struct journal_s | |||
939 | struct buffer_head **j_wbuf; | 944 | struct buffer_head **j_wbuf; |
940 | int j_wbufsize; | 945 | int j_wbufsize; |
941 | 946 | ||
947 | /* | ||
948 | * this is the pid of hte last person to run a synchronous operation | ||
949 | * through the journal | ||
950 | */ | ||
942 | pid_t j_last_sync_writer; | 951 | pid_t j_last_sync_writer; |
943 | 952 | ||
953 | /* | ||
954 | * the average amount of time in nanoseconds it takes to commit a | ||
955 | * transaction to disk. [j_state_lock] | ||
956 | */ | ||
957 | u64 j_average_commit_time; | ||
958 | |||
944 | /* This function is called when a transaction is closed */ | 959 | /* This function is called when a transaction is closed */ |
945 | void (*j_commit_callback)(journal_t *, | 960 | void (*j_commit_callback)(journal_t *, |
946 | transaction_t *); | 961 | transaction_t *); |