From 9d68e272ccdb2c6d3b017819abb61485b394e1ac Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Tue, 24 Jan 2017 14:44:11 -0800 Subject: [PATCH] Allow creation of items with no value Item creation always tried to allocate a value. We have some item types which don't have values. Signed-off-by: Zach Brown --- kmod/src/item.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kmod/src/item.c b/kmod/src/item.c index b3300598..45755724 100644 --- a/kmod/src/item.c +++ b/kmod/src/item.c @@ -100,8 +100,12 @@ static struct cached_item *alloc_item(struct super_block *sb, item = kzalloc(sizeof(struct cached_item), GFP_NOFS); if (item) { + if (!val) + scoutfs_kvec_init_null(item->val); + item->key = scoutfs_key_dup(sb, key); - if (!item->key || scoutfs_kvec_dup_flatten(item->val, val)) { + if (!item->key || + (val && scoutfs_kvec_dup_flatten(item->val, val))) { free_item(sb, item); item = NULL; }