]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
lib/file: Clarify why File_GetSize opens and closes the file.
authorJohn Wolfe <jwolfe@vmware.com>
Thu, 8 Sep 2022 21:51:39 +0000 (14:51 -0700)
committerJohn Wolfe <jwolfe@vmware.com>
Thu, 8 Sep 2022 21:51:39 +0000 (14:51 -0700)
Spell out what's going on.

open-vm-tools/lib/file/file.c

index aabe983a2f608fbb7824dee4f840fd0bd239b2ba..10403be27003ca49350b4198394498a8f9e8bddf 100644 (file)
@@ -1,5 +1,5 @@
 /*********************************************************
- * Copyright (C) 1998-2021 VMware, Inc. All rights reserved.
+ * Copyright (C) 1998-2022 VMware, Inc. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License as published
@@ -1499,6 +1499,14 @@ File_GetModTimeString(const char *pathName)  // IN:
  *
  *      Get size of file. Try File_GetSizeEx to get size of directory/symlink.
  *
+ *      For performance reasons, whenever a file grows, many file systems elect
+ *      to not update the on-storage inode information until close or when
+ *      forced to write a dirty page. This is done to avoid wasting I/O
+ *      throughput.
+ *
+ *      The only way to determine the exact, up-to-date size of a file is to
+ *      open it and query the file size.
+ *
  * Results:
  *      Size of file or -1.
  *