lib/lvol: no longer store clear_method as an xattr

Part of a longer series to make clear_method a lot easier to use and
understand. We're going to store this parm now in the blob metadata
instead of lvol xattr. That way it will be usable without having
to remove the option from lvol_create or adding to lvol_delete
(which was what the last version of this patch did for those keeping
score at home)

Note: the current use of this xattr is broken anyway, its missing
plumbing to use it on a subsequent delete so this doesn't break
anything new.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: Ie77a25ecdc52fd4aef6c090756c6cafe79486bc8
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470410
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
paul luse 2019-10-04 01:03:11 +00:00 committed by Tomasz Zawadzki
parent fd2af7afa9
commit 27fbf685bb

View File

@ -167,7 +167,6 @@ _spdk_load_next_lvol(void *cb_arg, struct spdk_blob *blob, int lvolerrno)
struct spdk_lvol *lvol, *tmp;
spdk_blob_id blob_id;
const char *attr;
const enum blob_clear_method *clear_method;
size_t value_len;
int rc;
@ -226,13 +225,6 @@ _spdk_load_next_lvol(void *cb_arg, struct spdk_blob *blob, int lvolerrno)
goto invalid;
}
rc = spdk_blob_get_xattr_value(blob, "clear_method", (const void **)&clear_method, &value_len);
if (rc != 0) {
lvol->clear_method = BLOB_CLEAR_WITH_DEFAULT;
} else {
lvol->clear_method = *clear_method;
}
snprintf(lvol->name, sizeof(lvol->name), "%s", attr);
TAILQ_INSERT_TAIL(&lvs->lvols, lvol, link);
@ -987,9 +979,6 @@ spdk_lvol_get_xattr_value(void *xattr_ctx, const char *name,
} else if (!strcmp("uuid", name)) {
*value = lvol->uuid_str;
*value_len = sizeof(lvol->uuid_str);
} else if (!strcmp("clear_method", name)) {
*value = &lvol->clear_method;
*value_len = sizeof(int);
}
}
@ -1035,7 +1024,7 @@ spdk_lvol_create(struct spdk_lvol_store *lvs, const char *name, uint64_t sz,
struct spdk_lvol *lvol;
struct spdk_blob_opts opts;
uint64_t num_clusters;
char *xattr_names[] = {LVOL_NAME, "uuid", "clear_method"};
char *xattr_names[] = {LVOL_NAME, "uuid"};
int rc;
if (lvs == NULL) {