Module Name: src Committed By: martin Date: Sat Jun 22 18:30:13 UTC 2024
Modified Files: src/sys/arch/xen/xen [netbsd-10]: xbdback_xenbus.c Log Message: Pull up the following, requested by bouyer in ticket #726: sys/arch/xen/xen/xbdback_xenbus.c upto 1.107 Restore "sparse" segements support which was lost in rev 1.83, causing VBD corruption with linux guests. The segments in a single request are not always contigous in VA; this means that the end of a segment is not always 7 and the start of the next one is not always 0. When this happens this means that a contigous chunk of data from disk has to be dispatched to various non-contigous VA, in chunks of VBD_BSIZE bytes (or the other way round for writes). Linux I/O subsystems seems to support this natively; to emulate this allocate a MAXPHYS bounce buffer to do the I/O and then memcpy() the data from/to the segments as requested. If the request is contigous do the I/O directly to the mapped VA. This means that we need to keep segments details until iodone(); so move the blkif_request_segment array from xbdback_instance to xbdback_io. The array is allocated separately to guarantee proper page alignement. non-contigous segments seems rare so allocate one bounce buffer per xbdback_instance, and stall the ring if the bounce buffer is already in use. For this add back a mechanism to restart an I/O at a specific point after thread sleep/wakeup. While there guard some more printfs with ratecheck() and add more checks on segments bounds. Tested with a HVM scientific linux install from iso image; the install would fail with a xfs corruption when installing grub. (Plus mostly cosmetic/minor changes.) To generate a diff of this commit: cvs rdiff -u -r1.101.4.1 -r1.101.4.2 src/sys/arch/xen/xen/xbdback_xenbus.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.