From 0fe3d820f5be0cc5733f08aa4a57093c7b8febe6 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Mon, 18 Apr 2011 16:27:45 -0700 Subject: [PATCH] Fix gcc compiler warning, dsl_pool_create() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit When compiling ZFS in user space gcc-4.6.0 correctly identifies the variable 'os' as being set but never used. This generates a warning and a build failure when using --enable-debug. However, the code is correct we only want to use 'os' for the kernel space builds. To suppress the warning the call was wrapped with a VERIFY() which has the nice side effect of ensuring the 'os' actually never is NULL. This was observed under Fedora 15. module/zfs/dsl_pool.c: In function ‘dsl_pool_create’: module/zfs/dsl_pool.c:229:12: error: variable ‘os’ set but not used [-Werror=unused-but-set-variable] --- module/zfs/dsl_pool.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/module/zfs/dsl_pool.c b/module/zfs/dsl_pool.c index 7185540f1..6c54193ce 100644 --- a/module/zfs/dsl_pool.c +++ b/module/zfs/dsl_pool.c @@ -275,8 +275,8 @@ dsl_pool_create(spa_t *spa, nvlist_t *zplprops, uint64_t txg) /* create the root objset */ VERIFY(0 == dsl_dataset_hold_obj(dp, obj, FTAG, &ds)); - os = dmu_objset_create_impl(dp->dp_spa, ds, - dsl_dataset_get_blkptr(ds), DMU_OST_ZFS, tx); + VERIFY(NULL != (os = dmu_objset_create_impl(dp->dp_spa, ds, + dsl_dataset_get_blkptr(ds), DMU_OST_ZFS, tx))); #ifdef _KERNEL zfs_create_fs(os, kcred, zplprops, tx); #endif -- 2.40.0