Re: [PATCH 11/11 v3] btrfs: Use btrfs_transaction::pinned_extents

David Sterba
2020-02-14T15:34:03Z

On Thu, Feb 06, 2020 at 09:40:35PM +0200, Nikolay Borisov wrote:
>
>
> On 6.02.20 г. 20:10 ч., David Sterba wrote:
> > On Fri, Jan 24, 2020 at 05:18:30PM +0200, Nikolay Borisov wrote:
> >> --- a/fs/btrfs/transaction.c
> >> +++ b/fs/btrfs/transaction.c
> >> @@ -334,6 +334,7 @@ static noinline int join_transaction(struct btrfs_fs_info *fs_info,
> >> list_add_tail(&cur_trans->list, &fs_info->trans_list);
> >> extent_io_tree_init(fs_info, &cur_trans->dirty_pages,
> >> IO_TREE_TRANS_DIRTY_PAGES, fs_info->btree_inode);
> >> + extent_io_tree_init(fs_info, &cur_trans->pinned_extents, 0, NULL);
> >
> > What's the reason there's no symbolic name for pinned_extents? Also 0
> > matches IO_TREE_FS_INFO_EXCLUDED_EXTENTS because it's first in the enum
> > list.
> >
>
> No reason, I'll change it in next version :)

Patchset going to misc-next with the following fixup:

--- a/fs/btrfs/extent-io-tree.h
+++ b/fs/btrfs/extent-io-tree.h
@@ -36,6 +36,7 @@ struct io_failure_record;
#define CHUNK_TRIMMED EXTENT_DEFRAG

enum {
+ IO_TREE_FS_PINNED_EXTENTS,
IO_TREE_FS_EXCLUDED_EXTENTS,
IO_TREE_INODE_IO,
IO_TREE_INODE_IO_FAILURE,
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index e39cc15646a4..559a7a38d5a8 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -334,7 +334,8 @@ static noinline int join_transaction(struct btrfs_fs_info *fs_info,
list_add_tail(&cur_trans->list, &fs_info->trans_list);
extent_io_tree_init(fs_info, &cur_trans->dirty_pages,
IO_TREE_TRANS_DIRTY_PAGES, fs_info->btree_inode);
- extent_io_tree_init(fs_info, &cur_trans->pinned_extents, 0, NULL);
+ extent_io_tree_init(fs_info, &cur_trans->pinned_extents,
+ IO_TREE_FS_PINNED_EXTENTS, NULL);
fs_info->generation++;
cur_trans->transid = fs_info->generation;
fs_info->running_transaction = cur_trans;
diff --git a/include/trace/events/btrfs.h b/include/trace/events/btrfs.h
index 0f11f1fb982d..bcbc763b8814 100644
--- a/include/trace/events/btrfs.h
+++ b/include/trace/events/btrfs.h
@@ -81,6 +81,7 @@ TRACE_DEFINE_ENUM(COMMIT_TRANS);

#define show_extent_io_tree_owner(owner) \
__print_symbolic(owner, \
+ { IO_TREE_FS_PINNED_EXTENTS, "PINNED_EXTENTS" }, \
{ IO_TREE_FS_EXCLUDED_EXTENTS, "EXCLUDED_EXTENTS" }, \
{ IO_TREE_INODE_IO, "INODE_IO" }, \
{ IO_TREE_INODE_IO_FAILURE, "INODE_IO_FAILURE" }, \