Add a comment explaining why we call dmu_write() unconditionally, even if

uiomove() fails, especially that it is different from what OpenSolaris
does (I'm not entirely sure they are right).

Suggested by:	darrenr
This commit is contained in:
Pawel Jakub Dawidek 2007-05-01 12:09:45 +00:00
parent e3b78ec974
commit 7555fddd83
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=169167
2 changed files with 18 additions and 0 deletions

View File

@ -327,6 +327,15 @@ mappedwrite(vnode_t *vp, int nbytes, uio_t *uio, dmu_tx_t *tx)
va = (caddr_t)sf_buf_kva(sf);
woff = uio->uio_loffset - off;
error = uiomove(va + off, bytes, UIO_WRITE, uio);
/*
* The uiomove() above could have been partially
* successful, that's why we call dmu_write()
* below unconditionally. The page was marked
* non-dirty above and we would lose the changes
* without doing so. If the uiomove() failed
* entirely, well, we just write what we got
* before one more time.
*/
dmu_write(os, zp->z_id, woff,
MIN(PAGESIZE, fsize - woff), va, tx);
sf_buf_free(sf);

View File

@ -327,6 +327,15 @@ mappedwrite(vnode_t *vp, int nbytes, uio_t *uio, dmu_tx_t *tx)
va = (caddr_t)sf_buf_kva(sf);
woff = uio->uio_loffset - off;
error = uiomove(va + off, bytes, UIO_WRITE, uio);
/*
* The uiomove() above could have been partially
* successful, that's why we call dmu_write()
* below unconditionally. The page was marked
* non-dirty above and we would lose the changes
* without doing so. If the uiomove() failed
* entirely, well, we just write what we got
* before one more time.
*/
dmu_write(os, zp->z_id, woff,
MIN(PAGESIZE, fsize - woff), va, tx);
sf_buf_free(sf);