diff options
author | Miao Xie <miaox@cn.fujitsu.com> | 2014-02-20 18:08:59 +0800 |
---|---|---|
committer | Josef Bacik <jbacik@fb.com> | 2014-03-10 15:16:43 -0400 |
commit | d1433debe7f4346cf9fc0dafc71c3137d2a97bc4 (patch) | |
tree | 1cc86b5bc4a40a9ffc568ae0dbfd78bae4360c54 /fs/btrfs/tree-log.h | |
parent | 8b050d350c7846462a21e9e054c9154ede9b43cf (diff) | |
download | blackbird-op-linux-d1433debe7f4346cf9fc0dafc71c3137d2a97bc4.tar.gz blackbird-op-linux-d1433debe7f4346cf9fc0dafc71c3137d2a97bc4.zip |
Btrfs: just wait or commit our own log sub-transaction
We might commit the log sub-transaction which didn't contain the metadata we
logged. It was because we didn't record the log transid and just select
the current log sub-transaction to commit, but the right one might be
committed by the other task already. Actually, we needn't do anything
and it is safe that we go back directly in this case.
This patch improves the log sync by the above idea. We record the transid
of the log sub-transaction in which we log the metadata, and the transid
of the log sub-transaction we have committed. If the committed transid
is >= the transid we record when logging the metadata, we just go back.
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Josef Bacik <jbacik@fb.com>
Diffstat (limited to 'fs/btrfs/tree-log.h')
-rw-r--r-- | fs/btrfs/tree-log.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/btrfs/tree-log.h b/fs/btrfs/tree-log.h index 59c1edb31d19..91b145fce333 100644 --- a/fs/btrfs/tree-log.h +++ b/fs/btrfs/tree-log.h @@ -24,12 +24,14 @@ struct btrfs_log_ctx { int log_ret; + int log_transid; struct list_head list; }; static inline void btrfs_init_log_ctx(struct btrfs_log_ctx *ctx) { ctx->log_ret = 0; + ctx->log_transid = 0; INIT_LIST_HEAD(&ctx->list); } |