diff --git a/src/dwarfs/filesystem_v2.cpp b/src/dwarfs/filesystem_v2.cpp index 0d388be4..b2b0fea8 100644 --- a/src/dwarfs/filesystem_v2.cpp +++ b/src/dwarfs/filesystem_v2.cpp @@ -537,7 +537,7 @@ int filesystem_v2::identify(logger& lgr, std::shared_ptr mm, if (errors == 0 and detail_level > 0) { filesystem_options fsopts; - if (detail_level > 1) { + if (detail_level > 0) { fsopts.metadata.enable_nlink = true; } filesystem_v2(lgr, mm, fsopts).dump(os, detail_level); diff --git a/src/dwarfs/metadata_v2.cpp b/src/dwarfs/metadata_v2.cpp index ce41ada9..bc335e39 100644 --- a/src/dwarfs/metadata_v2.cpp +++ b/src/dwarfs/metadata_v2.cpp @@ -41,6 +41,7 @@ #include #include +#include #include @@ -102,6 +103,7 @@ void analyze_frozen(std::ostream& os, MappedFrozen const& meta, size_t total_size, int detail) { using namespace ::apache::thrift::frozen; + std::locale loc(""); auto layout = meta.findFirstOfType< std::unique_ptr>>(); @@ -111,13 +113,14 @@ void analyze_frozen(std::ostream& os, auto fmt_size = [&](auto const& name, size_t count, size_t size) { return fmt::format( - "{0:>10} {1:.<20}{2:.>13L} bytes {3:5.1f}% {4:5.1f} bytes/item\n", + loc, "{0:>14L} {1:.<20}{2:.>16L} bytes {3:5.1f}% {4:5.1f} bytes/item\n", count, name, size, 100.0 * size / total_size, count > 0 ? static_cast(size) / count : 0.0); }; auto fmt_detail = [&](auto const& name, size_t count, size_t size) { - return fmt::format(" {0:<20}{1:>13L} bytes {2:5.1f}% " + return fmt::format(loc, + " {0:<20}{1:>16L} bytes {2:5.1f}% " "{3:5.1f} bytes/item\n", name, size, 100.0 * size / total_size, count > 0 ? static_cast(size) / count : 0.0); @@ -216,7 +219,8 @@ void analyze_frozen(std::ostream& os, os << "metadata memory usage:\n"; os << fmt::format( - " {0:.<20}{1:.>13L} bytes {2:6.1f} bytes/inode\n", + loc, + " {0:.<20}{1:.>16L} bytes {2:6.1f} bytes/inode\n", "total metadata", total_size, static_cast(total_size) / meta.inodes().size()); @@ -748,9 +752,10 @@ void metadata_::dump( } if (detail_level > 0) { - os << "block size: " << stbuf.f_bsize << std::endl; + os << "block size: " << size_with_unit(stbuf.f_bsize) << std::endl; os << "inode count: " << stbuf.f_files << std::endl; - os << "original filesystem size: " << stbuf.f_blocks << std::endl; + os << "original filesystem size: " << size_with_unit(stbuf.f_blocks) + << std::endl; if (auto opt = meta_.options()) { std::vector options; auto boolopt = [&](auto const& name, bool value) { diff --git a/src/dwarfsck.cpp b/src/dwarfsck.cpp index ac64b444..7736fb8b 100644 --- a/src/dwarfsck.cpp +++ b/src/dwarfsck.cpp @@ -56,7 +56,7 @@ int dwarfsck(int argc, char** argv) { po::value(&input), "input filesystem") ("detail,d", - po::value(&detail)->default_value(1), + po::value(&detail)->default_value(2), "detail level") ("num-workers,n", po::value(&num_workers)->default_value(num_cpu),