Skip to content

Commit a9da0fb

Browse files
author
Mike Snitzer
committed
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: Mike Snitzer <[email protected]> Signed-off-by: Ken Raeburn <[email protected]> Signed-off-by: Matthew Sakai <[email protected]>
1 parent 4e41524 commit a9da0fb

File tree

16 files changed

+9
-2749
lines changed

16 files changed

+9
-2749
lines changed

drivers/md/dm-vdo/Makefile

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,15 @@ dm-vdo-objs := \
2828
packer.o \
2929
permassert.o \
3030
physical-zone.o \
31-
pool-sysfs.o \
32-
pool-sysfs-stats.o \
3331
priority-table.o \
3432
recovery-journal.o \
3533
repair.o \
3634
slab-depot.o \
3735
status-codes.o \
3836
string-utils.o \
39-
sysfs.o \
4037
thread-device.o \
4138
thread-registry.o \
4239
thread-utils.o \
43-
uds-sysfs.o \
4440
vdo.o \
4541
vio.o \
4642
wait-queue.o \

drivers/md/dm-vdo/dedupe.c

Lines changed: 3 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@
120120
#include <linux/atomic.h>
121121
#include <linux/jiffies.h>
122122
#include <linux/kernel.h>
123-
#include <linux/kobject.h>
124123
#include <linux/list.h>
125124
#include <linux/ratelimit.h>
126125
#include <linux/spinlock.h>
@@ -279,7 +278,6 @@ struct hash_lock {
279278

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

2025-
static void dedupe_kobj_release(struct kobject *directory)
2026-
{
2027-
vdo_free(container_of(directory, struct hash_zones, dedupe_directory));
2028-
}
2029-
2030-
static ssize_t dedupe_status_show(struct kobject *directory, struct attribute *attr,
2031-
char *buf)
2032-
{
2033-
struct uds_attribute *ua = container_of(attr, struct uds_attribute, attr);
2034-
struct hash_zones *zones = container_of(directory, struct hash_zones,
2035-
dedupe_directory);
2036-
2037-
if (ua->show_string != NULL)
2038-
return sprintf(buf, "%s\n", ua->show_string(zones));
2039-
else
2040-
return -EINVAL;
2041-
}
2042-
2043-
static ssize_t dedupe_status_store(struct kobject *kobj __always_unused,
2044-
struct attribute *attr __always_unused,
2045-
const char *buf __always_unused,
2046-
size_t length __always_unused)
2047-
{
2048-
return -EINVAL;
2049-
}
2050-
2051-
/*----------------------------------------------------------------------*/
2052-
2053-
static const struct sysfs_ops dedupe_sysfs_ops = {
2054-
.show = dedupe_status_show,
2055-
.store = dedupe_status_store,
2056-
};
2057-
2058-
static struct uds_attribute dedupe_status_attribute = {
2059-
.attr = {.name = "status", .mode = 0444, },
2060-
.show_string = vdo_get_dedupe_index_state_name,
2061-
};
2062-
2063-
static struct attribute *dedupe_attrs[] = {
2064-
&dedupe_status_attribute.attr,
2065-
NULL,
2066-
};
2067-
ATTRIBUTE_GROUPS(dedupe);
2068-
2069-
static const struct kobj_type dedupe_directory_type = {
2070-
.release = dedupe_kobj_release,
2071-
.sysfs_ops = &dedupe_sysfs_ops,
2072-
.default_groups = dedupe_groups,
2073-
};
2074-
20752023
static void start_uds_queue(void *ptr)
20762024
{
20772025
/*
@@ -2266,7 +2214,6 @@ static int initialize_index(struct vdo *vdo, struct hash_zones *zones)
22662214
vdo_initialize_completion(&zones->completion, vdo, VDO_HASH_ZONES_COMPLETION);
22672215
vdo_set_completion_callback(&zones->completion, change_dedupe_state,
22682216
vdo->thread_config.dedupe_thread);
2269-
kobject_init(&zones->dedupe_directory, &dedupe_directory_type);
22702217
return VDO_SUCCESS;
22712218
}
22722219

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

25392486
ratelimit_state_exit(&zones->ratelimiter);
2540-
if (vdo_get_admin_state_code(&zones->state) == VDO_ADMIN_STATE_NEW)
2541-
vdo_free(zones);
2542-
else
2543-
kobject_put(&zones->dedupe_directory);
2487+
vdo_free(zones);
25442488
}
25452489

25462490
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)
30472991
return -EINVAL;
30482992
}
30492993

3050-
int vdo_add_dedupe_index_sysfs(struct hash_zones *zones)
2994+
void vdo_set_dedupe_state_normal(struct hash_zones *zones)
30512995
{
3052-
int result = kobject_add(&zones->dedupe_directory,
3053-
&zones->completion.vdo->vdo_directory, "dedupe");
3054-
3055-
if (result == 0) {
3056-
vdo_set_admin_state_code(&zones->state,
3057-
VDO_ADMIN_STATE_NORMAL_OPERATION);
3058-
}
3059-
3060-
return result;
2996+
vdo_set_admin_state_code(&zones->state, VDO_ADMIN_STATE_NORMAL_OPERATION);
30612997
}
30622998

30632999
/* If create_flag, create a new index without first attempting to load an existing index. */

drivers/md/dm-vdo/dedupe.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ u64 vdo_get_dedupe_index_timeout_count(struct hash_zones *zones);
9797

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

100-
int vdo_add_dedupe_index_sysfs(struct hash_zones *zones);
100+
void vdo_set_dedupe_state_normal(struct hash_zones *zones);
101101

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

drivers/md/dm-vdo/dm-vdo-target.c

Lines changed: 4 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
#include "logger.h"
2828
#include "memory-alloc.h"
2929
#include "message-stats.h"
30-
#include "pool-sysfs.h"
3130
#include "recovery-journal.h"
3231
#include "repair.h"
3332
#include "slab-depot.h"
@@ -36,7 +35,6 @@
3635
#include "thread-device.h"
3736
#include "thread-registry.h"
3837
#include "types.h"
39-
#include "uds-sysfs.h"
4038
#include "vdo.h"
4139
#include "vio.h"
4240

@@ -54,7 +52,6 @@ enum admin_phases {
5452
GROW_PHYSICAL_PHASE_END,
5553
GROW_PHYSICAL_PHASE_ERROR,
5654
LOAD_PHASE_START,
57-
LOAD_PHASE_STATS,
5855
LOAD_PHASE_LOAD_DEPOT,
5956
LOAD_PHASE_MAKE_DIRTY,
6057
LOAD_PHASE_PREPARE_TO_ALLOCATE,
@@ -104,7 +101,6 @@ static const char * const ADMIN_PHASE_NAMES[] = {
104101
"GROW_PHYSICAL_PHASE_END",
105102
"GROW_PHYSICAL_PHASE_ERROR",
106103
"LOAD_PHASE_START",
107-
"LOAD_PHASE_STATS",
108104
"LOAD_PHASE_LOAD_DEPOT",
109105
"LOAD_PHASE_MAKE_DIRTY",
110106
"LOAD_PHASE_PREPARE_TO_ALLOCATE",
@@ -947,8 +943,8 @@ static void vdo_io_hints(struct dm_target *ti, struct queue_limits *limits)
947943
* blocked task warnings in kernel logs. In order to avoid these warnings, we choose to
948944
* use the smallest reasonable value.
949945
*
950-
* The value is displayed in sysfs, and also used by dm-thin to determine whether to pass
951-
* down discards. The block layer splits large discards on this boundary when this is set.
946+
* The value is used by dm-thin to determine whether to pass down discards. The block layer
947+
* splits large discards on this boundary when this is set.
952948
*/
953949
limits->max_discard_sectors =
954950
(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)
21742170
return VDO_SLAB_DEPOT_NORMAL_LOAD;
21752171
}
21762172

2177-
/**
2178-
* vdo_initialize_kobjects() - Initialize the vdo sysfs directory.
2179-
* @vdo: The vdo being initialized.
2180-
*
2181-
* Return: VDO_SUCCESS or an error code.
2182-
*/
2183-
static int vdo_initialize_kobjects(struct vdo *vdo)
2184-
{
2185-
int result;
2186-
struct dm_target *target = vdo->device_config->owning_target;
2187-
struct mapped_device *md = dm_table_get_md(target->table);
2188-
2189-
kobject_init(&vdo->vdo_directory, &vdo_directory_type);
2190-
vdo->sysfs_added = true;
2191-
result = kobject_add(&vdo->vdo_directory, &disk_to_dev(dm_disk(md))->kobj,
2192-
"vdo");
2193-
if (result != 0)
2194-
return VDO_CANT_ADD_SYSFS_NODE;
2195-
2196-
result = vdo_add_dedupe_index_sysfs(vdo->hash_zones);
2197-
if (result != 0)
2198-
return VDO_CANT_ADD_SYSFS_NODE;
2199-
2200-
return vdo_add_sysfs_stats_dir(vdo);
2201-
}
2202-
22032173
/**
22042174
* load_callback() - Callback to do the destructive parts of loading a VDO.
22052175
* @completion: The sub-task completion.
@@ -2225,11 +2195,8 @@ static void load_callback(struct vdo_completion *completion)
22252195
vdo_allow_read_only_mode_entry(completion);
22262196
return;
22272197

2228-
case LOAD_PHASE_STATS:
2229-
vdo_continue_completion(completion, vdo_initialize_kobjects(vdo));
2230-
return;
2231-
22322198
case LOAD_PHASE_LOAD_DEPOT:
2199+
vdo_set_dedupe_state_normal(vdo->hash_zones);
22332200
if (vdo_is_read_only(vdo)) {
22342201
/*
22352202
* 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)
28662833
static struct target_type vdo_target_bio = {
28672834
.features = DM_TARGET_SINGLETON,
28682835
.name = "vdo",
2869-
.version = { 8, 2, 0 },
2836+
.version = { 9, 0, 0 },
28702837
.module = THIS_MODULE,
28712838
.ctr = vdo_ctr,
28722839
.dtr = vdo_dtr,
@@ -2905,8 +2872,6 @@ static int __init vdo_init(void)
29052872

29062873
/* Memory tracking must be initialized first for accurate accounting. */
29072874
vdo_memory_init();
2908-
uds_init_sysfs();
2909-
29102875
vdo_initialize_thread_device_registry();
29112876
vdo_initialize_device_registry_once();
29122877
uds_log_info("loaded version %s", CURRENT_VERSION);
@@ -2933,7 +2898,6 @@ static int __init vdo_init(void)
29332898
static void __exit vdo_exit(void)
29342899
{
29352900
vdo_module_destroy();
2936-
uds_put_sysfs();
29372901
/* Memory tracking cleanup must be done last. */
29382902
vdo_memory_exit();
29392903
}

drivers/md/dm-vdo/logger.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,6 @@ int uds_get_log_level(void)
5656
return log_level;
5757
}
5858

59-
void uds_set_log_level(int new_log_level)
60-
{
61-
log_level = new_log_level;
62-
}
63-
6459
int uds_log_string_to_priority(const char *string)
6560
{
6661
int i;

drivers/md/dm-vdo/logger.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@
3737

3838
int uds_get_log_level(void);
3939

40-
void uds_set_log_level(int new_log_level);
41-
4240
int uds_log_string_to_priority(const char *string);
4341

4442
const char *uds_log_priority_to_string(int priority);

0 commit comments

Comments
 (0)