git: 9front

Download patch

ref: 93b7a6ddbd4301761d40c29dd3195c5ce9de870f
parent: 51c99a22c7f41c22ae7ee8505e3a649d66412261
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Tue Aug 15 17:32:44 EDT 2023

nusb/disk: advertise the correct iounit for disk files.

dossrv(4) issues i/o requests spanning multiple sectors
and will error on partial results.

the splitting into multiple i/o's is handled by devmnt,
but it needs to know the effective i/o unit.

the Maxiosize constant in nusb/disk was derived from
the 8k default 9p i/o unit, but with the recent change
it was increased to 32k, so now nudb/disk would return
partial i/o results as it gets the large read and then
ceils it at the Maxiosize constant.

This change returns the effective i/o unit on open for
raw, data and partition files making it work with
larger than 8k 9p i/o unit.

--- a/sys/src/cmd/nusb/disk/disk.c
+++ b/sys/src/cmd/nusb/disk/disk.c
@@ -652,6 +652,10 @@
 		lun->phase = Pcmd;
 		qunlock(lun);
 		srvacquire(req->srv);
+		/* wet floor */
+	case Qdata:
+	case Qpart:
+		req->ofcall.iounit = Maxiosize;
 		break;
 	}
 	respond(req, nil);
--