implicit conversion from 'boolean_t' to 'ds_hold_flags_t'
Build error on illumos with gcc 10 did reveal: In function 'dmu_objset_refresh_ownership': ../../common/fs/zfs/dmu_objset.c:857:25: error: implicit conversion from 'boolean_t' to 'ds_hold_flags_t' {aka 'enum ds_hold_flags'} [-Werror=enum-conversion] 857 | dsl_dataset_disown(ds, decrypt, tag); | ^~~~~~~ cc1: all warnings being treated as errors libzfs_input_check.c: In function 'zfs_ioc_input_tests': libzfs_input_check.c:754:28: error: implicit conversion from 'enum dmu_objset_type' to 'enum lzc_dataset_type' [-Werror=enum-conversion] 754 | err = lzc_create(dataset, DMU_OST_ZFS, NULL, NULL, 0); | ^~~~~~~~~~~ cc1: all warnings being treated as errors The same issue is present in openzfs, and also the same issue about ds_hold_flags_t, which currently defines exactly one valid value. Reviewed-by: Igor Kozhukhov <igor@dilos.org> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Toomas Soome <tsoome@me.com> Closes #11406
This commit is contained in:
parent
c449d4b06d
commit
40ab927ae8
@ -316,6 +316,7 @@ typedef struct dsl_dataset_snapshot_arg {
|
||||
|
||||
/* flags for holding the dataset */
|
||||
typedef enum ds_hold_flags {
|
||||
DS_HOLD_FLAG_NONE = 0 << 0,
|
||||
DS_HOLD_FLAG_DECRYPT = 1 << 0 /* needs access to encrypted data */
|
||||
} ds_hold_flags_t;
|
||||
|
||||
|
@ -682,8 +682,9 @@ dmu_objset_hold_flags(const char *name, boolean_t decrypt, void *tag,
|
||||
dsl_pool_t *dp;
|
||||
dsl_dataset_t *ds;
|
||||
int err;
|
||||
ds_hold_flags_t flags = (decrypt) ? DS_HOLD_FLAG_DECRYPT : 0;
|
||||
ds_hold_flags_t flags;
|
||||
|
||||
flags = (decrypt) ? DS_HOLD_FLAG_DECRYPT : DS_HOLD_FLAG_NONE;
|
||||
err = dsl_pool_hold(name, tag, &dp);
|
||||
if (err != 0)
|
||||
return (err);
|
||||
@ -755,8 +756,9 @@ dmu_objset_own(const char *name, dmu_objset_type_t type,
|
||||
dsl_pool_t *dp;
|
||||
dsl_dataset_t *ds;
|
||||
int err;
|
||||
ds_hold_flags_t flags = (decrypt) ? DS_HOLD_FLAG_DECRYPT : 0;
|
||||
ds_hold_flags_t flags;
|
||||
|
||||
flags = (decrypt) ? DS_HOLD_FLAG_DECRYPT : DS_HOLD_FLAG_NONE;
|
||||
err = dsl_pool_hold(name, FTAG, &dp);
|
||||
if (err != 0)
|
||||
return (err);
|
||||
@ -798,8 +800,9 @@ dmu_objset_own_obj(dsl_pool_t *dp, uint64_t obj, dmu_objset_type_t type,
|
||||
{
|
||||
dsl_dataset_t *ds;
|
||||
int err;
|
||||
ds_hold_flags_t flags = (decrypt) ? DS_HOLD_FLAG_DECRYPT : 0;
|
||||
ds_hold_flags_t flags;
|
||||
|
||||
flags = (decrypt) ? DS_HOLD_FLAG_DECRYPT : DS_HOLD_FLAG_NONE;
|
||||
err = dsl_dataset_own_obj(dp, obj, flags, tag, &ds);
|
||||
if (err != 0)
|
||||
return (err);
|
||||
@ -816,9 +819,10 @@ dmu_objset_own_obj(dsl_pool_t *dp, uint64_t obj, dmu_objset_type_t type,
|
||||
void
|
||||
dmu_objset_rele_flags(objset_t *os, boolean_t decrypt, void *tag)
|
||||
{
|
||||
ds_hold_flags_t flags = (decrypt) ? DS_HOLD_FLAG_DECRYPT : 0;
|
||||
|
||||
ds_hold_flags_t flags;
|
||||
dsl_pool_t *dp = dmu_objset_pool(os);
|
||||
|
||||
flags = (decrypt) ? DS_HOLD_FLAG_DECRYPT : DS_HOLD_FLAG_NONE;
|
||||
dsl_dataset_rele_flags(os->os_dsl_dataset, flags, tag);
|
||||
dsl_pool_rele(dp, tag);
|
||||
}
|
||||
@ -846,7 +850,9 @@ dmu_objset_refresh_ownership(dsl_dataset_t *ds, dsl_dataset_t **newds,
|
||||
{
|
||||
dsl_pool_t *dp;
|
||||
char name[ZFS_MAX_DATASET_NAME_LEN];
|
||||
ds_hold_flags_t flags;
|
||||
|
||||
flags = (decrypt) ? DS_HOLD_FLAG_DECRYPT : DS_HOLD_FLAG_NONE;
|
||||
VERIFY3P(ds, !=, NULL);
|
||||
VERIFY3P(ds->ds_owner, ==, tag);
|
||||
VERIFY(dsl_dataset_long_held(ds));
|
||||
@ -854,21 +860,22 @@ dmu_objset_refresh_ownership(dsl_dataset_t *ds, dsl_dataset_t **newds,
|
||||
dsl_dataset_name(ds, name);
|
||||
dp = ds->ds_dir->dd_pool;
|
||||
dsl_pool_config_enter(dp, FTAG);
|
||||
dsl_dataset_disown(ds, decrypt, tag);
|
||||
VERIFY0(dsl_dataset_own(dp, name,
|
||||
(decrypt) ? DS_HOLD_FLAG_DECRYPT : 0, tag, newds));
|
||||
dsl_dataset_disown(ds, flags, tag);
|
||||
VERIFY0(dsl_dataset_own(dp, name, flags, tag, newds));
|
||||
dsl_pool_config_exit(dp, FTAG);
|
||||
}
|
||||
|
||||
void
|
||||
dmu_objset_disown(objset_t *os, boolean_t decrypt, void *tag)
|
||||
{
|
||||
ds_hold_flags_t flags;
|
||||
|
||||
flags = (decrypt) ? DS_HOLD_FLAG_DECRYPT : DS_HOLD_FLAG_NONE;
|
||||
/*
|
||||
* Stop upgrading thread
|
||||
*/
|
||||
dmu_objset_upgrade_stop(os);
|
||||
dsl_dataset_disown(os->os_dsl_dataset,
|
||||
(decrypt) ? DS_HOLD_FLAG_DECRYPT : 0, tag);
|
||||
dsl_dataset_disown(os->os_dsl_dataset, flags, tag);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -560,7 +560,7 @@ dmu_recv_begin_check(void *arg, dmu_tx_t *tx)
|
||||
struct drr_begin *drrb = drba->drba_cookie->drc_drrb;
|
||||
uint64_t fromguid = drrb->drr_fromguid;
|
||||
int flags = drrb->drr_flags;
|
||||
ds_hold_flags_t dsflags = 0;
|
||||
ds_hold_flags_t dsflags = DS_HOLD_FLAG_NONE;
|
||||
int error;
|
||||
uint64_t featureflags = drba->drba_cookie->drc_featureflags;
|
||||
dsl_dataset_t *ds;
|
||||
@ -772,7 +772,7 @@ dmu_recv_begin_sync(void *arg, dmu_tx_t *tx)
|
||||
dsl_dataset_t *ds, *newds;
|
||||
objset_t *os;
|
||||
uint64_t dsobj;
|
||||
ds_hold_flags_t dsflags = 0;
|
||||
ds_hold_flags_t dsflags = DS_HOLD_FLAG_NONE;
|
||||
int error;
|
||||
uint64_t crflags = 0;
|
||||
dsl_crypto_params_t dummy_dcp = { 0 };
|
||||
@ -946,7 +946,7 @@ dmu_recv_resume_begin_check(void *arg, dmu_tx_t *tx)
|
||||
dsl_pool_t *dp = dmu_tx_pool(tx);
|
||||
struct drr_begin *drrb = drc->drc_drrb;
|
||||
int error;
|
||||
ds_hold_flags_t dsflags = 0;
|
||||
ds_hold_flags_t dsflags = DS_HOLD_FLAG_NONE;
|
||||
dsl_dataset_t *ds;
|
||||
const char *tofs = drc->drc_tofs;
|
||||
|
||||
@ -1094,7 +1094,7 @@ dmu_recv_resume_begin_sync(void *arg, dmu_tx_t *tx)
|
||||
const char *tofs = drba->drba_cookie->drc_tofs;
|
||||
uint64_t featureflags = drba->drba_cookie->drc_featureflags;
|
||||
dsl_dataset_t *ds;
|
||||
ds_hold_flags_t dsflags = 0;
|
||||
ds_hold_flags_t dsflags = DS_HOLD_FLAG_NONE;
|
||||
/* 6 extra bytes for /%recv */
|
||||
char recvname[ZFS_MAX_DATASET_NAME_LEN + 6];
|
||||
|
||||
@ -2315,8 +2315,9 @@ static void
|
||||
dmu_recv_cleanup_ds(dmu_recv_cookie_t *drc)
|
||||
{
|
||||
dsl_dataset_t *ds = drc->drc_ds;
|
||||
ds_hold_flags_t dsflags = (drc->drc_raw) ? 0 : DS_HOLD_FLAG_DECRYPT;
|
||||
ds_hold_flags_t dsflags;
|
||||
|
||||
dsflags = (drc->drc_raw) ? DS_HOLD_FLAG_NONE : DS_HOLD_FLAG_DECRYPT;
|
||||
/*
|
||||
* Wait for the txg sync before cleaning up the receive. For
|
||||
* resumable receives, this ensures that our resume state has
|
||||
|
@ -2626,7 +2626,7 @@ dmu_send_obj(const char *pool, uint64_t tosnap, uint64_t fromsnap,
|
||||
{
|
||||
int err;
|
||||
dsl_dataset_t *fromds;
|
||||
ds_hold_flags_t dsflags = (rawok) ? 0 : DS_HOLD_FLAG_DECRYPT;
|
||||
ds_hold_flags_t dsflags;
|
||||
struct dmu_send_params dspp = {0};
|
||||
dspp.embedok = embedok;
|
||||
dspp.large_block_ok = large_block_ok;
|
||||
@ -2638,6 +2638,7 @@ dmu_send_obj(const char *pool, uint64_t tosnap, uint64_t fromsnap,
|
||||
dspp.rawok = rawok;
|
||||
dspp.savedok = savedok;
|
||||
|
||||
dsflags = (rawok) ? DS_HOLD_FLAG_NONE : DS_HOLD_FLAG_DECRYPT;
|
||||
err = dsl_pool_hold(pool, FTAG, &dspp.dp);
|
||||
if (err != 0)
|
||||
return (err);
|
||||
@ -2711,12 +2712,13 @@ dmu_send(const char *tosnap, const char *fromsnap, boolean_t embedok,
|
||||
dmu_send_outparams_t *dsop)
|
||||
{
|
||||
int err = 0;
|
||||
ds_hold_flags_t dsflags = (rawok) ? 0 : DS_HOLD_FLAG_DECRYPT;
|
||||
ds_hold_flags_t dsflags;
|
||||
boolean_t owned = B_FALSE;
|
||||
dsl_dataset_t *fromds = NULL;
|
||||
zfs_bookmark_phys_t book = {0};
|
||||
struct dmu_send_params dspp = {0};
|
||||
|
||||
dsflags = (rawok) ? DS_HOLD_FLAG_NONE : DS_HOLD_FLAG_DECRYPT;
|
||||
dspp.tosnap = tosnap;
|
||||
dspp.embedok = embedok;
|
||||
dspp.large_block_ok = large_block_ok;
|
||||
|
@ -796,7 +796,7 @@ zfs_ioc_input_tests(const char *pool)
|
||||
(void) snprintf(clonesnap, sizeof (clonesnap), "%s@snap", clone);
|
||||
(void) snprintf(backup, sizeof (backup), "%s/backup", pool);
|
||||
|
||||
err = lzc_create(dataset, DMU_OST_ZFS, NULL, NULL, 0);
|
||||
err = lzc_create(dataset, LZC_DATSET_TYPE_ZFS, NULL, NULL, -1);
|
||||
if (err) {
|
||||
(void) fprintf(stderr, "could not create '%s': %s\n",
|
||||
dataset, strerror(errno));
|
||||
|
Loading…
Reference in New Issue
Block a user