Skip to content

Commit 311a64b

Browse files
committed
btrfs: tree-log: add and rename extent bits for dirty_log_pages tree
The dirty_log_pages tree is used for tree logging and marks extents based on log_transid. The bits could be renamed to resemble the LOG1/LOG2 naming used for the BTRFS_FS_LOG1_ERR bits. The DIRTY bit is renamed to LOG1 and NEW to LOG2. Signed-off-by: David Sterba <dsterba@suse.com>
1 parent c4f6ba0 commit 311a64b

File tree

6 files changed

+16
-13
lines changed

6 files changed

+16
-13
lines changed

fs/btrfs/extent-io-tree.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ enum {
1919
ENUM_BIT(EXTENT_DIRTY),
2020
ENUM_BIT(EXTENT_LOCKED),
2121
ENUM_BIT(EXTENT_DIO_LOCKED),
22-
ENUM_BIT(EXTENT_NEW),
22+
ENUM_BIT(EXTENT_DIRTY_LOG1),
23+
ENUM_BIT(EXTENT_DIRTY_LOG2),
2324
ENUM_BIT(EXTENT_DELALLOC),
2425
ENUM_BIT(EXTENT_DEFRAG),
2526
ENUM_BIT(EXTENT_BOUNDARY),

fs/btrfs/extent-tree.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5113,11 +5113,11 @@ btrfs_init_new_buffer(struct btrfs_trans_handle *trans, struct btrfs_root *root,
51135113
if (buf->log_index == 0)
51145114
btrfs_set_extent_bit(&root->dirty_log_pages, buf->start,
51155115
buf->start + buf->len - 1,
5116-
EXTENT_DIRTY, NULL);
5116+
EXTENT_DIRTY_LOG1, NULL);
51175117
else
51185118
btrfs_set_extent_bit(&root->dirty_log_pages, buf->start,
51195119
buf->start + buf->len - 1,
5120-
EXTENT_NEW, NULL);
5120+
EXTENT_DIRTY_LOG2, NULL);
51215121
} else {
51225122
buf->log_index = -1;
51235123
btrfs_set_extent_bit(&trans->transaction->dirty_pages, buf->start,

fs/btrfs/tests/extent-io-tests.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ static void extent_flag_to_str(const struct extent_state *state, char *dest)
7575
dest[0] = 0;
7676
PRINT_ONE_FLAG(state, dest, cur, DIRTY);
7777
PRINT_ONE_FLAG(state, dest, cur, LOCKED);
78-
PRINT_ONE_FLAG(state, dest, cur, NEW);
78+
PRINT_ONE_FLAG(state, dest, cur, DIRTY_LOG1);
79+
PRINT_ONE_FLAG(state, dest, cur, DIRTY_LOG2);
7980
PRINT_ONE_FLAG(state, dest, cur, DELALLOC);
8081
PRINT_ONE_FLAG(state, dest, cur, DEFRAG);
8182
PRINT_ONE_FLAG(state, dest, cur, BOUNDARY);

fs/btrfs/transaction.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1232,11 +1232,11 @@ int btrfs_wait_tree_log_extents(struct btrfs_root *log_root, int mark)
12321232
ASSERT(btrfs_root_id(log_root) == BTRFS_TREE_LOG_OBJECTID);
12331233

12341234
ret = __btrfs_wait_marked_extents(fs_info, dirty_pages);
1235-
if ((mark & EXTENT_DIRTY) &&
1235+
if ((mark & EXTENT_DIRTY_LOG1) &&
12361236
test_and_clear_bit(BTRFS_FS_LOG1_ERR, &fs_info->flags))
12371237
errors = true;
12381238

1239-
if ((mark & EXTENT_NEW) &&
1239+
if ((mark & EXTENT_DIRTY_LOG2) &&
12401240
test_and_clear_bit(BTRFS_FS_LOG2_ERR, &fs_info->flags))
12411241
errors = true;
12421242

fs/btrfs/tree-log.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2961,9 +2961,9 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans,
29612961
}
29622962

29632963
if (log_transid % 2 == 0)
2964-
mark = EXTENT_DIRTY;
2964+
mark = EXTENT_DIRTY_LOG1;
29652965
else
2966-
mark = EXTENT_NEW;
2966+
mark = EXTENT_DIRTY_LOG2;
29672967

29682968
/* we start IO on all the marked extents here, but we don't actually
29692969
* wait for them until later.
@@ -3094,7 +3094,7 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans,
30943094

30953095
ret = btrfs_write_marked_extents(fs_info,
30963096
&log_root_tree->dirty_log_pages,
3097-
EXTENT_DIRTY | EXTENT_NEW);
3097+
EXTENT_DIRTY_LOG1 | EXTENT_DIRTY_LOG2);
30983098
blk_finish_plug(&plug);
30993099
/*
31003100
* As described above, -EAGAIN indicates a hole in the extents. We
@@ -3114,7 +3114,7 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans,
31143114
ret = btrfs_wait_tree_log_extents(log, mark);
31153115
if (!ret)
31163116
ret = btrfs_wait_tree_log_extents(log_root_tree,
3117-
EXTENT_NEW | EXTENT_DIRTY);
3117+
EXTENT_DIRTY_LOG1 | EXTENT_DIRTY_LOG2);
31183118
if (ret) {
31193119
btrfs_set_log_full_commit(trans);
31203120
mutex_unlock(&log_root_tree->log_mutex);
@@ -3240,9 +3240,9 @@ static void free_log_tree(struct btrfs_trans_handle *trans,
32403240
*/
32413241
btrfs_write_marked_extents(log->fs_info,
32423242
&log->dirty_log_pages,
3243-
EXTENT_DIRTY | EXTENT_NEW);
3243+
EXTENT_DIRTY_LOG1 | EXTENT_DIRTY_LOG2);
32443244
btrfs_wait_tree_log_extents(log,
3245-
EXTENT_DIRTY | EXTENT_NEW);
3245+
EXTENT_DIRTY_LOG1 | EXTENT_DIRTY_LOG2);
32463246

32473247
if (trans)
32483248
btrfs_abort_transaction(trans, ret);

include/trace/events/btrfs.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,8 @@ FLUSH_STATES
144144
#define EXTENT_FLAGS \
145145
{ EXTENT_DIRTY, "DIRTY"}, \
146146
{ EXTENT_LOCKED, "LOCKED"}, \
147-
{ EXTENT_NEW, "NEW"}, \
147+
{ EXTENT_DIRTY_LOG1, "DIRTY_LOG1"}, \
148+
{ EXTENT_DIRTY_LOG2, "DIRTY_LOG2"}, \
148149
{ EXTENT_DELALLOC, "DELALLOC"}, \
149150
{ EXTENT_DEFRAG, "DEFRAG"}, \
150151
{ EXTENT_BOUNDARY, "BOUNDARY"}, \

0 commit comments

Comments
 (0)