(void) do_ioctl(p1, p2, _DKIOCCSUNPINEXTENT, (caddr_t)&pin);
}
- while (offset < end)
+ for (; offset < end; offset += filechunk)
{
if (ref->vp->v_type == VREG)
{
filechunk = (size_t)(end - offset);
error = VNOP_BLOCKMAP(ref->vp, offset, filechunk, &blkno,
&filechunk, NULL, VNODE_WRITE, NULL);
- if (error) break;
+ if (error) break;
+ if (-1LL == blkno) continue;
fileblk = blkno * ref->blksize;
}
else if ((ref->vp->v_type == VBLK) || (ref->vp->v_type == VCHR))
else error = EINVAL;
if (error) break;
- offset += filechunk;
}
return (error);
}
VATTR_INIT(&va);
VATTR_WANTED(&va, va_rdev);
VATTR_WANTED(&va, va_fsid);
+ VATTR_WANTED(&va, va_devid);
VATTR_WANTED(&va, va_data_size);
VATTR_WANTED(&va, va_data_alloc);
VATTR_WANTED(&va, va_nlink);
/* Don't dump files with links. */
if (va.va_nlink != 1) goto out;
- device = va.va_fsid;
+ device = (VATTR_IS_SUPPORTED(&va, va_devid)) ? va.va_devid : va.va_fsid;
ref->filelength = va.va_data_size;
p1 = &device;
locked = TRUE;
f_offset = 0;
- while (f_offset < ref->filelength)
+ for (; f_offset < ref->filelength; f_offset += filechunk)
{
if (ref->vp->v_type == VREG)
{
error = VNOP_BLOCKMAP(ref->vp, f_offset, filechunk, &blkno,
&filechunk, NULL, VNODE_WRITE, NULL);
if (error) goto out;
-
+ if (-1LL == blkno) continue;
fileblk = blkno * ref->blksize;
}
else if ((ref->vp->v_type == VBLK) || (ref->vp->v_type == VCHR))
#endif
physoffset += getphysreq.length;
}
- f_offset += filechunk;
}
callback(callback_ref, 0ULL, 0ULL);
}
out:
- printf("kern_open_file_for_direct_io(%d)\n", error);
+ printf("kern_open_file_for_direct_io(%p, %d)\n", ref, error);
if (error && locked)
{
off_t discard_offset, off_t discard_end)
{
int error;
- kprintf("kern_close_file_for_direct_io\n");
+ printf("kern_close_file_for_direct_io(%p)\n", ref);
if (!ref) return;