hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/fs/btrfs/tree-log.h
....@@ -15,10 +15,12 @@
1515 struct btrfs_log_ctx {
1616 int log_ret;
1717 int log_transid;
18
- int io_err;
1918 bool log_new_dentries;
19
+ bool logging_new_name;
2020 struct inode *inode;
2121 struct list_head list;
22
+ /* Only used for fast fsyncs. */
23
+ struct list_head ordered_extents;
2224 };
2325
2426 static inline void btrfs_init_log_ctx(struct btrfs_log_ctx *ctx,
....@@ -26,22 +28,34 @@
2628 {
2729 ctx->log_ret = 0;
2830 ctx->log_transid = 0;
29
- ctx->io_err = 0;
3031 ctx->log_new_dentries = false;
32
+ ctx->logging_new_name = false;
3133 ctx->inode = inode;
3234 INIT_LIST_HEAD(&ctx->list);
35
+ INIT_LIST_HEAD(&ctx->ordered_extents);
3336 }
3437
35
-static inline void btrfs_set_log_full_commit(struct btrfs_fs_info *fs_info,
36
- struct btrfs_trans_handle *trans)
38
+static inline void btrfs_release_log_ctx_extents(struct btrfs_log_ctx *ctx)
3739 {
38
- WRITE_ONCE(fs_info->last_trans_log_full_commit, trans->transid);
40
+ struct btrfs_ordered_extent *ordered;
41
+ struct btrfs_ordered_extent *tmp;
42
+
43
+ ASSERT(inode_is_locked(ctx->inode));
44
+
45
+ list_for_each_entry_safe(ordered, tmp, &ctx->ordered_extents, log_list) {
46
+ list_del_init(&ordered->log_list);
47
+ btrfs_put_ordered_extent(ordered);
48
+ }
3949 }
4050
41
-static inline int btrfs_need_log_full_commit(struct btrfs_fs_info *fs_info,
42
- struct btrfs_trans_handle *trans)
51
+static inline void btrfs_set_log_full_commit(struct btrfs_trans_handle *trans)
4352 {
44
- return READ_ONCE(fs_info->last_trans_log_full_commit) ==
53
+ WRITE_ONCE(trans->fs_info->last_trans_log_full_commit, trans->transid);
54
+}
55
+
56
+static inline int btrfs_need_log_full_commit(struct btrfs_trans_handle *trans)
57
+{
58
+ return READ_ONCE(trans->fs_info->last_trans_log_full_commit) ==
4559 trans->transid;
4660 }
4761
....@@ -53,8 +67,6 @@
5367 int btrfs_recover_log_trees(struct btrfs_root *tree_root);
5468 int btrfs_log_dentry_safe(struct btrfs_trans_handle *trans,
5569 struct dentry *dentry,
56
- const loff_t start,
57
- const loff_t end,
5870 struct btrfs_log_ctx *ctx);
5971 int btrfs_del_dir_entries_in_log(struct btrfs_trans_handle *trans,
6072 struct btrfs_root *root,
....@@ -65,22 +77,14 @@
6577 const char *name, int name_len,
6678 struct btrfs_inode *inode, u64 dirid);
6779 void btrfs_end_log_trans(struct btrfs_root *root);
68
-int btrfs_pin_log_trans(struct btrfs_root *root);
80
+void btrfs_pin_log_trans(struct btrfs_root *root);
6981 void btrfs_record_unlink_dir(struct btrfs_trans_handle *trans,
7082 struct btrfs_inode *dir, struct btrfs_inode *inode,
7183 int for_rename);
7284 void btrfs_record_snapshot_destroy(struct btrfs_trans_handle *trans,
7385 struct btrfs_inode *dir);
74
-/* Return values for btrfs_log_new_name() */
75
-enum {
76
- BTRFS_DONT_NEED_TRANS_COMMIT,
77
- BTRFS_NEED_TRANS_COMMIT,
78
- BTRFS_DONT_NEED_LOG_SYNC,
79
- BTRFS_NEED_LOG_SYNC,
80
-};
81
-int btrfs_log_new_name(struct btrfs_trans_handle *trans,
86
+void btrfs_log_new_name(struct btrfs_trans_handle *trans,
8287 struct btrfs_inode *inode, struct btrfs_inode *old_dir,
83
- struct dentry *parent,
84
- bool sync_log, struct btrfs_log_ctx *ctx);
88
+ struct dentry *parent);
8589
8690 #endif