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>
This commit is contained in:
@@ -19,6 +19,9 @@
|
||||
#ifndef __TREE_LOG_
|
||||
#define __TREE_LOG_
|
||||
|
||||
#include "ctree.h"
|
||||
#include "transaction.h"
|
||||
|
||||
/* return value for btrfs_log_dentry_safe that means we don't need to log it at all */
|
||||
#define BTRFS_NO_LOG_SYNC 256
|
||||
|
||||
@@ -35,6 +38,19 @@ static inline void btrfs_init_log_ctx(struct btrfs_log_ctx *ctx)
|
||||
INIT_LIST_HEAD(&ctx->list);
|
||||
}
|
||||
|
||||
static inline void btrfs_set_log_full_commit(struct btrfs_fs_info *fs_info,
|
||||
struct btrfs_trans_handle *trans)
|
||||
{
|
||||
ACCESS_ONCE(fs_info->last_trans_log_full_commit) = trans->transid;
|
||||
}
|
||||
|
||||
static inline int btrfs_need_log_full_commit(struct btrfs_fs_info *fs_info,
|
||||
struct btrfs_trans_handle *trans)
|
||||
{
|
||||
return ACCESS_ONCE(fs_info->last_trans_log_full_commit) ==
|
||||
trans->transid;
|
||||
}
|
||||
|
||||
int btrfs_sync_log(struct btrfs_trans_handle *trans,
|
||||
struct btrfs_root *root, struct btrfs_log_ctx *ctx);
|
||||
int btrfs_free_log(struct btrfs_trans_handle *trans, struct btrfs_root *root);
|
||||
|
Reference in New Issue
Block a user