Deleted Added
full compact
nfs_clbio.c (234605) nfs_clbio.c (235332)
1/*-
2 * Copyright (c) 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Rick Macklem at The University of Guelph.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 19 unchanged lines hidden (view full) ---

28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 *
32 * @(#)nfs_bio.c 8.9 (Berkeley) 3/30/95
33 */
34
35#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Rick Macklem at The University of Guelph.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 19 unchanged lines hidden (view full) ---

28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 *
32 * @(#)nfs_bio.c 8.9 (Berkeley) 3/30/95
33 */
34
35#include <sys/cdefs.h>
36__FBSDID("$FreeBSD: head/sys/fs/nfsclient/nfs_clbio.c 234605 2012-04-23 13:21:28Z trasz $");
36__FBSDID("$FreeBSD: head/sys/fs/nfsclient/nfs_clbio.c 235332 2012-05-12 12:02:51Z rmacklem $");
37
38#include "opt_kdtrace.h"
39
40#include <sys/param.h>
41#include <sys/systm.h>
42#include <sys/bio.h>
43#include <sys/buf.h>
44#include <sys/kernel.h>

--- 231 unchanged lines hidden (view full) ---

276 struct ucred *cred;
277 struct nfsmount *nmp;
278 struct nfsnode *np;
279 vm_page_t *pages;
280
281 vp = ap->a_vp;
282 np = VTONFS(vp);
283 td = curthread; /* XXX */
37
38#include "opt_kdtrace.h"
39
40#include <sys/param.h>
41#include <sys/systm.h>
42#include <sys/bio.h>
43#include <sys/buf.h>
44#include <sys/kernel.h>

--- 231 unchanged lines hidden (view full) ---

276 struct ucred *cred;
277 struct nfsmount *nmp;
278 struct nfsnode *np;
279 vm_page_t *pages;
280
281 vp = ap->a_vp;
282 np = VTONFS(vp);
283 td = curthread; /* XXX */
284 cred = curthread->td_ucred; /* XXX */
284 /* Set the cred to n_writecred for the write rpcs. */
285 if (np->n_writecred != NULL)
286 cred = crhold(np->n_writecred);
287 else
288 cred = crhold(curthread->td_ucred); /* XXX */
285 nmp = VFSTONFS(vp->v_mount);
286 pages = ap->a_m;
287 count = ap->a_count;
288 rtvals = ap->a_rtvals;
289 npages = btoc(count);
290 offset = IDX_TO_OFF(pages[0]->pindex);
291
292 mtx_lock(&nmp->nm_mtx);

--- 47 unchanged lines hidden (view full) ---

340 uio.uio_td = td;
341
342 if ((ap->a_sync & VM_PAGER_PUT_SYNC) == 0)
343 iomode = NFSWRITE_UNSTABLE;
344 else
345 iomode = NFSWRITE_FILESYNC;
346
347 error = ncl_writerpc(vp, &uio, cred, &iomode, &must_commit, 0);
289 nmp = VFSTONFS(vp->v_mount);
290 pages = ap->a_m;
291 count = ap->a_count;
292 rtvals = ap->a_rtvals;
293 npages = btoc(count);
294 offset = IDX_TO_OFF(pages[0]->pindex);
295
296 mtx_lock(&nmp->nm_mtx);

--- 47 unchanged lines hidden (view full) ---

344 uio.uio_td = td;
345
346 if ((ap->a_sync & VM_PAGER_PUT_SYNC) == 0)
347 iomode = NFSWRITE_UNSTABLE;
348 else
349 iomode = NFSWRITE_FILESYNC;
350
351 error = ncl_writerpc(vp, &uio, cred, &iomode, &must_commit, 0);
352 crfree(cred);
348
349 pmap_qremove(kva, npages);
350 relpbuf(bp, &ncl_pbuf_freecnt);
351
352 if (error == 0 || !nfs_keep_dirty_on_error) {
353 vnode_pager_undirty_pages(pages, rtvals, count - uio.uio_resid);
354 if (must_commit)
355 ncl_clearcommit(vp->v_mount);

--- 1482 unchanged lines hidden ---
353
354 pmap_qremove(kva, npages);
355 relpbuf(bp, &ncl_pbuf_freecnt);
356
357 if (error == 0 || !nfs_keep_dirty_on_error) {
358 vnode_pager_undirty_pages(pages, rtvals, count - uio.uio_resid);
359 if (must_commit)
360 ncl_clearcommit(vp->v_mount);

--- 1482 unchanged lines hidden ---