From: Eric Wong Date: Thu, 7 Aug 2025 00:50:05 +0000 (+0000) Subject: nodatacow: warn about CoW being disabled on btrfs X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=74d4ffbba09aab2f73538a37b05ee3abcc921374;p=thirdparty%2Fpublic-inbox.git nodatacow: warn about CoW being disabled on btrfs While Xapian and SQLite performance is untenable with CoW on btrfs, disabling CoW is not without caveats on btrfs. So warn users about the possibility of data corruption. --- diff --git a/lib/PublicInbox/Syscall.pm b/lib/PublicInbox/Syscall.pm index a7fa37363..b1cb4e688 100644 --- a/lib/PublicInbox/Syscall.pm +++ b/lib/PublicInbox/Syscall.pm @@ -435,6 +435,7 @@ sub rename_noreplace ($$) { } } +# returns "0 but true" on success, undef or sub nodatacow_fh ($) { my ($fh) = @_; my $buf = "\0" x 120; @@ -453,8 +454,17 @@ sub nodatacow_fh ($) { warn("FS_IOC_SETFLAGS: $!\n"); } -sub nodatacow_dir { - if (open my $fh, '<', $_[0]) { nodatacow_fh($fh) } +sub nodatacow_dir ($) { + my ($f) = @_; + if (open my $fh, '<', $f) { + my $rc = nodatacow_fh($fh); # returns "0 but true" on success + $rc && $rc == 0 and warn <