Skip to contentSkip to conversation

btrfs: space-info: fix the wrong trace name for bytes_may_use

PATCH In review Qu Wenruo 4 participants 5 messages Oct 12, 2020 – Oct 22, 2020 Btrfs file system

lore
Share & tools
lore

Qu Wenruo

author
#0 lore raw

PATCH 1/1 btrfs: space-info: fix the wrong trace name for bytes_may_use

The trace_name for bytes_may_use should be "may_use", "space_info".

Fixes f3e75e3805e1 ("btrfs: roll tracepoint into btrfs_space_info_update helper")
---
 fs/btrfs/space-info.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/space-info.h +1 -1
index c3c64019950a..25fe03a53fb8 100644
@@ -113,7 +113,7 @@ btrfs_space_info_update_##name(struct btrfs_fs_info *fs_info,		\
 	sinfo->name += bytes;						\
 }
 
-DECLARE_SPACE_INFO_UPDATE(bytes_may_use, "space_info");
+DECLARE_SPACE_INFO_UPDATE(bytes_may_use, "may_use");
 DECLARE_SPACE_INFO_UPDATE(bytes_pinned, "pinned");
 
 int btrfs_init_space_info(struct btrfs_fs_info *fs_info);
Signature · 1 line
2.28.0
#2 lore raw
In reply to Qu Wenruo
Quoted 3 lines · Qu Wenruo

The trace_name for bytes_may_use should be "may_use", "space_info".

Fixes f3e75e3805e1 ("btrfs: roll tracepoint into btrfs_space_info_update helper")

This patch reduced all calls to the definition and kept the same output, ie. the 'space_info' so it was correct and the Fixes does not seem to be right here. You should explain why the 'may_use' is supposed to be there.

#3 lore raw
Quoted 10 lines · David Sterba
Quoted 3 lines · Qu Wenruo

The trace_name for bytes_may_use should be "may_use", "space_info".

Fixes f3e75e3805e1 ("btrfs: roll tracepoint into btrfs_space_info_update helper")

This patch reduced all calls to the definition and kept the same output, ie. the 'space_info' so it was correct and the Fixes does not seem to be right here. You should explain why the 'may_use' is supposed to be there.

The next bytes_pinned still uses "pinned" for its name.

And in the DECLARE_SPACE_INFO_UPDATE(), the @trace_name is only passed to trcae_btrfs_space_reservation(), to indicate the cause of the trace event.

Under most case, we pass things like "space_info:enospc" for cases we will going to return -ENOSPC, and for other cases, we pass what we're reserving for, like in btrfs_delalloc_reserve_metadata().

For the bytes_may_use case, the DECLARE_SPACE_INFO_UPDATE() is definitely not called for ENOSPC, thus it should what we're reserving for. Since the declared function has no real context, thus using the "may_use" looks completely sane to me.

The fixes looks correct, as it looks like a copy-n-paste error from that commit.

Or did I miss somthing?

Thanks,
Qu

#4 lore raw
Quoted 21 lines · Qu Wenruo
Quoted 10 lines · David Sterba
Quoted 3 lines · Qu Wenruo

The trace_name for bytes_may_use should be "may_use", "space_info".

Fixes f3e75e3805e1 ("btrfs: roll tracepoint into btrfs_space_info_update helper")

This patch reduced all calls to the definition and kept the same output, ie. the 'space_info' so it was correct and the Fixes does not seem to be right here. You should explain why the 'may_use' is supposed to be there.

The next bytes_pinned still uses "pinned" for its name.

And in the DECLARE_SPACE_INFO_UPDATE(), the @trace_name is only passed to trcae_btrfs_space_reservation(), to indicate the cause of the trace event.

Under most case, we pass things like "space_info:enospc" for cases we will going to return -ENOSPC, and for other cases, we pass what we're reserving for, like in btrfs_delalloc_reserve_metadata().

Quoted 7 lines

For the bytes_may_use case, the DECLARE_SPACE_INFO_UPDATE() is definitely not called for ENOSPC, thus it should what we're reserving for. Since the declared function has no real context, thus using the "may_use" looks completely sane to me.

The fixes looks correct, as it looks like a copy-n-paste error from that commit.

The commit dropped the trace_ call and moved it to the update function, so the string "space_info" made it to btrfs_space_info_update_bytes_may_use.

                btrfs_space_info_update_bytes_may_use(fs_info, sinfo,
                                                      -num_bytes);

- trace_btrfs_space_reservation(fs_info, "space_info",
- sinfo->flags, num_bytes, 0);

so there was no copy&paste error.

What I am missing is changelog rationale behind the change from space_info to may_use. If 'may_use' should do the same as 'pinned', then please explain it or give hints how to verify that the change is correct.

'The trace_name for bytes_may_use should be "may_use", "space_info".'

just begs to ask "why?".