aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin/mount.cc
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2023-11-30 22:13:49 +0100
committerCorinna Vinschen <corinna@vinschen.de>2023-11-30 22:37:35 +0100
commit8b01c5d6903fbcbb14c52db45c12494b53493c5a (patch)
tree6b3a4cd5a541e77231f5b241f408f410c103a3c7 /winsup/cygwin/mount.cc
parent61f49ada90b2541925d56183e91e7d57aad1547a (diff)
downloadnewlib-8b01c5d6903fbcbb14c52db45c12494b53493c5a.zip
newlib-8b01c5d6903fbcbb14c52db45c12494b53493c5a.tar.gz
newlib-8b01c5d6903fbcbb14c52db45c12494b53493c5a.tar.bz2
Cygwin: fs_info: check for SSD
During fs_info::update, check for the file being on an SSD. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diffstat (limited to 'winsup/cygwin/mount.cc')
-rw-r--r--winsup/cygwin/mount.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/winsup/cygwin/mount.cc b/winsup/cygwin/mount.cc
index 13ace62..9545d22 100644
--- a/winsup/cygwin/mount.cc
+++ b/winsup/cygwin/mount.cc
@@ -523,8 +523,22 @@ fs_info::update (PUNICODE_STRING upath, HANDLE in_vol)
caseinsensitive ((!(flags () & FILE_CASE_SENSITIVE_SEARCH) || is_samba ())
&& !is_nfs ());
+ /* Check for being an SSD */
+ if (!is_remote_drive () && !is_cdrom ())
+ {
+ /* Theoretically FileFsVolumeFlagsInformation would be sufficient,
+ but apparently it's not exposed into userspace. */
+ FILE_FS_SECTOR_SIZE_INFORMATION ffssi;
+
+ status = NtQueryVolumeInformationFile (vol, &io, &ffssi, sizeof ffssi,
+ FileFsSectorSizeInformation);
+ if (NT_SUCCESS (status))
+ is_ssd (!!(ffssi.Flags & SSINFO_FLAGS_NO_SEEK_PENALTY));
+ }
+
if (!in_vol)
NtClose (vol);
+
fsi_cache.add (hash, this);
return true;
}