diff options
author | Eric Wong <e@80x24.org> | 2021-10-10 14:25:13 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2021-10-10 23:29:51 +0000 |
commit | e26f235e4534d81efd402d30497ebf58ac4a2f74 (patch) | |
tree | efece35962d30c474e47f92a42f1da177e097937 /lib/PublicInbox/Over.pm | |
parent | 0e71e72e39472832c97866c7f32f4a62d7b7e6a0 (diff) | |
download | public-inbox-e26f235e4534d81efd402d30497ebf58ac4a2f74.tar.gz |
We'll set nodatacow when detecting existing but empty files, and also their directories in more cases (for auxiliary -wal, -journal, -shm files). Hopefully this keeps performance reasonable on CoW FSes.
Diffstat (limited to 'lib/PublicInbox/Over.pm')
-rw-r--r-- | lib/PublicInbox/Over.pm | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/PublicInbox/Over.pm b/lib/PublicInbox/Over.pm index 19da056a..98de82c0 100644 --- a/lib/PublicInbox/Over.pm +++ b/lib/PublicInbox/Over.pm @@ -16,9 +16,11 @@ use constant DEFAULT_LIMIT => 1000; sub dbh_new { my ($self, $rw) = @_; my $f = delete $self->{filename}; - if (!-f $f) { # SQLite defaults mode to 0644, we want 0666 + if (!-s $f) { # SQLite defaults mode to 0644, we want 0666 if ($rw) { require PublicInbox::Spawn; + my ($dir) = ($f =~ m!(.+)/[^/]+\z!); + PublicInbox::Spawn::nodatacow_dir($dir); open my $fh, '+>>', $f or die "failed to open $f: $!"; PublicInbox::Spawn::nodatacow_fd(fileno($fh)); } else { |