-
- if ( (iosize = uio_curriovlen(uio)) > MAXPHYSIO_WIRED)
- iosize = MAXPHYSIO_WIRED;
- /*
- * make sure we're set to issue a fresh I/O
- * in the right direction
- */
- buf_reset(bp, flags);
-
- /* [set up the buffer for a maximum-sized transfer] */
- buf_setblkno(bp, uio_offset(uio) / blocksize);
- buf_setcount(bp, iosize);
- buf_setdataptr(bp, (uintptr_t)CAST_DOWN(caddr_t, uio_curriovbase(uio)));
-
- /*
- * [call f_minphys to bound the tranfer size]
- * and remember the amount of data to transfer,
- * for later comparison.
- */
- (*f_minphys)(bp);
- todo = buf_count(bp);
-
- /*
- * [lock the part of the user address space involved
- * in the transfer]
- */
-
- if(UIO_SEG_IS_USER_SPACE(uio->uio_segflg)) {
- error = vslock(CAST_USER_ADDR_T(buf_dataptr(bp)),
- (user_size_t)todo);
- if (error)
- goto done;
- }
-
- /* [call f_strategy to start the transfer] */
- (*f_strategy)(bp);
-
-
- /* [wait for the transfer to complete] */
- error = (int)buf_biowait(bp);
-
- /*
- * [unlock the part of the address space previously
- * locked]
- */
- if(UIO_SEG_IS_USER_SPACE(uio->uio_segflg))
- vsunlock(CAST_USER_ADDR_T(buf_dataptr(bp)),
- (user_size_t)todo,
- (flags & B_READ));
-
- /*
- * [deduct the transfer size from the total number
- * of data to transfer]
- */
- done = buf_count(bp) - buf_resid(bp);
- uio_update(uio, done);
-
- /*
- * Now, check for an error.
- * Also, handle weird end-of-disk semantics.
- */
- if (error || done < todo)
+ if ((iosize = uio_curriovlen(uio)) > MAXPHYSIO_WIRED) {
+ iosize = MAXPHYSIO_WIRED;
+ }
+ /*
+ * make sure we're set to issue a fresh I/O
+ * in the right direction
+ */
+ buf_reset(bp, flags);
+
+ /* [set up the buffer for a maximum-sized transfer] */
+ buf_setblkno(bp, uio_offset(uio) / blocksize);
+ buf_setcount(bp, iosize);
+ buf_setdataptr(bp, (uintptr_t)CAST_DOWN(caddr_t, uio_curriovbase(uio)));
+
+ /*
+ * [call f_minphys to bound the tranfer size]
+ * and remember the amount of data to transfer,
+ * for later comparison.
+ */
+ (*f_minphys)(bp);
+ todo = buf_count(bp);
+
+ /*
+ * [lock the part of the user address space involved
+ * in the transfer]
+ */
+
+ if (UIO_SEG_IS_USER_SPACE(uio->uio_segflg)) {
+ error = vslock(CAST_USER_ADDR_T(buf_dataptr(bp)),
+ (user_size_t)todo);
+ if (error) {