Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does current version of btrfs support Host-Managed Garbage Collection on Zone namespace ssd? #768

Closed
sg20180546 opened this issue Mar 29, 2024 · 4 comments
Labels
docs Changes in documentation or help text question Not a bug, clarifications, undocumented behaviour
Milestone

Comments

@sg20180546
Copy link

sg20180546 commented Mar 29, 2024

hello I am Zone Namespace ssd researcher from south korea.

i have one question about btrfs but i cannot found way to ask btrfs maintainer.

so my question is,

does latest version of btrfs implement Host Manage Garbage collection ?

If i repeat write intensive filebench or rocksdb fillrandom and delete every files in mount directory,
btrfs emits error message for 'BTRFS: error (device nvme0n2: state A) in btrfs_del_csums:1014: errno=-28 No space left'.

but files are all deleted, invalidate space should be zone-reset and reclaimed.

however, as my knowledge, there's no codeline about copy operations for host managed gc.
is it not supported? or i'm missing some important facts.

thanks.

  • i am using kernel 6.4 and WD ZN540
@kdave kdave added the question Not a bug, clarifications, undocumented behaviour label Apr 2, 2024
@kdave
Copy link
Owner

kdave commented Apr 2, 2024

i have one question about btrfs but i cannot found way to ask btrfs maintainer.

It's OK to ask here.

Yes garbat collection is supported, it's not called like that though. In code you could find references to zone_unusable and block group reclaim. The main function that does all the work is btrfs_reclaim_bgs_work().

but files are all deleted, invalidate space should be zone-reset and reclaimed.

The workload you describe could fill the drives too fast and the reclaim does not keep up, so it ends up as ENOSPC at some point. You'd need to watch how much unreclaimable space there is (eg. in btrfs fi df), either wait until it's gone or run btrfs filesystem balance to reclaim the space faster (although for now there ar no specific filters for the unusable space).

however, as my knowledge, there's no codeline about copy operations for host managed gc. is it not supported? or i'm missing some important facts.

I'm not sure if I understand what you mean by copy operations and gc, it still sounds like what the reclaim process does. Block groups that have more unusable space than a threshold (configurable in sysfs) are put to a list and then reclaimed. This is done using the relocation mechanism that does copy the old data to new location and then updates pointers.

* i am using kernel 6.4 and WD ZN540

The zoned support is still improving in each release so you could also verify the behaviour on newer kernels, 6.8 or even the latest 6.9-rcX. There was a recent fix https://git.kernel.org/linus/a8b70c7f8600bc77d03c0b032c0662259b9e615e that could be related to what you see.

@kdave kdave added the docs Changes in documentation or help text label Apr 2, 2024
@kdave
Copy link
Owner

kdave commented Apr 2, 2024

Note for documentation: add section about the reclaim/gc behaviour, it's missing.

@naota
Copy link
Contributor

naota commented Apr 5, 2024

Hello @sg20180546
I'm sorry I missed your email several days ago.

As David said, btrfs_reclaim_bgs_work() reclaims existing BGs that still have some data in them.

Also, when a block group is fully unused, that block group is reset in btrfs_finish_extent_commit().

Regarding the early ENOSPC issue, there is an on-going patch and discussion about that. In short, btrfs does the reclaiming, but it might not be fast enough.

https://lore.kernel.org/linux-btrfs/[email protected]/

kdave added a commit that referenced this issue Jul 30, 2024
[ci skip]

Issue: #768
Signed-off-by: David Sterba <[email protected]>
@kdave
Copy link
Owner

kdave commented Jul 30, 2024

Documentation updated.

@kdave kdave closed this as completed Jul 30, 2024
@kdave kdave added this to the v6.10 milestone Jul 30, 2024
kdave added a commit that referenced this issue Jul 30, 2024
[ci skip]

Issue: #768
Signed-off-by: David Sterba <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Changes in documentation or help text question Not a bug, clarifications, undocumented behaviour
Projects
None yet
Development

No branches or pull requests

3 participants