svn commit: r206822 - in user/jmallett/octeon: bin/ln bin/sh
etc/defaults lib/libc/gen lib/libc/sys share/man/man5
sys/cddl/contrib/opensolaris/uts/common/fs/zfs
sys/cddl/contrib/opensolaris/uts/co...
Juli Mallett
jmallett at FreeBSD.org
Sun Apr 18 22:51:20 UTC 2010
Author: jmallett
Date: Sun Apr 18 22:51:20 2010
New Revision: 206822
URL: http://svn.freebsd.org/changeset/base/206822
Log:
Merge from head.
Added:
user/jmallett/octeon/tools/regression/bin/sh/expansion/plus-minus3.0
- copied unchanged from r206819, head/tools/regression/bin/sh/expansion/plus-minus3.0
user/jmallett/octeon/tools/regression/bin/sh/parameters/pwd2.0
- copied unchanged from r206819, head/tools/regression/bin/sh/parameters/pwd2.0
Modified:
user/jmallett/octeon/bin/ln/ln.c
user/jmallett/octeon/bin/sh/cd.c
user/jmallett/octeon/bin/sh/cd.h
user/jmallett/octeon/bin/sh/main.c
user/jmallett/octeon/etc/defaults/rc.conf
user/jmallett/octeon/lib/libc/gen/getcwd.3
user/jmallett/octeon/lib/libc/sys/sigaction.2
user/jmallett/octeon/share/man/man5/rc.conf.5
user/jmallett/octeon/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
user/jmallett/octeon/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h
user/jmallett/octeon/sys/dev/ahci/ahci.c
user/jmallett/octeon/sys/dev/ipw/if_ipw.c
user/jmallett/octeon/sys/dev/ipw/if_ipwvar.h
user/jmallett/octeon/sys/fs/nfs/nfsclstate.h
user/jmallett/octeon/sys/fs/nfsclient/nfs_clstate.c
user/jmallett/octeon/sys/mips/include/param.h
user/jmallett/octeon/sys/netinet/sctp_indata.c
user/jmallett/octeon/sys/vm/swap_pager.c
user/jmallett/octeon/sys/vm/vm_kern.c
user/jmallett/octeon/sys/vm/vm_object.c
user/jmallett/octeon/sys/vm/vm_pageout.c
Directory Properties:
user/jmallett/octeon/ (props changed)
user/jmallett/octeon/sys/contrib/x86emu/ (props changed)
user/jmallett/octeon/sys/mips/rmi/dev/sec/desc.h (props changed)
Modified: user/jmallett/octeon/bin/ln/ln.c
==============================================================================
--- user/jmallett/octeon/bin/ln/ln.c Sun Apr 18 22:51:15 2010 (r206821)
+++ user/jmallett/octeon/bin/ln/ln.c Sun Apr 18 22:51:20 2010 (r206822)
@@ -172,6 +172,52 @@ main(int argc, char *argv[])
exit(exitval);
}
+/*
+ * Two pathnames refer to the same directory entry if the directories match
+ * and the final components' names match.
+ */
+static int
+samedirent(const char *path1, const char *path2)
+{
+ const char *file1, *file2;
+ char pathbuf[PATH_MAX];
+ struct stat sb1, sb2;
+
+ if (strcmp(path1, path2) == 0)
+ return 1;
+ file1 = strrchr(path1, '/');
+ if (file1 != NULL)
+ file1++;
+ else
+ file1 = path1;
+ file2 = strrchr(path2, '/');
+ if (file2 != NULL)
+ file2++;
+ else
+ file2 = path2;
+ if (strcmp(file1, file2) != 0)
+ return 0;
+ if (file1 - path1 >= PATH_MAX || file2 - path2 >= PATH_MAX)
+ return 0;
+ if (file1 == path1)
+ memcpy(pathbuf, ".", 2);
+ else {
+ memcpy(pathbuf, path1, file1 - path1);
+ pathbuf[file1 - path1] = '\0';
+ }
+ if (stat(pathbuf, &sb1) != 0)
+ return 0;
+ if (file2 == path2)
+ memcpy(pathbuf, ".", 2);
+ else {
+ memcpy(pathbuf, path2, file2 - path2);
+ pathbuf[file2 - path2] = '\0';
+ }
+ if (stat(pathbuf, &sb2) != 0)
+ return 0;
+ return sb1.st_dev == sb2.st_dev && sb1.st_ino == sb2.st_ino;
+}
+
int
linkit(const char *source, const char *target, int isdir)
{
@@ -215,7 +261,6 @@ linkit(const char *source, const char *t
target = path;
}
- exists = !lstat(target, &sb);
/*
* If the link source doesn't exist, and a symbolic link was
* requested, and -w was specified, give a warning.
@@ -242,8 +287,20 @@ linkit(const char *source, const char *t
warn("warning: %s", source);
}
}
+
+ /*
+ * If the file exists, first check it is not the same directory entry.
+ */
+ exists = !lstat(target, &sb);
+ if (exists) {
+ if (!sflag && samedirent(source, target)) {
+ warnx("%s and %s are the same directory entry",
+ source, target);
+ return (1);
+ }
+ }
/*
- * If the file exists, then unlink it forcibly if -f was specified
+ * Then unlink it forcibly if -f was specified
* and interactively if -i was specified.
*/
if (fflag && exists) {
Modified: user/jmallett/octeon/bin/sh/cd.c
==============================================================================
--- user/jmallett/octeon/bin/sh/cd.c Sun Apr 18 22:51:15 2010 (r206821)
+++ user/jmallett/octeon/bin/sh/cd.c Sun Apr 18 22:51:20 2010 (r206822)
@@ -70,6 +70,7 @@ STATIC int docd(char *, int, int);
STATIC char *getcomponent(void);
STATIC char *findcwd(char *);
STATIC void updatepwd(char *);
+STATIC char *getpwd(void);
STATIC char *getpwd2(void);
STATIC char *curdir = NULL; /* current working directory */
@@ -351,7 +352,7 @@ pwdcmd(int argc, char **argv)
/*
* Get the current directory and cache the result in curdir.
*/
-char *
+STATIC char *
getpwd(void)
{
char *p;
@@ -374,7 +375,6 @@ getpwd(void)
STATIC char *
getpwd2(void)
{
- struct stat stdot, stpwd;
char *pwd;
int i;
@@ -387,12 +387,29 @@ getpwd2(void)
break;
}
- pwd = getenv("PWD");
+ return NULL;
+}
+
+/*
+ * Initialize PWD in a new shell.
+ * If the shell is interactive, we need to warn if this fails.
+ */
+void
+pwd_init(int warn)
+{
+ char *pwd;
+ struct stat stdot, stpwd;
+
+ pwd = lookupvar("PWD");
if (pwd && *pwd == '/' && stat(".", &stdot) != -1 &&
stat(pwd, &stpwd) != -1 &&
stdot.st_dev == stpwd.st_dev &&
stdot.st_ino == stpwd.st_ino) {
- return pwd;
+ if (curdir)
+ ckfree(curdir);
+ curdir = savestr(pwd);
}
- return NULL;
+ if (getpwd() == NULL && warn)
+ out2fmt_flush("sh: cannot determine working directory\n");
+ setvar("PWD", curdir, VEXPORT);
}
Modified: user/jmallett/octeon/bin/sh/cd.h
==============================================================================
--- user/jmallett/octeon/bin/sh/cd.h Sun Apr 18 22:51:15 2010 (r206821)
+++ user/jmallett/octeon/bin/sh/cd.h Sun Apr 18 22:51:20 2010 (r206822)
@@ -29,6 +29,6 @@
* $FreeBSD$
*/
-char *getpwd(void);
+void pwd_init(int);
int cdcmd (int, char **);
int pwdcmd(int, char **);
Modified: user/jmallett/octeon/bin/sh/main.c
==============================================================================
--- user/jmallett/octeon/bin/sh/main.c Sun Apr 18 22:51:15 2010 (r206821)
+++ user/jmallett/octeon/bin/sh/main.c Sun Apr 18 22:51:20 2010 (r206822)
@@ -153,10 +153,7 @@ main(int argc, char *argv[])
init();
setstackmark(&smark);
procargs(argc, argv);
- if (getpwd() == NULL && iflag)
- out2fmt_flush("sh: cannot determine working directory\n");
- if (getpwd() != NULL)
- setvar ("PWD", getpwd(), VEXPORT);
+ pwd_init(iflag);
if (iflag)
chkmail(1);
if (argv[0] && argv[0][0] == '-') {
Modified: user/jmallett/octeon/etc/defaults/rc.conf
==============================================================================
--- user/jmallett/octeon/etc/defaults/rc.conf Sun Apr 18 22:51:15 2010 (r206821)
+++ user/jmallett/octeon/etc/defaults/rc.conf Sun Apr 18 22:51:20 2010 (r206822)
@@ -211,6 +211,7 @@ ifconfig_lo0="inet 127.0.0.1" # default
#ifconfig_lo0_alias0="inet 127.0.0.254 netmask 0xffffffff" # Sample alias entry.
#ifconfig_ed0_ipx="ipx 0x00010010" # Sample IPX address family entry.
#ifconfig_ed0_ipv6="RTADV" # Sample IPv6 entry for RA/rtsol(8)
+#ifconfig_ed0_ipv6="inet6 auto_linklocal" # To configure only link-local
#ifconfig_ed0_ipv6="inet6 2001:db8:1::1 prefixlen 64" # Sample IPv6 addr entry
#ifconfig_ed0_alias0="inet6 2001:db8:2::1 prefixlen 64" # Sample IPv6 alias
#ifconfig_fxp0_name="net0" # Change interface name from fxp0 to net0.
@@ -436,7 +437,7 @@ rfcomm_pppd_server_two_channel="3" # Ove
#rfcomm_pppd_server_two_register_sp="NO" # Override SP and DUN register
#rfcomm_pppd_server_two_register_dun="NO" # for 'two'
-#ubthidhci_enable="YES" # Switch an USB BT controller present on
+ubthidhci_enable="NO" # Switch an USB BT controller present on
#ubthidhci_busnum="3" # bus 3 and addr 2 from HID mode to HCI mode.
#ubthidhci_addr="2" # Check usbconfig list to find the correct
# numbers for your system.
Modified: user/jmallett/octeon/lib/libc/gen/getcwd.3
==============================================================================
--- user/jmallett/octeon/lib/libc/gen/getcwd.3 Sun Apr 18 22:51:15 2010 (r206821)
+++ user/jmallett/octeon/lib/libc/gen/getcwd.3 Sun Apr 18 22:51:20 2010 (r206822)
@@ -28,7 +28,7 @@
.\" @(#)getcwd.3 8.2 (Berkeley) 12/11/93
.\" $FreeBSD$
.\"
-.Dd November 24, 1997
+.Dd April 17, 2010
.Dt GETCWD 3
.Os
.Sh NAME
@@ -108,8 +108,6 @@ The
function
will fail if:
.Bl -tag -width Er
-.It Bq Er EACCES
-Read or search permission was denied for a component of the pathname.
.It Bq Er EINVAL
The
.Fa size
@@ -124,6 +122,16 @@ The
argument is greater than zero but smaller than the length of the pathname
plus 1.
.El
+.Pp
+The
+.Fn getcwd
+function
+may fail if:
+.Bl -tag -width Er
+.It Bq Er EACCES
+Read or search permission was denied for a component of the pathname.
+This is only checked in limited cases, depending on implementation details.
+.El
.Sh SEE ALSO
.Xr chdir 2 ,
.Xr fchdir 2 ,
Modified: user/jmallett/octeon/lib/libc/sys/sigaction.2
==============================================================================
--- user/jmallett/octeon/lib/libc/sys/sigaction.2 Sun Apr 18 22:51:15 2010 (r206821)
+++ user/jmallett/octeon/lib/libc/sys/sigaction.2 Sun Apr 18 22:51:20 2010 (r206822)
@@ -28,7 +28,7 @@
.\" From: @(#)sigaction.2 8.2 (Berkeley) 4/3/94
.\" $FreeBSD$
.\"
-.Dd April 13, 2010
+.Dd April 18, 2010
.Dt SIGACTION 2
.Os
.Sh NAME
@@ -40,16 +40,11 @@
.In signal.h
.Bd -literal
struct sigaction {
- union {
- void (*__sa_handler)(int);
- void (*__sa_sigaction)(int, siginfo_t *, void *);
- } __sigaction_u; /* signal handler */
+ void (*sa_handler)(int);
+ void (*sa_sigaction)(int, siginfo_t *, void *);
int sa_flags; /* see signal options below */
sigset_t sa_mask; /* signal mask to apply */
};
-
-#define sa_handler __sigaction_u.__sa_handler
-#define sa_sigaction __sigaction_u.__sa_sigaction
.Ed
.Ft int
.Fo sigaction
@@ -148,6 +143,16 @@ If
is non-zero, the previous handling information for the signal
is returned to the user.
.Pp
+The above declaration of
+.Vt "struct sigaction"
+is not literal.
+It is provided only to list the accessible members.
+See
+.In sys/signal.h
+for the actual definition.
+In particular, the storage occupied by sa_handler and sa_sigaction overlaps,
+and an application can not use both simultaneously.
+.Pp
Once a signal handler is installed, it normally remains installed
until another
.Fn sigaction
@@ -496,16 +501,6 @@ or
.Dv SIG_IGN
this way.
.Pp
-If preprocessing symbol
-.Va _POSIX_C_SOURCE
-with the value >= 199309 is not defined, the following declaration for
-the handler shall be used:
-.Bl -tag -offset indent -width short
-.It Tn POSIX Dv SA_SIGINFO :
-.Ft void
-.Fn handler int "struct __sigaction *" "void *" ;
-.El
-.Pp
If the
.Dv SA_SIGINFO
flag is not set, the handler function should match
Modified: user/jmallett/octeon/share/man/man5/rc.conf.5
==============================================================================
--- user/jmallett/octeon/share/man/man5/rc.conf.5 Sun Apr 18 22:51:15 2010 (r206821)
+++ user/jmallett/octeon/share/man/man5/rc.conf.5 Sun Apr 18 22:51:20 2010 (r206822)
@@ -1303,6 +1303,13 @@ interface:
ifconfig_ed0_ipv6="RTADV"
.Ed
.Pp
+To configure only a link-local address on the
+.Dq Li ed0
+interface:
+.Bd -literal
+ifconfig_ed0_ipv6="inet6 auto_linklocal"
+.Ed
+.Pp
To disable RA the
.Dq Li NORTADV
option is available, although not required if manual
Modified: user/jmallett/octeon/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
==============================================================================
--- user/jmallett/octeon/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sun Apr 18 22:51:15 2010 (r206821)
+++ user/jmallett/octeon/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sun Apr 18 22:51:20 2010 (r206822)
@@ -131,7 +131,6 @@
#include <sys/kstat.h>
#include <sys/sdt.h>
-#include <sys/ktr.h>
#include <vm/vm_pageout.h>
static kmutex_t arc_reclaim_thr_lock;
@@ -238,7 +237,7 @@ struct arcs_lock {
*/
#define ARC_BUFC_NUMDATALISTS 16
#define ARC_BUFC_NUMMETADATALISTS 16
-#define ARC_BUFC_NUMLISTS (ARC_BUFC_NUMMETADATALISTS+ARC_BUFC_NUMDATALISTS)
+#define ARC_BUFC_NUMLISTS (ARC_BUFC_NUMMETADATALISTS + ARC_BUFC_NUMDATALISTS)
typedef struct arc_state {
uint64_t arcs_lsize[ARC_BUFC_NUMTYPES]; /* amount of evictable data */
@@ -247,7 +246,7 @@ typedef struct arc_state {
struct arcs_lock arcs_locks[ARC_BUFC_NUMLISTS] __aligned(CACHE_LINE_SIZE);
} arc_state_t;
-#define ARCS_LOCK(s, i) &((s)->arcs_locks[(i)].arcs_lock)
+#define ARCS_LOCK(s, i) (&((s)->arcs_locks[(i)].arcs_lock))
/* The 6 states: */
static arc_state_t ARC_anon;
@@ -307,9 +306,9 @@ typedef struct arc_stats {
kstat_named_t arcstat_l2_hdr_size;
kstat_named_t arcstat_memory_throttle_count;
kstat_named_t arcstat_l2_write_trylock_fail;
- kstat_named_t arcstat_l2_write_in_l2;
kstat_named_t arcstat_l2_write_passed_headroom;
kstat_named_t arcstat_l2_write_spa_mismatch;
+ kstat_named_t arcstat_l2_write_in_l2;
kstat_named_t arcstat_l2_write_hdr_io_in_progress;
kstat_named_t arcstat_l2_write_not_cacheable;
kstat_named_t arcstat_l2_write_full;
@@ -370,19 +369,19 @@ static arc_stats_t arc_stats = {
{ "l2_size", KSTAT_DATA_UINT64 },
{ "l2_hdr_size", KSTAT_DATA_UINT64 },
{ "memory_throttle_count", KSTAT_DATA_UINT64 },
- { "l2_write_trylock_fail", KSTAT_DATA_UINT64 },
- { "l2_write_in_l2", KSTAT_DATA_UINT64 },
- { "l2_write_passed_headroom", KSTAT_DATA_UINT64 },
- { "l2_write_spa_mismatch", KSTAT_DATA_UINT64 },
- { "l2_write_io_in_progress", KSTAT_DATA_UINT64 },
- { "l2_write_not_cacheable", KSTAT_DATA_UINT64 },
- { "l2_write_full", KSTAT_DATA_UINT64 },
- { "l2_write_buffer_iter", KSTAT_DATA_UINT64 },
- { "l2_write_pios", KSTAT_DATA_UINT64 },
- { "l2_write_bytes_written", KSTAT_DATA_UINT64 },
- { "l2_write_buffer_bytes_scanned", KSTAT_DATA_UINT64 },
- { "l2_write_buffer_list_iter", KSTAT_DATA_UINT64 },
- { "l2_write_buffer_list_null_iter", KSTAT_DATA_UINT64 }
+ { "l2_write_trylock_fail", KSTAT_DATA_UINT64 },
+ { "l2_write_passed_headroom", KSTAT_DATA_UINT64 },
+ { "l2_write_spa_mismatch", KSTAT_DATA_UINT64 },
+ { "l2_write_in_l2", KSTAT_DATA_UINT64 },
+ { "l2_write_io_in_progress", KSTAT_DATA_UINT64 },
+ { "l2_write_not_cacheable", KSTAT_DATA_UINT64 },
+ { "l2_write_full", KSTAT_DATA_UINT64 },
+ { "l2_write_buffer_iter", KSTAT_DATA_UINT64 },
+ { "l2_write_pios", KSTAT_DATA_UINT64 },
+ { "l2_write_bytes_written", KSTAT_DATA_UINT64 },
+ { "l2_write_buffer_bytes_scanned", KSTAT_DATA_UINT64 },
+ { "l2_write_buffer_list_iter", KSTAT_DATA_UINT64 },
+ { "l2_write_buffer_list_null_iter", KSTAT_DATA_UINT64 }
};
#define ARCSTAT(stat) (arc_stats.stat.value.ui64)
@@ -390,7 +389,7 @@ static arc_stats_t arc_stats = {
#define ARCSTAT_INCR(stat, val) \
atomic_add_64(&arc_stats.stat.value.ui64, (val));
-#define ARCSTAT_BUMP(stat) ARCSTAT_INCR(stat, 1)
+#define ARCSTAT_BUMP(stat) ARCSTAT_INCR(stat, 1)
#define ARCSTAT_BUMPDOWN(stat) ARCSTAT_INCR(stat, -1)
#define ARCSTAT_MAX(stat, val) { \
@@ -424,7 +423,7 @@ static arc_stats_t arc_stats = {
}
kstat_t *arc_ksp;
-static arc_state_t *arc_anon;
+static arc_state_t *arc_anon;
static arc_state_t *arc_mru;
static arc_state_t *arc_mru_ghost;
static arc_state_t *arc_mfu;
@@ -1076,10 +1075,10 @@ get_buf_info(arc_buf_hdr_t *ab, arc_stat
{
uint64_t buf_hashid = buf_hash(ab->b_spa, &ab->b_dva, ab->b_birth);
- if (ab->b_type == ARC_BUFC_METADATA)
- buf_hashid &= (ARC_BUFC_NUMMETADATALISTS-1);
+ if (ab->b_type == ARC_BUFC_METADATA)
+ buf_hashid &= (ARC_BUFC_NUMMETADATALISTS - 1);
else {
- buf_hashid &= (ARC_BUFC_NUMDATALISTS-1);
+ buf_hashid &= (ARC_BUFC_NUMDATALISTS - 1);
buf_hashid += ARC_BUFC_NUMMETADATALISTS;
}
@@ -1096,18 +1095,16 @@ add_reference(arc_buf_hdr_t *ab, kmutex_
if ((refcount_add(&ab->b_refcnt, tag) == 1) &&
(ab->b_state != arc_anon)) {
- list_t *list;
- kmutex_t *lock;
uint64_t delta = ab->b_size * ab->b_datacnt;
uint64_t *size = &ab->b_state->arcs_lsize[ab->b_type];
+ list_t *list;
+ kmutex_t *lock;
get_buf_info(ab, ab->b_state, &list, &lock);
ASSERT(!MUTEX_HELD(lock));
mutex_enter(lock);
ASSERT(list_link_active(&ab->b_arc_node));
list_remove(list, ab);
- mutex_exit(lock);
-
if (GHOST_STATE(ab->b_state)) {
ASSERT3U(ab->b_datacnt, ==, 0);
ASSERT3P(ab->b_buf, ==, NULL);
@@ -1116,6 +1113,7 @@ add_reference(arc_buf_hdr_t *ab, kmutex_
ASSERT(delta > 0);
ASSERT3U(*size, >=, delta);
atomic_add_64(size, -delta);
+ mutex_exit(lock);
/* remove the prefetch flag if we get a reference */
if (ab->b_flags & ARC_PREFETCH)
ab->b_flags &= ~ARC_PREFETCH;
@@ -1138,15 +1136,13 @@ remove_reference(arc_buf_hdr_t *ab, kmut
kmutex_t *lock;
get_buf_info(ab, state, &list, &lock);
-
ASSERT(!MUTEX_HELD(lock));
mutex_enter(lock);
ASSERT(!list_link_active(&ab->b_arc_node));
list_insert_head(list, ab);
- mutex_exit(lock);
-
ASSERT(ab->b_datacnt > 0);
atomic_add_64(size, ab->b_size * ab->b_datacnt);
+ mutex_exit(lock);
}
return (cnt);
}
@@ -1182,7 +1178,6 @@ arc_change_state(arc_state_t *new_state,
get_buf_info(ab, old_state, &list, &lock);
use_mutex = !MUTEX_HELD(lock);
-
if (use_mutex)
mutex_enter(lock);
@@ -1205,13 +1200,11 @@ arc_change_state(arc_state_t *new_state,
mutex_exit(lock);
}
if (new_state != arc_anon) {
- int use_mutex;
+ int use_mutex;
uint64_t *size = &new_state->arcs_lsize[ab->b_type];
get_buf_info(ab, new_state, &list, &lock);
use_mutex = !MUTEX_HELD(lock);
-
-
if (use_mutex)
mutex_enter(lock);
@@ -1629,7 +1622,7 @@ arc_evict(arc_state_t *state, spa_t *spa
ASSERT(state == arc_mru || state == arc_mfu);
evicted_state = (state == arc_mru) ? arc_mru_ghost : arc_mfu_ghost;
-
+
if (type == ARC_BUFC_METADATA) {
offset = 0;
list_count = ARC_BUFC_NUMMETADATALISTS;
@@ -1638,7 +1631,6 @@ arc_evict(arc_state_t *state, spa_t *spa
idx = evict_metadata_offset;
} else {
offset = ARC_BUFC_NUMMETADATALISTS;
-
list_start = &state->arcs_lists[offset];
evicted_list_start = &evicted_state->arcs_lists[offset];
list_count = ARC_BUFC_NUMDATALISTS;
@@ -1646,12 +1638,12 @@ arc_evict(arc_state_t *state, spa_t *spa
}
bytes_remaining = evicted_state->arcs_lsize[type];
count = 0;
-
+
evict_start:
list = &list_start[idx];
evicted_list = &evicted_list_start[idx];
lock = ARCS_LOCK(state, (offset + idx));
- evicted_lock = ARCS_LOCK(evicted_state, (offset + idx));
+ evicted_lock = ARCS_LOCK(evicted_state, (offset + idx));
mutex_enter(lock);
mutex_enter(evicted_lock);
@@ -1721,7 +1713,7 @@ evict_start:
if (bytes_remaining > 0) {
mutex_exit(evicted_lock);
mutex_exit(lock);
- idx = ((idx + 1)&(list_count-1));
+ idx = ((idx + 1) & (list_count - 1));
count++;
goto evict_start;
}
@@ -1732,8 +1724,8 @@ evict_start:
mutex_exit(evicted_lock);
mutex_exit(lock);
-
- idx = ((idx + 1)&(list_count-1));
+
+ idx = ((idx + 1) & (list_count - 1));
count++;
if (bytes_evicted < bytes) {
@@ -1743,11 +1735,11 @@ evict_start:
dprintf("only evicted %lld bytes from %x",
(longlong_t)bytes_evicted, state);
}
- if (type == ARC_BUFC_METADATA)
+ if (type == ARC_BUFC_METADATA)
evict_metadata_offset = idx;
else
evict_data_offset = idx;
-
+
if (skipped)
ARCSTAT_INCR(arcstat_evict_skip, skipped);
@@ -1804,7 +1796,7 @@ arc_evict_ghost(arc_state_t *state, spa_
list_start = &state->arcs_lists[ARC_BUFC_NUMMETADATALISTS];
list_count = ARC_BUFC_NUMDATALISTS;
offset = ARC_BUFC_NUMMETADATALISTS;
-
+
evict_start:
list = &list_start[idx];
lock = ARCS_LOCK(state, idx + offset);
@@ -1851,12 +1843,12 @@ evict_start:
}
}
mutex_exit(lock);
- idx = ((idx + 1)&(ARC_BUFC_NUMDATALISTS-1));
+ idx = ((idx + 1) & (ARC_BUFC_NUMDATALISTS - 1));
count++;
-
+
if (count < list_count)
goto evict_start;
-
+
evict_offset = idx;
if ((uintptr_t)list > (uintptr_t)&state->arcs_lists[ARC_BUFC_NUMMETADATALISTS] &&
(bytes < 0 || bytes_deleted < bytes)) {
@@ -1945,7 +1937,7 @@ arc_do_user_evicts(void)
/*
* Move list over to avoid LOR
*/
-restart:
+restart:
mutex_enter(&arc_eviction_mtx);
tmp_arc_eviction_list = arc_eviction_list;
arc_eviction_list = NULL;
@@ -2056,7 +2048,7 @@ arc_reclaim_needed(void)
return (0);
/*
- * If pages are needed or we're within 2048 pages
+ * If pages are needed or we're within 2048 pages
* of needing to page need to reclaim
*/
if (vm_pages_needed || (vm_paging_target() > -2048))
@@ -2614,10 +2606,7 @@ arc_read_done(zio_t *zio)
hdr->b_flags &= ~ARC_L2_EVICTED;
if (l2arc_noprefetch && (hdr->b_flags & ARC_PREFETCH))
hdr->b_flags &= ~ARC_L2CACHE;
-#if 0
- else if ((hdr->b_flags & ARC_PREFETCH) == 0)
- hdr->b_flags |= ARC_L2CACHE;
-#endif
+
/* byteswap if necessary */
callback_list = hdr->b_acb;
ASSERT(callback_list != NULL);
@@ -2731,7 +2720,6 @@ arc_read(zio_t *pio, spa_t *spa, blkptr_
uint32_t *arc_flags, const zbookmark_t *zb)
{
int err;
- arc_buf_hdr_t *hdr = pbuf->b_hdr;
ASSERT(!refcount_is_zero(&pbuf->b_hdr->b_refcnt));
ASSERT3U((char *)bp - (char *)pbuf->b_data, <, pbuf->b_hdr->b_size);
@@ -2739,8 +2727,6 @@ arc_read(zio_t *pio, spa_t *spa, blkptr_
err = arc_read_nolock(pio, spa, bp, done, private, priority,
zio_flags, arc_flags, zb);
-
- ASSERT3P(hdr, ==, pbuf->b_hdr);
rw_exit(&pbuf->b_lock);
return (err);
}
@@ -2957,7 +2943,7 @@ top:
* released by l2arc_read_done().
*/
rzio = zio_read_phys(pio, vd, addr, size,
- buf->b_data, ZIO_CHECKSUM_OFF,
+ buf->b_data, ZIO_CHECKSUM_OFF,
l2arc_read_done, cb, priority, zio_flags |
ZIO_FLAG_DONT_CACHE | ZIO_FLAG_CANFAIL |
ZIO_FLAG_DONT_PROPAGATE |
@@ -3054,7 +3040,7 @@ arc_buf_evict(arc_buf_t *buf)
arc_buf_t **bufp;
list_t *list, *evicted_list;
kmutex_t *lock, *evicted_lock;
-
+
rw_enter(&buf->b_lock, RW_WRITER);
hdr = buf->b_hdr;
if (hdr == NULL) {
@@ -3729,7 +3715,6 @@ arc_init(void)
arc_size = 0;
for (i = 0; i < ARC_BUFC_NUMLISTS; i++) {
-
mutex_init(&arc_anon->arcs_locks[i].arcs_lock,
NULL, MUTEX_DEFAULT, NULL);
mutex_init(&arc_mru->arcs_locks[i].arcs_lock,
@@ -3742,7 +3727,7 @@ arc_init(void)
NULL, MUTEX_DEFAULT, NULL);
mutex_init(&arc_l2c_only->arcs_locks[i].arcs_lock,
NULL, MUTEX_DEFAULT, NULL);
-
+
list_create(&arc_mru->arcs_lists[i],
sizeof (arc_buf_hdr_t), offsetof(arc_buf_hdr_t, b_arc_node));
list_create(&arc_mru_ghost->arcs_lists[i],
@@ -3792,7 +3777,7 @@ arc_init(void)
#ifdef _KERNEL
if (TUNABLE_INT_FETCH("vfs.zfs.prefetch_disable", &zfs_prefetch_disable))
prefetch_tunable_set = 1;
-
+
#ifdef __i386__
if (prefetch_tunable_set == 0) {
printf("ZFS NOTICE: Prefetch is disabled by default on i386 "
@@ -3801,7 +3786,7 @@ arc_init(void)
"to /boot/loader.conf.\n");
zfs_prefetch_disable=1;
}
-#else
+#else
if ((((uint64_t)physmem * PAGESIZE) < (1ULL << 32)) &&
prefetch_tunable_set == 0) {
printf("ZFS NOTICE: Prefetch is disabled by default if less "
@@ -3810,7 +3795,7 @@ arc_init(void)
"to /boot/loader.conf.\n");
zfs_prefetch_disable=1;
}
-#endif
+#endif
/* Warn about ZFS memory and address space requirements. */
if (((uint64_t)physmem * PAGESIZE) < (256 + 128 + 64) * (1 << 20)) {
printf("ZFS WARNING: Recommended minimum RAM size is 512MB; "
@@ -3830,7 +3815,7 @@ void
arc_fini(void)
{
int i;
-
+
mutex_enter(&arc_reclaim_thr_lock);
arc_thread_exit = 1;
cv_signal(&arc_reclaim_thr_cv);
@@ -3856,14 +3841,16 @@ arc_fini(void)
list_destroy(&arc_mru_ghost->arcs_lists[i]);
list_destroy(&arc_mfu->arcs_lists[i]);
list_destroy(&arc_mfu_ghost->arcs_lists[i]);
+ list_destroy(&arc_l2c_only->arcs_lists[i]);
mutex_destroy(&arc_anon->arcs_locks[i].arcs_lock);
mutex_destroy(&arc_mru->arcs_locks[i].arcs_lock);
mutex_destroy(&arc_mru_ghost->arcs_locks[i].arcs_lock);
mutex_destroy(&arc_mfu->arcs_locks[i].arcs_lock);
mutex_destroy(&arc_mfu_ghost->arcs_locks[i].arcs_lock);
+ mutex_destroy(&arc_l2c_only->arcs_locks[i].arcs_lock);
}
-
+
mutex_destroy(&zfs_write_limit_lock);
buf_fini();
@@ -4259,18 +4246,18 @@ l2arc_list_locked(int list_num, kmutex_t
{
list_t *list;
int idx;
-
- ASSERT(list_num >= 0 && list_num < 2*ARC_BUFC_NUMLISTS);
+
+ ASSERT(list_num >= 0 && list_num < 2 * ARC_BUFC_NUMLISTS);
if (list_num < ARC_BUFC_NUMMETADATALISTS) {
idx = list_num;
list = &arc_mfu->arcs_lists[idx];
*lock = ARCS_LOCK(arc_mfu, idx);
- } else if (list_num < ARC_BUFC_NUMMETADATALISTS*2) {
+ } else if (list_num < ARC_BUFC_NUMMETADATALISTS * 2) {
idx = list_num - ARC_BUFC_NUMMETADATALISTS;
list = &arc_mru->arcs_lists[idx];
*lock = ARCS_LOCK(arc_mru, idx);
- } else if (list_num < (ARC_BUFC_NUMMETADATALISTS*2 +
+ } else if (list_num < (ARC_BUFC_NUMMETADATALISTS * 2 +
ARC_BUFC_NUMDATALISTS)) {
idx = list_num - ARC_BUFC_NUMMETADATALISTS;
list = &arc_mfu->arcs_lists[idx];
@@ -4281,8 +4268,6 @@ l2arc_list_locked(int list_num, kmutex_t
*lock = ARCS_LOCK(arc_mru, idx);
}
- CTR3(KTR_SPARE2, "list=%p list_num=%d idx=%d",
- list, list_num, idx);
ASSERT(!(MUTEX_HELD(*lock)));
mutex_enter(*lock);
return (list);
@@ -4452,7 +4437,7 @@ l2arc_write_buffers(spa_t *spa, l2arc_de
* Copy buffers for L2ARC writing.
*/
mutex_enter(&l2arc_buflist_mtx);
- for (try = 0; try < 2*ARC_BUFC_NUMLISTS; try++) {
+ for (try = 0; try < 2 * ARC_BUFC_NUMLISTS; try++) {
list = l2arc_list_locked(try, &list_lock);
passed_sz = 0;
ARCSTAT_BUMP(arcstat_l2_write_buffer_list_iter);
@@ -4468,9 +4453,8 @@ l2arc_write_buffers(spa_t *spa, l2arc_de
ab = list_head(list);
else
ab = list_tail(list);
- if (ab == NULL) {
+ if (ab == NULL)
ARCSTAT_BUMP(arcstat_l2_write_buffer_list_null_iter);
- }
for (; ab; ab = ab_prev) {
if (arc_warm == B_FALSE)
@@ -4478,7 +4462,7 @@ l2arc_write_buffers(spa_t *spa, l2arc_de
else
ab_prev = list_prev(list, ab);
ARCSTAT_INCR(arcstat_l2_write_buffer_bytes_scanned, ab->b_size);
-
+
hash_lock = HDR_LOCK(ab);
have_lock = MUTEX_HELD(hash_lock);
if (!have_lock && !mutex_tryenter(hash_lock)) {
@@ -4562,6 +4546,7 @@ l2arc_write_buffers(spa_t *spa, l2arc_de
hdrl2->b_dev = dev;
hdrl2->b_daddr = dev->l2ad_hand;
+ ab->b_flags |= ARC_L2_WRITING;
ab->b_l2hdr = hdrl2;
list_insert_head(dev->l2ad_buflist, ab);
buf_data = ab->b_buf->b_data;
Modified: user/jmallett/octeon/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h
==============================================================================
--- user/jmallett/octeon/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h Sun Apr 18 22:51:15 2010 (r206821)
+++ user/jmallett/octeon/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h Sun Apr 18 22:51:20 2010 (r206822)
@@ -55,8 +55,8 @@ struct arc_buf {
};
typedef enum arc_buf_contents {
- ARC_BUFC_METADATA, /* buffer contains metadata */
ARC_BUFC_DATA, /* buffer contains data */
+ ARC_BUFC_METADATA, /* buffer contains metadata */
ARC_BUFC_NUMTYPES
} arc_buf_contents_t;
/*
Modified: user/jmallett/octeon/sys/dev/ahci/ahci.c
==============================================================================
--- user/jmallett/octeon/sys/dev/ahci/ahci.c Sun Apr 18 22:51:15 2010 (r206821)
+++ user/jmallett/octeon/sys/dev/ahci/ahci.c Sun Apr 18 22:51:20 2010 (r206822)
@@ -126,6 +126,7 @@ static struct {
{0x26838086, 0x00, "Intel ESB2", 0},
{0x27c18086, 0x00, "Intel ICH7", 0},
{0x27c38086, 0x00, "Intel ICH7", 0},
+ {0x27c48086, 0x00, "Intel ICH7M", 0},
{0x27c58086, 0x00, "Intel ICH7M", 0},
{0x27c68086, 0x00, "Intel ICH7M", 0},
{0x28218086, 0x00, "Intel ICH8", 0},
Modified: user/jmallett/octeon/sys/dev/ipw/if_ipw.c
==============================================================================
--- user/jmallett/octeon/sys/dev/ipw/if_ipw.c Sun Apr 18 22:51:15 2010 (r206821)
+++ user/jmallett/octeon/sys/dev/ipw/if_ipw.c Sun Apr 18 22:51:20 2010 (r206822)
@@ -888,10 +888,10 @@ ipw_newstate(struct ieee80211vap *vap, e
/*
* XXX when joining an ibss network we are called
* with a SCAN -> RUN transition on scan complete.
- * Use that to call ipw_auth_and_assoc. On completing
- * the join we are then called again with an
- * AUTH -> RUN transition and we want to do nothing.
- * This is all totally bogus and needs to be redone.
+ * Use that to call ipw_assoc. On completing the
+ * join we are then called again with an AUTH -> RUN
+ * transition and we want to do nothing. This is
+ * all totally bogus and needs to be redone.
*/
if (ostate == IEEE80211_S_SCAN)
ipw_assoc(ic, vap);
@@ -904,12 +904,19 @@ ipw_newstate(struct ieee80211vap *vap, e
break;
case IEEE80211_S_AUTH:
+ /*
+ * Move to ASSOC state after the ipw_assoc() call. Firmware
+ * takes care of authentication, after the call we'll receive
+ * only an assoc response which would otherwise be discared
+ * if we are still in AUTH state.
+ */
+ nstate = IEEE80211_S_ASSOC;
ipw_assoc(ic, vap);
break;
case IEEE80211_S_ASSOC:
/*
- * If we are not transitioning from AUTH the resend the
+ * If we are not transitioning from AUTH then resend the
* association request.
*/
if (ostate != IEEE80211_S_AUTH)
@@ -1021,7 +1028,6 @@ ipw_rx_newstate_intr(struct ipw_softc *s
}
sc->flags &= ~IPW_FLAG_ASSOCIATING;
sc->flags |= IPW_FLAG_ASSOCIATED;
- ieee80211_new_state(vap, IEEE80211_S_RUN, -1);
break;
case IPW_STATE_SCANNING:
@@ -1034,8 +1040,10 @@ ipw_rx_newstate_intr(struct ipw_softc *s
* we checked the 802.11 layer state.
*/
if (sc->flags & IPW_FLAG_ASSOCIATED) {
+ IPW_UNLOCK(sc);
/* XXX probably need to issue disassoc to fw */
ieee80211_beacon_miss(ic);
+ IPW_LOCK(sc);
}
break;
@@ -1054,7 +1062,9 @@ ipw_rx_newstate_intr(struct ipw_softc *s
break;
}
if (sc->flags & IPW_FLAG_SCANNING) {
+ IPW_UNLOCK(sc);
ieee80211_scan_done(vap);
+ IPW_LOCK(sc);
sc->flags &= ~IPW_FLAG_SCANNING;
sc->sc_scan_timer = 0;
}
@@ -1064,13 +1074,16 @@ ipw_rx_newstate_intr(struct ipw_softc *s
DPRINTFN(2, ("Association lost (%s flags 0x%x)\n",
IEEESTATE(vap), sc->flags));
sc->flags &= ~(IPW_FLAG_ASSOCIATING | IPW_FLAG_ASSOCIATED);
- if (vap->iv_state == IEEE80211_S_RUN)
+ if (vap->iv_state == IEEE80211_S_RUN) {
+ IPW_UNLOCK(sc);
ieee80211_new_state(vap, IEEE80211_S_SCAN, -1);
+ IPW_LOCK(sc);
+ }
break;
case IPW_STATE_DISABLED:
/* XXX? is this right? */
- sc->flags &= ~(IPW_FLAG_HACK | IPW_FLAG_SCANNING |
+ sc->flags &= ~(IPW_FLAG_HACK | IPW_FLAG_SCANNING |
IPW_FLAG_ASSOCIATING | IPW_FLAG_ASSOCIATED);
DPRINTFN(2, ("Firmware disabled (%s flags 0x%x)\n",
IEEESTATE(vap), sc->flags));
@@ -1164,7 +1177,6 @@ ipw_rx_data_intr(struct ipw_softc *sc, s
bus_addr_t physaddr;
int error;
int8_t rssi, nf;
- IPW_LOCK_DECL;
DPRINTFN(5, ("received frame len=%u, rssi=%u\n", le32toh(status->len),
status->rssi));
@@ -1234,10 +1246,10 @@ ipw_rx_data_intr(struct ipw_softc *sc, s
IPW_UNLOCK(sc);
ni = ieee80211_find_rxnode(ic, mtod(m, struct ieee80211_frame_min *));
if (ni != NULL) {
- (void) ieee80211_input(ni, m, rssi, nf);
+ (void) ieee80211_input(ni, m, rssi - nf, nf);
ieee80211_free_node(ni);
} else
- (void) ieee80211_input_all(ic, m, rssi, nf);
+ (void) ieee80211_input_all(ic, m, rssi - nf, nf);
IPW_LOCK(sc);
bus_dmamap_sync(sc->rbd_dmat, sc->rbd_map, BUS_DMASYNC_PREWRITE);
@@ -1378,8 +1390,11 @@ ipw_fatal_error_intr(struct ipw_softc *s
struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps);
device_printf(sc->sc_dev, "firmware error\n");
- if (vap != NULL)
+ if (vap != NULL) {
+ IPW_UNLOCK(sc);
ieee80211_cancel_scan(vap);
+ IPW_LOCK(sc);
+ }
ieee80211_runtask(ic, &sc->sc_init_task);
}
@@ -1388,7 +1403,6 @@ ipw_intr(void *arg)
{
struct ipw_softc *sc = arg;
uint32_t r;
- IPW_LOCK_DECL;
IPW_LOCK(sc);
@@ -1718,7 +1732,6 @@ static void
ipw_start(struct ifnet *ifp)
{
struct ipw_softc *sc = ifp->if_softc;
- IPW_LOCK_DECL;
IPW_LOCK(sc);
ipw_start_locked(ifp);
@@ -1775,7 +1788,9 @@ ipw_watchdog(void *arg)
DPRINTFN(3, ("Scan timeout\n"));
/* End the scan */
if (sc->flags & IPW_FLAG_SCANNING) {
+ IPW_UNLOCK(sc);
ieee80211_scan_done(TAILQ_FIRST(&ic->ic_vaps));
+ IPW_LOCK(sc);
sc->flags &= ~IPW_FLAG_SCANNING;
}
}
@@ -1791,7 +1806,6 @@ ipw_ioctl(struct ifnet *ifp, u_long cmd,
struct ieee80211com *ic = ifp->if_l2com;
struct ifreq *ifr = (struct ifreq *) data;
int error = 0, startall = 0;
- IPW_LOCK_DECL;
switch (cmd) {
case SIOCSIFFLAGS:
@@ -2201,7 +2215,6 @@ ipw_assoc(struct ieee80211com *ic, struc
struct ipw_security security;
uint32_t data;
int error;
- IPW_LOCK_DECL;
IPW_LOCK(sc);
error = ipw_disable(sc);
@@ -2260,8 +2273,8 @@ ipw_assoc(struct ieee80211com *ic, struc
if (error != 0)
goto done;
- if (vap->iv_appie_assocreq != NULL) {
- struct ieee80211_appie *ie = vap->iv_appie_assocreq;
+ if (vap->iv_appie_wpa != NULL) {
+ struct ieee80211_appie *ie = vap->iv_appie_wpa;
error = ipw_setwpaie(sc, ie->ie_data, ie->ie_len);
if (error != 0)
goto done;
@@ -2291,7 +2304,6 @@ ipw_disassoc(struct ieee80211com *ic, st
struct ifnet *ifp = vap->iv_ic->ic_ifp;
struct ieee80211_node *ni = vap->iv_bss;
struct ipw_softc *sc = ifp->if_softc;
- IPW_LOCK_DECL;
IPW_LOCK(sc);
DPRINTF(("Disassociate from %6D\n", ni->ni_bssid, ":"));
@@ -2327,7 +2339,6 @@ ipw_init(void *priv)
struct ipw_softc *sc = priv;
struct ifnet *ifp = sc->sc_ifp;
struct ieee80211com *ic = ifp->if_l2com;
- IPW_LOCK_DECL;
IPW_LOCK(sc);
ipw_init_locked(sc);
@@ -2534,7 +2545,6 @@ static void
ipw_stop(void *priv)
{
struct ipw_softc *sc = priv;
- IPW_LOCK_DECL;
IPW_LOCK(sc);
ipw_stop_locked(sc);
@@ -2661,7 +2671,6 @@ ipw_scan_start(struct ieee80211com *ic)
{
struct ifnet *ifp = ic->ic_ifp;
struct ipw_softc *sc = ifp->if_softc;
- IPW_LOCK_DECL;
IPW_LOCK(sc);
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-src-user
mailing list