[pve-devel] [PATCH pve-storage 4/6] PVE/Storage/Plugin.pm: add ctime for all files
Dietmar Maurer
dietmar at proxmox.com
Wed Mar 4 11:46:20 CET 2020
Creation time makes sense for other file types also.
Signed-off-by: Dietmar Maurer <dietmar at proxmox.com>
---
PVE/Storage/Plugin.pm | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/PVE/Storage/Plugin.pm b/PVE/Storage/Plugin.pm
index bd4bb8c..85af1c8 100644
--- a/PVE/Storage/Plugin.pm
+++ b/PVE/Storage/Plugin.pm
@@ -3,6 +3,7 @@ package PVE::Storage::Plugin;
use strict;
use warnings;
+use Fcntl ':mode';
use File::chdir;
use File::Path;
use File::Basename;
@@ -904,7 +905,11 @@ my $get_subdir_files = sub {
foreach my $fn (<$path/*>) {
- next if -d $fn;
+ my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
+ $atime,$mtime,$ctime,$blksize,$blocks)
+ = stat($fn);
+
+ next if S_ISDIR($mode);
my $info;
@@ -943,7 +948,8 @@ my $get_subdir_files = sub {
};
}
- $info->{size} = -s $fn // 0;
+ $info->{size} = $size;
+ $info->{ctime} //= $ctime;
push @$res, $info;
}
--
2.20.1
More information about the pve-devel
mailing list