Deleted Added
full compact
nfs_bio.c (108357) nfs_bio.c (111748)
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

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

32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 *
36 * @(#)nfs_bio.c 8.9 (Berkeley) 3/30/95
37 */
38
39#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

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

32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 *
36 * @(#)nfs_bio.c 8.9 (Berkeley) 3/30/95
37 */
38
39#include <sys/cdefs.h>
40__FBSDID("$FreeBSD: head/sys/nfsclient/nfs_bio.c 108357 2002-12-28 20:37:50Z dillon $");
40__FBSDID("$FreeBSD: head/sys/nfsclient/nfs_bio.c 111748 2003-03-02 16:54:40Z des $");
41
42#include <sys/param.h>
43#include <sys/systm.h>
44#include <sys/bio.h>
45#include <sys/buf.h>
46#include <sys/kernel.h>
47#include <sys/mount.h>
48#include <sys/proc.h>

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

1080 slpflag = 0;
1081 slptimeo = 0;
1082 }
1083 /*
1084 * First wait for any other process doing a flush to complete.
1085 */
1086 while (np->n_flag & NFLUSHINPROG) {
1087 np->n_flag |= NFLUSHWANT;
41
42#include <sys/param.h>
43#include <sys/systm.h>
44#include <sys/bio.h>
45#include <sys/buf.h>
46#include <sys/kernel.h>
47#include <sys/mount.h>
48#include <sys/proc.h>

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

1080 slpflag = 0;
1081 slptimeo = 0;
1082 }
1083 /*
1084 * First wait for any other process doing a flush to complete.
1085 */
1086 while (np->n_flag & NFLUSHINPROG) {
1087 np->n_flag |= NFLUSHWANT;
1088 error = tsleep((caddr_t)&np->n_flag, PRIBIO + 2, "nfsvinval",
1088 error = tsleep(&np->n_flag, PRIBIO + 2, "nfsvinval",
1089 slptimeo);
1090 if (error && intrflg &&
1091 nfs_sigintr(nmp, NULL, td))
1092 return (EINTR);
1093 }
1094
1095 /*
1096 * Now, flush as required.
1097 */
1098 np->n_flag |= NFLUSHINPROG;
1099 error = vinvalbuf(vp, flags, cred, td, slpflag, 0);
1100 while (error) {
1101 if (intrflg &&
1102 nfs_sigintr(nmp, NULL, td)) {
1103 np->n_flag &= ~NFLUSHINPROG;
1104 if (np->n_flag & NFLUSHWANT) {
1105 np->n_flag &= ~NFLUSHWANT;
1089 slptimeo);
1090 if (error && intrflg &&
1091 nfs_sigintr(nmp, NULL, td))
1092 return (EINTR);
1093 }
1094
1095 /*
1096 * Now, flush as required.
1097 */
1098 np->n_flag |= NFLUSHINPROG;
1099 error = vinvalbuf(vp, flags, cred, td, slpflag, 0);
1100 while (error) {
1101 if (intrflg &&
1102 nfs_sigintr(nmp, NULL, td)) {
1103 np->n_flag &= ~NFLUSHINPROG;
1104 if (np->n_flag & NFLUSHWANT) {
1105 np->n_flag &= ~NFLUSHWANT;
1106 wakeup((caddr_t)&np->n_flag);
1106 wakeup(&np->n_flag);
1107 }
1108 return (EINTR);
1109 }
1110 error = vinvalbuf(vp, flags, cred, td, 0, slptimeo);
1111 }
1112 np->n_flag &= ~(NMODIFIED | NFLUSHINPROG);
1113 if (np->n_flag & NFLUSHWANT) {
1114 np->n_flag &= ~NFLUSHWANT;
1107 }
1108 return (EINTR);
1109 }
1110 error = vinvalbuf(vp, flags, cred, td, 0, slptimeo);
1111 }
1112 np->n_flag &= ~(NMODIFIED | NFLUSHINPROG);
1113 if (np->n_flag & NFLUSHWANT) {
1114 np->n_flag &= ~NFLUSHWANT;
1115 wakeup((caddr_t)&np->n_flag);
1115 wakeup(&np->n_flag);
1116 }
1117 return (0);
1118}
1119
1120/*
1121 * Initiate asynchronous I/O. Return an error if no nfsiods are available.
1122 * This is mainly to avoid queueing async I/O requests when the nfsiods
1123 * are all hung on a dead server.

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

1175 * Found one, so wake it up and tell it which
1176 * mount to process.
1177 */
1178 NFS_DPF(ASYNCIO, ("nfs_asyncio: waking iod %d for mount %p\n",
1179 iod, nmp));
1180 nfs_iodwant[iod] = NULL;
1181 nfs_iodmount[iod] = nmp;
1182 nmp->nm_bufqiods++;
1116 }
1117 return (0);
1118}
1119
1120/*
1121 * Initiate asynchronous I/O. Return an error if no nfsiods are available.
1122 * This is mainly to avoid queueing async I/O requests when the nfsiods
1123 * are all hung on a dead server.

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

1175 * Found one, so wake it up and tell it which
1176 * mount to process.
1177 */
1178 NFS_DPF(ASYNCIO, ("nfs_asyncio: waking iod %d for mount %p\n",
1179 iod, nmp));
1180 nfs_iodwant[iod] = NULL;
1181 nfs_iodmount[iod] = nmp;
1182 nmp->nm_bufqiods++;
1183 wakeup((caddr_t)&nfs_iodwant[iod]);
1183 wakeup(&nfs_iodwant[iod]);
1184 }
1185
1186 /*
1187 * If none are free, we may already have an iod working on this mount
1188 * point. If so, it will process our request.
1189 */
1190 if (!gotiod) {
1191 if (nmp->nm_bufqiods > 0) {

--- 364 unchanged lines hidden ---
1184 }
1185
1186 /*
1187 * If none are free, we may already have an iod working on this mount
1188 * point. If so, it will process our request.
1189 */
1190 if (!gotiod) {
1191 if (nmp->nm_bufqiods > 0) {

--- 364 unchanged lines hidden ---