btrfs: tree-log: add and rename extent bits for dirty_log_pages tree
Subsystems (2)
David Sterba
maintainerPATCH 1/1 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 <[email protected]>
--- fs/btrfs/extent-io-tree.h | 3 ++- fs/btrfs/extent-tree.c | 4 ++-- fs/btrfs/tests/extent-io-tests.c | 3 ++- fs/btrfs/transaction.c | 4 ++-- fs/btrfs/tree-log.c | 12 ++++++------ include/trace/events/btrfs.h | 3 ++- 6 files changed, 16 insertions(+), 13 deletions(-)
fs/btrfs/extent-io-tree.h +2 -1
@@ -19,7 +19,8 @@ enum {ENUM_BIT (EXTENT_DIRTY ),ENUM_BIT (EXTENT_LOCKED ),ENUM_BIT (EXTENT_DIO_LOCKED ), -ENUM_BIT (EXTENT_NEW ), +ENUM_BIT (EXTENT_DIRTY_LOG1 ), +ENUM_BIT (EXTENT_DIRTY_LOG2 ),ENUM_BIT (EXTENT_DELALLOC ),ENUM_BIT (EXTENT_DEFRAG ), ENUM_BIT(EXTENT_BOUNDARY),
fs/btrfs/extent-tree.c +2 -2
@@ -5142,11 +5142,11 @@ btrfs_init_new_buffer(struct btrfs_trans_handle *trans, struct btrfs_root *root,if (buf->log_index ==0 )btrfs_set_extent_bit (&root->dirty_log_pages, buf->start, buf->start + buf->len -1 , -EXTENT_DIRTY ,NULL ); +EXTENT_DIRTY_LOG1 ,NULL );else btrfs_set_extent_bit (&root->dirty_log_pages, buf->start, buf->start + buf->len -1 , -EXTENT_NEW ,NULL ); +EXTENT_DIRTY_LOG2 ,NULL ); }else { buf->log_index =-1 ; btrfs_set_extent_bit(&trans->transaction->dirty_pages, buf->start,
fs/btrfs/tests/extent-io-tests.c +2 -1
@@ -75,7 +75,8 @@ static void extent_flag_to_str(const struct extent_state *state, char *dest) dest[0 ] =0 ;PRINT_ONE_FLAG (state, dest, cur,DIRTY );PRINT_ONE_FLAG (state, dest, cur,LOCKED ); -PRINT_ONE_FLAG (state, dest, cur,NEW ); +PRINT_ONE_FLAG (state, dest, cur,DIRTY_LOG1 ); +PRINT_ONE_FLAG (state, dest, cur,DIRTY_LOG2 );PRINT_ONE_FLAG (state, dest, cur,DELALLOC );PRINT_ONE_FLAG (state, dest, cur,DEFRAG );PRINT_ONE_FLAG (state, dest, cur,BOUNDARY );
fs/btrfs/transaction.c +2 -2
@@ -1232,11 +1232,11 @@ int btrfs_wait_tree_log_extents(struct btrfs_root *log_root, int mark)ASSERT (btrfs_root_id (log_root) ==BTRFS_TREE_LOG_OBJECTID ); ret =__btrfs_wait_marked_extents (fs_info, dirty_pages); -if ((mark &EXTENT_DIRTY ) && +if ((mark &EXTENT_DIRTY_LOG1 ) &&test_and_clear_bit (BTRFS_FS_LOG1_ERR , &fs_info->flags)) errors = true; -if ((mark &EXTENT_NEW ) && +if ((mark &EXTENT_DIRTY_LOG2 ) &&test_and_clear_bit (BTRFS_FS_LOG2_ERR , &fs_info->flags)) errors = true;
fs/btrfs/tree-log.c +6 -6
@@ -2961,9 +2961,9 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans, }if (log_transid %2 ==0 ) - mark =EXTENT_DIRTY ; + mark =EXTENT_DIRTY_LOG1 ;else - mark =EXTENT_NEW ; + mark =EXTENT_DIRTY_LOG2 ;/* we start IO on all the marked extents here, but we don't actually * wait for them until later.
@@ -3094,7 +3094,7 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans, ret =btrfs_write_marked_extents (fs_info, &log_root_tree->dirty_log_pages, -EXTENT_DIRTY |EXTENT_NEW ); +EXTENT_DIRTY_LOG1 |EXTENT_DIRTY_LOG2 );blk_finish_plug (&plug);/* * As described above, -EAGAIN indicates a hole in the extents. We
@@ -3114,7 +3114,7 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans, ret =btrfs_wait_tree_log_extents (log, mark);if (!ret) ret =btrfs_wait_tree_log_extents (log_root_tree, -EXTENT_NEW |EXTENT_DIRTY ); +EXTENT_DIRTY_LOG1 |EXTENT_DIRTY_LOG2 );if (ret) {btrfs_set_log_full_commit (trans);mutex_unlock (&log_root_tree->log_mutex);
@@ -3240,9 +3240,9 @@ static void free_log_tree(struct btrfs_trans_handle *trans,*/ btrfs_write_marked_extents (log->fs_info, &log->dirty_log_pages, -EXTENT_DIRTY |EXTENT_NEW ); +EXTENT_DIRTY_LOG1 |EXTENT_DIRTY_LOG2 );btrfs_wait_tree_log_extents (log, -EXTENT_DIRTY |EXTENT_NEW ); +EXTENT_DIRTY_LOG1 |EXTENT_DIRTY_LOG2 );if (trans)btrfs_abort_transaction (trans, ret);
include/trace/events/btrfs.h +2 -1
@@ -144,7 +144,8 @@ FLUSH_STATES#define EXTENT_FLAGS \ { EXTENT_DIRTY, "DIRTY"}, \ { EXTENT_LOCKED, "LOCKED"}, \ - { EXTENT_NEW, "NEW"}, \ + { EXTENT_DIRTY_LOG1, "DIRTY_LOG1"}, \ + { EXTENT_DIRTY_LOG2, "DIRTY_LOG2"}, \ { EXTENT_DELALLOC, "DELALLOC"}, \ { EXTENT_DEFRAG, "DEFRAG"}, \ { EXTENT_BOUNDARY, "BOUNDARY"}, \
Signature · 1 line
2.47.1