Created
April 1, 2021 18:33
-
-
Save ivan/4864435ac8f1a0248ab9fd5e37fba145 to your computer and use it in GitHub Desktop.
nixpkgs: xfsprogs: don't defrag files that have <= 1 extent/512MB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From e87f3bd3cb9c3583c9f2f03391a85cfa09e50be7 Mon Sep 17 00:00:00 2001 | |
From: Ivan Kozik <ivan@ludios.org> | |
Date: Sat, 1 Dec 2018 06:06:50 +0000 | |
Subject: [PATCH] xfsprogs: don't defrag files that have <= 1 extent/512MB | |
--- | |
...defrag-files-that-have-1-extent-512MB.patch | 18 ++++++++++++++++++ | |
pkgs/tools/filesystems/xfsprogs/default.nix | 4 ++++ | |
2 files changed, 22 insertions(+) | |
create mode 100644 pkgs/tools/filesystems/xfsprogs/0001-Don-t-defrag-files-that-have-1-extent-512MB.patch | |
diff --git a/pkgs/tools/filesystems/xfsprogs/0001-Don-t-defrag-files-that-have-1-extent-512MB.patch b/pkgs/tools/filesystems/xfsprogs/0001-Don-t-defrag-files-that-have-1-extent-512MB.patch | |
new file mode 100644 | |
index 00000000000..ec840a659bf | |
--- /dev/null | |
+++ b/pkgs/tools/filesystems/xfsprogs/0001-Don-t-defrag-files-that-have-1-extent-512MB.patch | |
@@ -0,0 +1,18 @@ | |
+diff --git a/fsr/xfs_fsr.c b/fsr/xfs_fsr.c | |
+index 77a10a1d..a88b5c74 100644 | |
+--- a/fsr/xfs_fsr.c | |
++++ b/fsr/xfs_fsr.c | |
+@@ -649,6 +649,13 @@ fsrfs(char *mntdir, xfs_ino_t startino, int targetrange) | |
+ continue; | |
+ } | |
+ | |
++ if (p->bs_extents <= (p->bs_size / (512 * 1024 * 1024))) { | |
++ if (dflag) | |
++ fsrprintf(_("<= 1 extent/512MB: " | |
++ "inode %llu\n"), p->bs_ino); | |
++ continue; | |
++ } | |
++ | |
+ fd = jdm_open(fshandlep, &bs1, O_RDWR | O_DIRECT); | |
+ if (fd < 0) { | |
+ /* This probably means the file was | |
diff --git a/pkgs/tools/filesystems/xfsprogs/default.nix b/pkgs/tools/filesystems/xfsprogs/default.nix | |
index 85efb13b82e..326526a0ae9 100644 | |
--- a/pkgs/tools/filesystems/xfsprogs/default.nix | |
+++ b/pkgs/tools/filesystems/xfsprogs/default.nix | |
@@ -23,6 +23,10 @@ stdenv.mkDerivation rec { | |
enableParallelBuilding = true; | |
+ patches = [ | |
+ ./0001-Don-t-defrag-files-that-have-1-extent-512MB.patch | |
+ ]; | |
+ | |
# @sbindir@ is replaced with /run/current-system/sw/bin to fix dependency cycles | |
preConfigure = '' | |
for file in scrub/{xfs_scrub_all.cron.in,xfs_scrub@.service.in,xfs_scrub_all.service.in}; do | |
-- | |
2.31.0 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment