diff options
author | Miao Xie <miaox@cn.fujitsu.com> | 2014-04-02 07:51:06 -0400 |
---|---|---|
committer | Chris Mason <clm@fb.com> | 2014-06-09 20:20:45 -0400 |
commit | 995946dd2961776bb45e653810ae96643fbf4ce8 (patch) | |
tree | 98b3e1b9fd72ccdca5a6fe540cf421a58692deba /fs/btrfs/tree-log.h | |
parent | 1f21ef0a34c37de0daf66fce7141b23b88630f29 (diff) |
Btrfs: use helpers for last_trans_log_full_commit instead of opencode
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs/btrfs/tree-log.h')
-rw-r--r-- | fs/btrfs/tree-log.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/fs/btrfs/tree-log.h b/fs/btrfs/tree-log.h index 91b145fce333..7f5b41bd5373 100644 --- a/fs/btrfs/tree-log.h +++ b/fs/btrfs/tree-log.h | |||
@@ -19,6 +19,9 @@ | |||
19 | #ifndef __TREE_LOG_ | 19 | #ifndef __TREE_LOG_ |
20 | #define __TREE_LOG_ | 20 | #define __TREE_LOG_ |
21 | 21 | ||
22 | #include "ctree.h" | ||
23 | #include "transaction.h" | ||
24 | |||
22 | /* return value for btrfs_log_dentry_safe that means we don't need to log it at all */ | 25 | /* return value for btrfs_log_dentry_safe that means we don't need to log it at all */ |
23 | #define BTRFS_NO_LOG_SYNC 256 | 26 | #define BTRFS_NO_LOG_SYNC 256 |
24 | 27 | ||
@@ -35,6 +38,19 @@ static inline void btrfs_init_log_ctx(struct btrfs_log_ctx *ctx) | |||
35 | INIT_LIST_HEAD(&ctx->list); | 38 | INIT_LIST_HEAD(&ctx->list); |
36 | } | 39 | } |
37 | 40 | ||
41 | static inline void btrfs_set_log_full_commit(struct btrfs_fs_info *fs_info, | ||
42 | struct btrfs_trans_handle *trans) | ||
43 | { | ||
44 | ACCESS_ONCE(fs_info->last_trans_log_full_commit) = trans->transid; | ||
45 | } | ||
46 | |||
47 | static inline int btrfs_need_log_full_commit(struct btrfs_fs_info *fs_info, | ||
48 | struct btrfs_trans_handle *trans) | ||
49 | { | ||
50 | return ACCESS_ONCE(fs_info->last_trans_log_full_commit) == | ||
51 | trans->transid; | ||
52 | } | ||
53 | |||
38 | int btrfs_sync_log(struct btrfs_trans_handle *trans, | 54 | int btrfs_sync_log(struct btrfs_trans_handle *trans, |
39 | struct btrfs_root *root, struct btrfs_log_ctx *ctx); | 55 | struct btrfs_root *root, struct btrfs_log_ctx *ctx); |
40 | int btrfs_free_log(struct btrfs_trans_handle *trans, struct btrfs_root *root); | 56 | int btrfs_free_log(struct btrfs_trans_handle *trans, struct btrfs_root *root); |