X-Recipient: archive-cygwin@delorie.com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D82A73858015
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
	s=default; t=1702046929;
	bh=1plAJkiVWhgVp2orwn+Gsmx9F6LpCQmHXGUQjoZ+kRc=;
	h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe:
	 List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:
	 From;
	b=rwHPt2itM/dc44AcT4EcAQw+gidRes9zoa90NBeNujYZFGJIdV7qAPQ4VkQxtUDSP
	 G85HEFxyfu4pwQRBCVwuHHlRyGe05727R/EIB+Kmp0fkXyrT2vxfdA9idsBDV9cGQr
	 F0vgkXkKyciMm0+GkKhC4AnjCz3KHRiwibr/09Hg=
X-Original-To: cygwin@cygwin.com
Delivered-To: cygwin@cygwin.com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9E92C3858C2C
Date: Fri, 8 Dec 2023 15:48:10 +0100
To: cygwin@cygwin.com
Subject: Re: [EXTERNAL] Re: getVolInfo question
Message-ID: <ZXMsquvrWVHv9i1h@calimero.vinschen.de>
Mail-Followup-To: cygwin@cygwin.com
References: <DM8PR09MB7095D4EC6ACCE0FD995AC0BFA58BA@DM8PR09MB7095.namprd09.prod.outlook.com>
 <ZXH7NKbZXz3Mr3DG@calimero.vinschen.de>
 <DM8PR09MB70955F0A85B86E15ABEDB48EA58BA@DM8PR09MB7095.namprd09.prod.outlook.com>
 <ZXIUj2P3XhExxQw1@calimero.vinschen.de>
MIME-Version: 1.0
Content-Disposition: inline
In-Reply-To: <ZXIUj2P3XhExxQw1@calimero.vinschen.de>
X-BeenThere: cygwin@cygwin.com
X-Mailman-Version: 2.1.30
Precedence: list
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-request@cygwin.com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=subscribe>
From: Corinna Vinschen via Cygwin <cygwin@cygwin.com>
Reply-To: cygwin@cygwin.com
Cc: Corinna Vinschen <corinna-cygwin@cygwin.com>
Content-Type: text/plain; charset="utf-8"
Errors-To: cygwin-bounces+archive-cygwin=delorie.com@cygwin.com
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie.com@cygwin.com>
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 3B8Empx3030672

On Dec  7 19:53, Corinna Vinschen via Cygwin wrote:
> On Dec  7 18:02, Lavrentiev, Anton (NIH/NLM/NCBI) [C] via Cygwin wrote:
> > Thank you for your prompt reply!
> > 
> > > TRIM is only enabled on a filesystem, if the underlying drive
> > > actually supports TRIM.  The majority of SSDs support it, but not
> > > necessarily all SSDs.
> > > 
> > > The above values, in particular SSINFO_FLAGS_NO_SEEK_PENALTY being
> > > FALSE, indicate that your drive is actually not an SSD, but a rotating
> > > harddisk, or it's an SSD which fakes to be a rotating harddisk.
> > 
> > Well, I don't have any rotating HHDs in my computer.  4 of my SSDs report this:
> > 
> > TRIM Command:  Supported (Deterministic Read After TRIM, Words = 0)
> > 
> > and the last one (an older drive, indeed) report this:
> > 
> > TRIM Command:  Supported (Indeterminate Read After TRIM)
> > 
> > But my C: drive (where Cygwin is installed) is a newer drive (one of those 4).
> > 
> > That's odd.
> 
> Yes, it is.  But getVolInfo can only print what it gets from the OS,
> so I don't see what could be changed ¯\_(ツ)_/¯

Btw., I took the opportunity trying to implement the Linux FITRIM ioctl.

FTR, it works, kind of.

The problem is this:

- In Linux, ioctl(FITRIM) only works on filesystem descriptors (e.g.,
  /dev/sda1).  When trying to call ioctl(FITRIM) on file descriptors
  (e.g. /tmp/foo), the ioctl returns -1 with errno set to EOPNOTSUPP.

- In Windows, DeviceIoControl(FSCTL_FILE_LEVEL_TRIM) works on files
  handles.  It fails with ERROR_INVALID_ARGUMENT when called on
  filesystem handles.

So the usage patterns are mutually exclusive.

Additionally I found that DeviceIoControl(FSCTL_FILE_LEVEL_TRIM) can
fail with ERROR_FILE_LEVEL_TRIM_NOT_SUPPORTED even if
SSINFO_FLAGS_TRIM_ENABLED is TRUE, in my case with NTFS on the
file-backed virtual drive used from a Win11 VM.

This is soooo frustrating :(((


Corinna

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

