Giter Club home page Giter Club logo

Comments (4)

knorrie avatar knorrie commented on May 17, 2024

Ah, duh...

-# ./show_usage.py /mnt/tutorial
dev item devid 1 total bytes 6442450944 bytes used 3026583552
dev item devid 2 total bytes 6442450944 bytes used 1961230336
dev item devid 3 total bytes 6442450944 bytes used 3034972160
block group vaddr 20971520 length 8388608 flags SYSTEM|RAID1 used 16384 used_pct 0
    chunk vaddr 20971520 type SYSTEM|RAID1 length 8388608 num_stripes 2
        stripe devid 3 offset 1048576
        stripe devid 2 offset 1048576
block group vaddr 29360128 length 1073741824 flags METADATA|RAID1 used 140083200 used_pct 13
    chunk vaddr 29360128 type METADATA|RAID1 length 1073741824 num_stripes 2
        stripe devid 1 offset 20971520
        stripe devid 3 offset 9437184
block group vaddr 1103101952 length 1932656640 flags DATA|RAID0 used 1932591104 used_pct 100
    chunk vaddr 1103101952 type DATA|RAID0 length 1932656640 num_stripes 3
        stripe devid 2 offset 9437184
        stripe devid 1 offset 1094713344
        stripe devid 3 offset 1083179008
block group vaddr 3035758592 length 1962934272 flags DATA|RAID0 used 1962934272 used_pct 100
    chunk vaddr 3035758592 type DATA|RAID0 length 1962934272 num_stripes 3
        stripe devid 2 offset 653656064
        stripe devid 1 offset 1738932224
        stripe devid 3 offset 1727397888
block group vaddr 4998692864 length 1962934272 flags DATA|RAID0 used 955039744 used_pct 49
    chunk vaddr 4998692864 type DATA|RAID0 length 1962934272 num_stripes 3
        stripe devid 2 offset 1307967488
        stripe devid 1 offset 2393243648
        stripe devid 3 offset 2381709312

And I'm doing (line 370):

length = chunk.length * len(stripes)

That of course is the wrong thing to do for a RAID0 chunk. Instead, I need to have a look at the device extent objects for these stripe, and take the sum of their length.

from btrfs-heatmap.

knorrie avatar knorrie commented on May 17, 2024

Euh, no. Looking up device extents objects for each stripe would be a large waste of cpu and disk io. When the amount of stripe items in the chunk is known and the profile, we can calcute the actual total usage on disk with a few simple rules.

from btrfs-heatmap.

knorrie avatar knorrie commented on May 17, 2024

(commit ids might change because I tend to force-push in the development branch)

So, next btrfs-heatmap will depend on the next python-btrfs version.

from btrfs-heatmap.

knorrie avatar knorrie commented on May 17, 2024

Ok, this is done. Just tagged v8 (which needs python-btrfs v10 for --sort virtual) and now it produces correct pictures and does not crash any more.

from btrfs-heatmap.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.