> are you trying to trim a really large section at once?  i think
> that's what i see:

>> [ - root] 3> date; ./trim /dev/rwd1d 4 2; date

That means "first six bytes contain 4, LE; second two bytes contain 2,
LE".  I thought that in turn meant "2 sectors at offset 4".  Apparently
it actually means "2 * max_dsm_blocks at offset 4", but max_dsm_blocks
is 8 for this device, so that's still only 8K.

> at least in my experience, the problem is that most devices take a
> while to handle a TRIM request, longer than the 30s timeout typically
> used.

That's...odd.  How can it be useful if it takes that long?  Is the
intent that it be useful only for very occasional "erase this whole
filesystem" use, or what?  I thought it was intended for routine
filesystem use upon deleting files.

> this is why blkdiscard(8) defaults to 32MiB chunks.

I once did what I thought was trying to trim 16M, but my current
understanding says that attempt would have been 128M.  That didn't work
any better.

I just tried increasing the timeout to 300000 (ie, five minutes) and
trimming offset 0 size 8, which I now think for this device (with
max_dsm_blocks 8) should mean 64 (interface) sectors, ie, 32k.

It still timed out, with the same followup timeouts.  Note the date
output here; it took five minutes for the TRIM to time out, then thirty
seconds for wd_flushcache.

[ - root] 4> date; trim /dev/rwd1d 0 8; date
Mon Dec 12 08:22:29 EST 2022
TRIM wd1: arg 00 00 00 00 00 00 08 00
Version 2040.283, max DSM blocks 8
TRIM wd1: calling exec
piixide1:0:1: lost interrupt
        type: ata tc_bcount: 512 tc_skip: 0
TRIM wd1: returned 1
ATAIOCTRIM workd
wd1: wd_flushcache: status=128<TIMEOU>
Mon Dec 12 08:27:59 EST 2022
[ - root] 5> dd if=/dev/rwd1d of=/dev/null count=8
piixide1:0:1: wait timed out
wd1d: device timeout reading fsbn 0 (wd1 bn 0; cn 0 tn 0 sn 0),
retrying
wd1: soft error (corrected)
8+0 records in
8+0 records out
4096 bytes transferred in 0.005 secs (819200 bytes/sec)
[ - root] 6> 

> maybe port that tool back,

I'll try to have a look at it.  I haven't been trying to match the -9
userland API, though, so I'm not sure how useful it will actually be.
It may point me in a useful direction, though.

> it's also supposed to match the linux command of the same name.  it's
> not in netbsd-9, but last i tried, the interfaces the -current tool
> uses are available in -9 kernels.

I did bring over the 9.2 syssrc set, so I should be able to figure
_something_ out.

/~\ The ASCII                             Mouse
\ / Ribbon Campaign
 X  Against HTML                mo...@rodents-montreal.org
/ \ Email!           7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B

Reply via email to