Merge commit 'refs/top-bases/linux-kernel-device' into linux-kernel-device

This commit is contained in:
Brian Behlendorf 2010-06-28 10:37:50 -07:00
commit 670e4c64ca
5 changed files with 20 additions and 21 deletions

View File

@ -204,7 +204,11 @@ _NOTE(CONSTCOND) } while (0)
* Threads * Threads
*/ */
#define TS_RUN 0x00000002 #define TS_RUN 0x00000002
#ifdef _linux_
#define STACK_SIZE 8192 /* Linux x86 and amd64 */ #define STACK_SIZE 8192 /* Linux x86 and amd64 */
#else
#define STACK_SIZE 24576 /* Solaris */
#endif
/* in libzpool, p0 exists only to have its address taken */ /* in libzpool, p0 exists only to have its address taken */
typedef struct proc { typedef struct proc {

View File

@ -144,14 +144,9 @@ zk_thread_create(caddr_t stk, size_t stksize, thread_func_t func, void *arg,
size_t len, proc_t *pp, int state, pri_t pri) size_t len, proc_t *pp, int state, pri_t pri)
{ {
kthread_t *kt; kthread_t *kt;
pthread_t tid;
pthread_attr_t attr; pthread_attr_t attr;
size_t stack; size_t stack;
/*
* Due to a race when getting/setting the thread ID, currently only
* detached threads are supported.
*/
ASSERT3S(state & ~TS_RUN, ==, 0); ASSERT3S(state & ~TS_RUN, ==, 0);
kt = umem_zalloc(sizeof(kthread_t), UMEM_NOFAIL); kt = umem_zalloc(sizeof(kthread_t), UMEM_NOFAIL);
@ -159,23 +154,23 @@ zk_thread_create(caddr_t stk, size_t stksize, thread_func_t func, void *arg,
kt->t_arg = arg; kt->t_arg = arg;
/* /*
* The Solaris kernel stack size in x86/x64 is 8K, so we reduce the * The Solaris kernel stack size is 24k for x86/x86_64.
* default stack size in userspace, for sanity checking. * The Linux kernel stack size is 8k for x86/x86_64.
* *
* PTHREAD_STACK_MIN is the stack required for a NULL procedure in * We reduce the default stack size in userspace, to ensure
* userspace. * we observe stack overruns in user space as well as in
* * kernel space. PTHREAD_STACK_MIN is the minimum stack
* XXX: Stack size for other architectures is not being taken into * required for a NULL procedure in user space and is added
* account. * in to the stack requirements.
*/ */
stack = PTHREAD_STACK_MIN + MAX(stksize, STACK_SIZE); stack = PTHREAD_STACK_MIN + MAX(stksize, STACK_SIZE);
VERIFY3S(pthread_attr_init(&attr), ==, 0); VERIFY3S(pthread_attr_init(&attr), ==, 0);
VERIFY3S(pthread_attr_setstacksize(&attr, stack), ==, 0); VERIFY3S(pthread_attr_setstacksize(&attr, stack), ==, 0);
VERIFY3S(pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED), VERIFY3S(pthread_attr_setguardsize(&attr, PAGESIZE), ==, 0);
==, 0);
VERIFY3S(pthread_create(&tid, &attr, &zk_thread_helper, kt), ==, 0); VERIFY3S(pthread_create(&kt->t_tid, &attr, &zk_thread_helper, kt),
==, 0);
VERIFY3S(pthread_attr_destroy(&attr), ==, 0); VERIFY3S(pthread_attr_destroy(&attr), ==, 0);

View File

@ -914,7 +914,7 @@ dmu_objset_snapshot(char *fsname, char *snapname,
if (dst->dst_err) if (dst->dst_err)
dsl_dataset_name(ds, sn->failed); dsl_dataset_name(ds, sn->failed);
zil_resume(dmu_objset_zil(os)); zil_resume(dmu_objset_zil(os));
dmu_objset_rele(os, &sn); dmu_objset_rele(os, sn);
} }
if (err) if (err)

View File

@ -1638,8 +1638,11 @@ raidz_checksum_verify(zio_t *zio)
{ {
zio_bad_cksum_t zbc; zio_bad_cksum_t zbc;
raidz_map_t *rm = zio->io_vsd; raidz_map_t *rm = zio->io_vsd;
int ret;
int ret = zio_checksum_error(zio, &zbc); bzero(&zbc, sizeof (zio_bad_cksum_t));
ret = zio_checksum_error(zio, &zbc);
if (ret != 0 && zbc.zbc_injected != 0) if (ret != 0 && zbc.zbc_injected != 0)
rm->rm_ecksuminjected = 1; rm->rm_ecksuminjected = 1;

View File

@ -1049,10 +1049,7 @@ zio_taskq_dispatch(zio_t *zio, enum zio_taskq_type q, boolean_t cutinline)
{ {
spa_t *spa = zio->io_spa; spa_t *spa = zio->io_spa;
zio_type_t t = zio->io_type; zio_type_t t = zio->io_type;
int flags; int flags = TQ_NOSLEEP | (cutinline ? TQ_FRONT : 0);
flags = (cutinline ? TQ_FRONT : 0);
flags |= ((q == ZIO_TASKQ_INTERRUPT) ? TQ_NOSLEEP : TQ_SLEEP);
/* /*
* If we're a config writer or a probe, the normal issue and * If we're a config writer or a probe, the normal issue and