Skip to content

btrfs-progs: cmds/filesystem: add --usage-ratio and --wasted-bytes options

Qu Wenruo linux-btrfs 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 Latest2 patches 0 repliesNew

Changes in v2 from the cover letter

- Sync the newer kernel uapi
- Remove the "lone" mentions
Now the new options would be "--usage-ratio" and "--wasted-bytes".

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2btrfs-progs: defrag: sync the usage ratio/wasted bytes fine-tunning from kernelkernel-shared/uapi/btrfs.h+36 -30 replies
2/2btrfs-progs: cmds/filesystem: add --usage-ratio and --wasted-bytes for defragDocumentation/btrfs-filesystem.rst cmds/filesystem.c+71 -30 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/2] btrfs-progs: cmds/filesystem: add --usage-ratio and --wasted-bytes options

[CHANGELOG]
v2:
- Sync the newer kernel uapi
- Remove the "lone" mentions
Now the new options would be "--usage-ratio" and "--wasted-bytes".

This the progs support for the new kernel defrag parameters.

This adds 2 new fine tunning parameters, --usage-ratio and --wasted-bytes.

The ratio is between [0, 100] (aka, percentage value), and wasted bytes is between [0, U32_MAX], but in reality the value only makes sense below max file extent size (for both compressed and regular extents). Any value higher than max file extent size would mostly disable the wasted bytes check (as it would always be false).

The default usage ratio is 5%, and 16MiB wasted bytes.
If the kernel doesn't support the new options, it would fall back to the old ioctl flags without the 2 new flags.

Qu Wenruo (2):
btrfs-progs: defrag: sync the usage ratio/wasted bytes fine-tunning
from kernel
btrfs-progs: cmds/filesystem: add --usage-ratio and --wasted-bytes for
defrag

 Documentation/btrfs-filesystem.rst | 21 ++++++++++++
 cmds/filesystem.c                  | 53 ++++++++++++++++++++++++++++--
 kernel-shared/uapi/btrfs.h         | 39 ++++++++++++++++++++--
 3 files changed, 107 insertions(+), 6 deletions(-)

--
2.44.0