diff options
author | Brian Behlendorf <[email protected]> | 2009-02-02 15:12:30 -0800 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2009-02-02 15:12:30 -0800 |
commit | 31a033ecd49c2f691d6a377db2882ed941f47481 (patch) | |
tree | 4fe82ef3038f051bb02cd5e1de8333908e1da455 /module | |
parent | f220894e1fc86cbfaf073dc4cca519887c41e78e (diff) |
2.6.27+ portability changes
- Added SPL_AC_3ARGS_ON_EACH_CPU configure check to determine
if the older 4 argument version of on_each_cpu() should be
used or the new 3 argument version. The retry argument was
dropped in the new API which was never used anyway.
- Updated work queue compatibility wrappers. The old way this
worked was to pass a data point when initialized the workqueue.
The new API assumed the work item is embedding in a structure
and we us container_of() to find that data pointer.
- Updated skc->skc_flags to be an unsigned long which is now
type checked in the bit operations. This silences the warnings.
- Updated autogen products and splat tests accordingly
Diffstat (limited to 'module')
-rw-r--r-- | module/spl/spl-kmem.c | 6 | ||||
-rw-r--r-- | module/splat/splat-mutex.c | 23 |
2 files changed, 11 insertions, 18 deletions
diff --git a/module/spl/spl-kmem.c b/module/spl/spl-kmem.c index 83eefe293..79f787271 100644 --- a/module/spl/spl-kmem.c +++ b/module/spl/spl-kmem.c @@ -783,7 +783,7 @@ spl_cache_age(void *data) spl_get_work_data(data, spl_kmem_cache_t, skc_work.work); ASSERT(skc->skc_magic == SKC_MAGIC); - on_each_cpu(spl_magazine_age, skc, 0, 1); + spl_on_each_cpu(spl_magazine_age, skc, 1); spl_slab_reclaim(skc, 0); if (!test_bit(KMC_BIT_DESTROY, &skc->skc_flags)) @@ -923,7 +923,7 @@ spl_magazine_create(spl_kmem_cache_t *skc) skc->skc_mag_size = spl_magazine_size(skc); skc->skc_mag_refill = (skc->skc_mag_size + 1) / 2; - on_each_cpu(__spl_magazine_create, skc, 0, 1); + spl_on_each_cpu(__spl_magazine_create, skc, 1); RETURN(0); } @@ -945,7 +945,7 @@ static void spl_magazine_destroy(spl_kmem_cache_t *skc) { ENTRY; - on_each_cpu(__spl_magazine_destroy, skc, 0, 1); + spl_on_each_cpu(__spl_magazine_destroy, skc, 1); EXIT; } diff --git a/module/splat/splat-mutex.c b/module/splat/splat-mutex.c index 640f8f407..c64f27aaf 100644 --- a/module/splat/splat-mutex.c +++ b/module/splat/splat-mutex.c @@ -59,28 +59,26 @@ typedef struct mutex_priv { int mp_rc; } mutex_priv_t; -#ifdef HAVE_3ARGS_INIT_WORK static void splat_mutex_test1_work(void *priv) { - mutex_priv_t *mp = (mutex_priv_t *)priv; + mutex_priv_t *mp; + mp = spl_get_work_data(priv, mutex_priv_t, mp_work.work); ASSERT(mp->mp_magic == SPLAT_MUTEX_TEST_MAGIC); mp->mp_rc = 0; if (!mutex_tryenter(&mp->mp_mtx)) mp->mp_rc = -EBUSY; } -#endif static int splat_mutex_test1(struct file *file, void *arg) { - int rc = 0; -#ifdef HAVE_3ARGS_INIT_WORK struct workqueue_struct *wq; struct work_struct work; mutex_priv_t *mp; + int rc = 0; mp = (mutex_priv_t *)kmalloc(sizeof(*mp), GFP_KERNEL); if (mp == NULL) @@ -97,7 +95,7 @@ splat_mutex_test1(struct file *file, void *arg) mp->mp_magic = SPLAT_MUTEX_TEST_MAGIC; mp->mp_file = file; - INIT_WORK(&work, splat_mutex_test1_work, mp); + spl_init_work(&work, splat_mutex_test1_work, mp); /* Schedule a work item which will try and aquire the mutex via * mutex_tryenter() while its held. This should fail and the work @@ -143,17 +141,16 @@ out: destroy_workqueue(wq); out2: kfree(mp); -#endif return rc; } -#ifdef HAVE_3ARGS_INIT_WORK static void splat_mutex_test2_work(void *priv) { - mutex_priv_t *mp = (mutex_priv_t *)priv; + mutex_priv_t *mp; int rc; + mp = spl_get_work_data(priv, mutex_priv_t, mp_work.work); ASSERT(mp->mp_magic == SPLAT_MUTEX_TEST_MAGIC); /* Read the value before sleeping and write it after we wake up to @@ -165,16 +162,13 @@ splat_mutex_test2_work(void *priv) mp->mp_rc = rc + 1; mutex_exit(&mp->mp_mtx); } -#endif static int splat_mutex_test2(struct file *file, void *arg) { - int rc = 0; -#ifdef HAVE_3ARGS_INIT_WORK struct workqueue_struct *wq; mutex_priv_t *mp; - int i; + int i, rc = 0; mp = (mutex_priv_t *)kmalloc(sizeof(*mp), GFP_KERNEL); if (mp == NULL) @@ -200,7 +194,7 @@ splat_mutex_test2(struct file *file, void *arg) * critical region at the same time the system will panic. If the * mutex is implemented right this will never happy, that's a pass. */ for (i = 0; i < SPLAT_MUTEX_TEST_COUNT; i++) { - INIT_WORK(&(mp->mp_work[i]), splat_mutex_test2_work, mp); + spl_init_work(&(mp->mp_work[i]), splat_mutex_test2_work, mp); if (!queue_work(wq, &(mp->mp_work[i]))) { splat_vprint(file, SPLAT_MUTEX_TEST2_NAME, @@ -226,7 +220,6 @@ splat_mutex_test2(struct file *file, void *arg) destroy_workqueue(wq); out: kfree(mp); -#endif return rc; } |