Deleted Added
full compact
kern_sx.c (196226) kern_sx.c (196334)
1/*-
2 * Copyright (c) 2007 Attilio Rao <attilio@freebsd.org>
3 * Copyright (c) 2001 Jason Evans <jasone@freebsd.org>
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

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

36 * so should not be relied upon in combination with sx locks.
37 */
38
39#include "opt_ddb.h"
40#include "opt_kdtrace.h"
41#include "opt_no_adaptive_sx.h"
42
43#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2007 Attilio Rao <attilio@freebsd.org>
3 * Copyright (c) 2001 Jason Evans <jasone@freebsd.org>
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

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

36 * so should not be relied upon in combination with sx locks.
37 */
38
39#include "opt_ddb.h"
40#include "opt_kdtrace.h"
41#include "opt_no_adaptive_sx.h"
42
43#include <sys/cdefs.h>
44__FBSDID("$FreeBSD: head/sys/kern/kern_sx.c 196226 2009-08-14 21:46:54Z bz $");
44__FBSDID("$FreeBSD: head/sys/kern/kern_sx.c 196334 2009-08-17 16:17:21Z attilio $");
45
46#include <sys/param.h>
47#include <sys/ktr.h>
48#include <sys/linker_set.h>
49#include <sys/lock.h>
50#include <sys/mutex.h>
51#include <sys/proc.h>
52#include <sys/sleepqueue.h>

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

200
201void
202sx_init_flags(struct sx *sx, const char *description, int opts)
203{
204 int flags;
205
206 MPASS((opts & ~(SX_QUIET | SX_RECURSE | SX_NOWITNESS | SX_DUPOK |
207 SX_NOPROFILE | SX_NOADAPTIVE)) == 0);
45
46#include <sys/param.h>
47#include <sys/ktr.h>
48#include <sys/linker_set.h>
49#include <sys/lock.h>
50#include <sys/mutex.h>
51#include <sys/proc.h>
52#include <sys/sleepqueue.h>

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

200
201void
202sx_init_flags(struct sx *sx, const char *description, int opts)
203{
204 int flags;
205
206 MPASS((opts & ~(SX_QUIET | SX_RECURSE | SX_NOWITNESS | SX_DUPOK |
207 SX_NOPROFILE | SX_NOADAPTIVE)) == 0);
208 ASSERT_ATOMIC_LOAD(sx->sx_lock, ("%s: sx_lock not aligned for %s: %p",
209 __func__, description, &sx->sx_lock));
208 ASSERT_ATOMIC_LOAD_PTR(sx->sx_lock,
209 ("%s: sx_lock not aligned for %s: %p", __func__, description,
210 &sx->sx_lock));
210
211 flags = LO_SLEEPABLE | LO_UPGRADABLE;
212 if (opts & SX_DUPOK)
213 flags |= LO_DUPOK;
214 if (opts & SX_NOPROFILE)
215 flags |= LO_NOPROFILE;
216 if (!(opts & SX_NOWITNESS))
217 flags |= LO_WITNESS;

--- 940 unchanged lines hidden ---
211
212 flags = LO_SLEEPABLE | LO_UPGRADABLE;
213 if (opts & SX_DUPOK)
214 flags |= LO_DUPOK;
215 if (opts & SX_NOPROFILE)
216 flags |= LO_NOPROFILE;
217 if (!(opts & SX_NOWITNESS))
218 flags |= LO_WITNESS;

--- 940 unchanged lines hidden ---