Commit a9da0fb6 authored by Mike Snitzer's avatar Mike Snitzer
Browse files

dm vdo: remove all sysfs interfaces



Also update target major version number.

All info is (or will be) accessible through alternative interfaces
(e.g. "dmsetup message", module params, etc).

Signed-off-by: default avatarMike Snitzer <snitzer@kernel.org>
Signed-off-by: default avatarKen Raeburn <raeburn@redhat.com>
Signed-off-by: default avatarMatthew Sakai <msakai@redhat.com>
parent 4e415248
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -28,19 +28,15 @@ dm-vdo-objs := \
	packer.o \
	permassert.o \
	physical-zone.o \
	pool-sysfs.o \
	pool-sysfs-stats.o \
	priority-table.o \
	recovery-journal.o \
	repair.o \
	slab-depot.o \
	status-codes.o \
	string-utils.o \
	sysfs.o \
	thread-device.o \
	thread-registry.o \
	thread-utils.o \
	uds-sysfs.o \
	vdo.o \
	vio.o \
	wait-queue.o \
+3 −67
Original line number Diff line number Diff line
@@ -120,7 +120,6 @@
#include <linux/atomic.h>
#include <linux/jiffies.h>
#include <linux/kernel.h>
#include <linux/kobject.h>
#include <linux/list.h>
#include <linux/ratelimit.h>
#include <linux/spinlock.h>
@@ -279,7 +278,6 @@ struct hash_lock {

struct hash_zones {
	struct action_manager *manager;
	struct kobject dedupe_directory;
	struct uds_parameters parameters;
	struct uds_index_session *index_session;
	struct ratelimit_state ratelimiter;
@@ -2022,56 +2020,6 @@ void vdo_share_compressed_write_lock(struct data_vio *data_vio,
	VDO_ASSERT_LOG_ONLY(claimed, "impossible to fail to claim an initial increment");
}

static void dedupe_kobj_release(struct kobject *directory)
{
	vdo_free(container_of(directory, struct hash_zones, dedupe_directory));
}

static ssize_t dedupe_status_show(struct kobject *directory, struct attribute *attr,
				  char *buf)
{
	struct uds_attribute *ua = container_of(attr, struct uds_attribute, attr);
	struct hash_zones *zones = container_of(directory, struct hash_zones,
						dedupe_directory);

	if (ua->show_string != NULL)
		return sprintf(buf, "%s\n", ua->show_string(zones));
	else
		return -EINVAL;
}

static ssize_t dedupe_status_store(struct kobject *kobj __always_unused,
				   struct attribute *attr __always_unused,
				   const char *buf __always_unused,
				   size_t length __always_unused)
{
	return -EINVAL;
}

/*----------------------------------------------------------------------*/

static const struct sysfs_ops dedupe_sysfs_ops = {
	.show = dedupe_status_show,
	.store = dedupe_status_store,
};

static struct uds_attribute dedupe_status_attribute = {
	.attr = {.name = "status", .mode = 0444, },
	.show_string = vdo_get_dedupe_index_state_name,
};

static struct attribute *dedupe_attrs[] = {
	&dedupe_status_attribute.attr,
	NULL,
};
ATTRIBUTE_GROUPS(dedupe);

static const struct kobj_type dedupe_directory_type = {
	.release = dedupe_kobj_release,
	.sysfs_ops = &dedupe_sysfs_ops,
	.default_groups = dedupe_groups,
};

static void start_uds_queue(void *ptr)
{
	/*
@@ -2266,7 +2214,6 @@ static int initialize_index(struct vdo *vdo, struct hash_zones *zones)
	vdo_initialize_completion(&zones->completion, vdo, VDO_HASH_ZONES_COMPLETION);
	vdo_set_completion_callback(&zones->completion, change_dedupe_state,
				    vdo->thread_config.dedupe_thread);
	kobject_init(&zones->dedupe_directory, &dedupe_directory_type);
	return VDO_SUCCESS;
}

@@ -2537,10 +2484,7 @@ void vdo_free_hash_zones(struct hash_zones *zones)
		vdo_finish_dedupe_index(zones);

	ratelimit_state_exit(&zones->ratelimiter);
	if (vdo_get_admin_state_code(&zones->state) == VDO_ADMIN_STATE_NEW)
	vdo_free(zones);
	else
		kobject_put(&zones->dedupe_directory);
}

static void initiate_suspend_index(struct admin_state *state)
@@ -3047,17 +2991,9 @@ int vdo_message_dedupe_index(struct hash_zones *zones, const char *name)
	return -EINVAL;
}

int vdo_add_dedupe_index_sysfs(struct hash_zones *zones)
void vdo_set_dedupe_state_normal(struct hash_zones *zones)
{
	int result = kobject_add(&zones->dedupe_directory,
				 &zones->completion.vdo->vdo_directory, "dedupe");

	if (result == 0) {
		vdo_set_admin_state_code(&zones->state,
					 VDO_ADMIN_STATE_NORMAL_OPERATION);
	}

	return result;
	vdo_set_admin_state_code(&zones->state, VDO_ADMIN_STATE_NORMAL_OPERATION);
}

/* If create_flag, create a new index without first attempting to load an existing index. */
+1 −1
Original line number Diff line number Diff line
@@ -97,7 +97,7 @@ u64 vdo_get_dedupe_index_timeout_count(struct hash_zones *zones);

int vdo_message_dedupe_index(struct hash_zones *zones, const char *name);

int vdo_add_dedupe_index_sysfs(struct hash_zones *zones);
void vdo_set_dedupe_state_normal(struct hash_zones *zones);

void vdo_start_dedupe_index(struct hash_zones *zones, bool create_flag);

+4 −40
Original line number Diff line number Diff line
@@ -27,7 +27,6 @@
#include "logger.h"
#include "memory-alloc.h"
#include "message-stats.h"
#include "pool-sysfs.h"
#include "recovery-journal.h"
#include "repair.h"
#include "slab-depot.h"
@@ -36,7 +35,6 @@
#include "thread-device.h"
#include "thread-registry.h"
#include "types.h"
#include "uds-sysfs.h"
#include "vdo.h"
#include "vio.h"

@@ -54,7 +52,6 @@ enum admin_phases {
	GROW_PHYSICAL_PHASE_END,
	GROW_PHYSICAL_PHASE_ERROR,
	LOAD_PHASE_START,
	LOAD_PHASE_STATS,
	LOAD_PHASE_LOAD_DEPOT,
	LOAD_PHASE_MAKE_DIRTY,
	LOAD_PHASE_PREPARE_TO_ALLOCATE,
@@ -104,7 +101,6 @@ static const char * const ADMIN_PHASE_NAMES[] = {
	"GROW_PHYSICAL_PHASE_END",
	"GROW_PHYSICAL_PHASE_ERROR",
	"LOAD_PHASE_START",
	"LOAD_PHASE_STATS",
	"LOAD_PHASE_LOAD_DEPOT",
	"LOAD_PHASE_MAKE_DIRTY",
	"LOAD_PHASE_PREPARE_TO_ALLOCATE",
@@ -947,8 +943,8 @@ static void vdo_io_hints(struct dm_target *ti, struct queue_limits *limits)
	 * blocked task warnings in kernel logs. In order to avoid these warnings, we choose to
	 * use the smallest reasonable value.
	 *
	 * The value is displayed in sysfs, and also used by dm-thin to determine whether to pass
	 * down discards. The block layer splits large discards on this boundary when this is set.
	 * The value is used by dm-thin to determine whether to pass down discards. The block layer
	 * splits large discards on this boundary when this is set.
	 */
	limits->max_discard_sectors =
		(vdo->device_config->max_discard_blocks * VDO_SECTORS_PER_BLOCK);
@@ -2174,32 +2170,6 @@ static enum slab_depot_load_type get_load_type(struct vdo *vdo)
	return VDO_SLAB_DEPOT_NORMAL_LOAD;
}

/**
 * vdo_initialize_kobjects() - Initialize the vdo sysfs directory.
 * @vdo: The vdo being initialized.
 *
 * Return: VDO_SUCCESS or an error code.
 */
static int vdo_initialize_kobjects(struct vdo *vdo)
{
	int result;
	struct dm_target *target = vdo->device_config->owning_target;
	struct mapped_device *md = dm_table_get_md(target->table);

	kobject_init(&vdo->vdo_directory, &vdo_directory_type);
	vdo->sysfs_added = true;
	result = kobject_add(&vdo->vdo_directory, &disk_to_dev(dm_disk(md))->kobj,
			     "vdo");
	if (result != 0)
		return VDO_CANT_ADD_SYSFS_NODE;

	result = vdo_add_dedupe_index_sysfs(vdo->hash_zones);
	if (result != 0)
		return VDO_CANT_ADD_SYSFS_NODE;

	return vdo_add_sysfs_stats_dir(vdo);
}

/**
 * load_callback() - Callback to do the destructive parts of loading a VDO.
 * @completion: The sub-task completion.
@@ -2225,11 +2195,8 @@ static void load_callback(struct vdo_completion *completion)
		vdo_allow_read_only_mode_entry(completion);
		return;

	case LOAD_PHASE_STATS:
		vdo_continue_completion(completion, vdo_initialize_kobjects(vdo));
		return;

	case LOAD_PHASE_LOAD_DEPOT:
		vdo_set_dedupe_state_normal(vdo->hash_zones);
		if (vdo_is_read_only(vdo)) {
			/*
			 * In read-only mode we don't use the allocator and it may not even be
@@ -2866,7 +2833,7 @@ static void vdo_resume(struct dm_target *ti)
static struct target_type vdo_target_bio = {
	.features = DM_TARGET_SINGLETON,
	.name = "vdo",
	.version = { 8, 2, 0 },
	.version = { 9, 0, 0 },
	.module = THIS_MODULE,
	.ctr = vdo_ctr,
	.dtr = vdo_dtr,
@@ -2905,8 +2872,6 @@ static int __init vdo_init(void)

	/* Memory tracking must be initialized first for accurate accounting. */
	vdo_memory_init();
	uds_init_sysfs();

	vdo_initialize_thread_device_registry();
	vdo_initialize_device_registry_once();
	uds_log_info("loaded version %s", CURRENT_VERSION);
@@ -2933,7 +2898,6 @@ static int __init vdo_init(void)
static void __exit vdo_exit(void)
{
	vdo_module_destroy();
	uds_put_sysfs();
	/* Memory tracking cleanup must be done last. */
	vdo_memory_exit();
}
+0 −5
Original line number Diff line number Diff line
@@ -56,11 +56,6 @@ int uds_get_log_level(void)
	return log_level;
}

void uds_set_log_level(int new_log_level)
{
	log_level = new_log_level;
}

int uds_log_string_to_priority(const char *string)
{
	int i;
Loading