Skip to content
This repository has been archived by the owner on Feb 8, 2024. It is now read-only.

Add dev symlink in udev rules after cache config #54

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CLI/eio_cli
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ do rm -f /dev/$$i; ln -f -s /dev/$env{disk_name} /dev/$$i; done'"
TEST!="/proc/enhanceio/<cache_name>", RUN+="/sbin/eio_cli \
enable -d /dev/$env{disk_name} -s /dev/$env{ssd_name} -m <mode> \
-b <block_size> -p <policy> -c <cache_name>"
<source_match_expr>, SYMLINK+="eio-<cache_name>"

LABEL="EIO_EOF"
"""
Expand Down
1 change: 1 addition & 0 deletions Documents/94-Enhanceio.template
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,6 @@ LABEL="EIO_SETUP"
PROGRAM="/bin/sh -c 'cat /dev/enhanceio/<cache_name>/.disk_name'", ENV{disk_name}="%c"

TEST!="/proc/enhanceio/<cache_name>", RUN+="/sbin/eio_cli enable -d /dev/$env{disk_name} -s /dev/$env{ssd_name} -m <mode> -b <block_size> -c <cache_name>"
<source_match_expr>, SYMLINK+="eio-<cache_name>"
LABEL="EIO_EOF"

4 changes: 4 additions & 0 deletions Driver/enhanceio/eio.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,11 @@ struct eio_control_s {
unsigned long synch_flags;
};

#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0))
int eio_wait_schedule(struct wait_bit_key *unused);
#else
int eio_wait_schedule(void *unused);
#endif

struct eio_event {
struct task_struct *process; /* handle of the sleeping process */
Expand Down
31 changes: 20 additions & 11 deletions Driver/enhanceio/eio_conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,22 @@ static struct notifier_block eio_ssd_rm_notifier = {
.priority = 0,
};

#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0))
int eio_wait_schedule(struct wait_bit_key *unused)
#else
#define wait_on_bit_lock_action wait_on_bit_lock
int eio_wait_schedule(void *unused)
#endif
{

schedule();
return 0;
}

#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,15,0))
#define smp_mb__after_atomic smp_mb__after_clear_bit
#endif

/*
* Check if the System RAM threshold > requested memory, don't care
* if threshold is set to 0. Return value is 0 for fail and 1 for success.
Expand Down Expand Up @@ -1842,13 +1851,13 @@ int eio_cache_create(struct cache_rec_short *cache)

dmc->sysctl_active.mem_limit_pct = 75;

(void)wait_on_bit_lock((void *)&eio_control->synch_flags,
(void)wait_on_bit_lock_action((void *)&eio_control->synch_flags,
EIO_UPDATE_LIST, eio_wait_schedule,
TASK_UNINTERRUPTIBLE);
dmc->next_cache = cache_list_head;
cache_list_head = dmc;
clear_bit(EIO_UPDATE_LIST, (void *)&eio_control->synch_flags);
smp_mb__after_clear_bit();
smp_mb__after_atomic();
wake_up_bit((void *)&eio_control->synch_flags, EIO_UPDATE_LIST);

prev_set = -1;
Expand Down Expand Up @@ -1901,7 +1910,7 @@ int eio_cache_create(struct cache_rec_short *cache)
vfree((void *)dmc->cache_sets);
vfree((void *)EIO_CACHE(dmc));

(void)wait_on_bit_lock((void *)&eio_control->synch_flags,
(void)wait_on_bit_lock_action((void *)&eio_control->synch_flags,
EIO_UPDATE_LIST, eio_wait_schedule,
TASK_UNINTERRUPTIBLE);
nodepp = &cache_list_head;
Expand All @@ -1913,7 +1922,7 @@ int eio_cache_create(struct cache_rec_short *cache)
nodepp = &((*nodepp)->next_cache);
}
clear_bit(EIO_UPDATE_LIST, (void *)&eio_control->synch_flags);
smp_mb__after_clear_bit();
smp_mb__after_atomic();
wake_up_bit((void *)&eio_control->synch_flags, EIO_UPDATE_LIST);
bad5:
eio_kcached_client_destroy(dmc);
Expand Down Expand Up @@ -2055,7 +2064,7 @@ int eio_cache_delete(char *cache_name, int do_delete)
vfree((void *)dmc->cache_sets);
eio_ttc_put_device(&dmc->disk_dev);
eio_put_cache_device(dmc);
(void)wait_on_bit_lock((void *)&eio_control->synch_flags,
(void)wait_on_bit_lock_action((void *)&eio_control->synch_flags,
EIO_UPDATE_LIST, eio_wait_schedule,
TASK_UNINTERRUPTIBLE);
nodepp = &cache_list_head;
Expand All @@ -2067,7 +2076,7 @@ int eio_cache_delete(char *cache_name, int do_delete)
nodepp = &((*nodepp)->next_cache);
}
clear_bit(EIO_UPDATE_LIST, &eio_control->synch_flags);
smp_mb__after_clear_bit();
smp_mb__after_atomic();
wake_up_bit((void *)&eio_control->synch_flags, EIO_UPDATE_LIST);

out:
Expand Down Expand Up @@ -2387,20 +2396,20 @@ eio_notify_reboot(struct notifier_block *this, unsigned long code, void *x)
if (eio_reboot_notified == EIO_REBOOT_HANDLING_DONE)
return NOTIFY_DONE;

(void)wait_on_bit_lock((void *)&eio_control->synch_flags,
(void)wait_on_bit_lock_action((void *)&eio_control->synch_flags,
EIO_HANDLE_REBOOT, eio_wait_schedule,
TASK_UNINTERRUPTIBLE);
if (eio_reboot_notified == EIO_REBOOT_HANDLING_DONE) {
clear_bit(EIO_HANDLE_REBOOT, (void *)&eio_control->synch_flags);
smp_mb__after_clear_bit();
smp_mb__after_atomic();
wake_up_bit((void *)&eio_control->synch_flags,
EIO_HANDLE_REBOOT);
return NOTIFY_DONE;
}
EIO_ASSERT(eio_reboot_notified == 0);
eio_reboot_notified = EIO_REBOOT_HANDLING_INPROG;

(void)wait_on_bit_lock((void *)&eio_control->synch_flags,
(void)wait_on_bit_lock_action((void *)&eio_control->synch_flags,
EIO_UPDATE_LIST, eio_wait_schedule,
TASK_UNINTERRUPTIBLE);
for (dmc = cache_list_head; dmc != NULL; dmc = dmc->next_cache) {
Expand All @@ -2420,12 +2429,12 @@ eio_notify_reboot(struct notifier_block *this, unsigned long code, void *x)
eio_md_store(dmc);
}
clear_bit(EIO_UPDATE_LIST, (void *)&eio_control->synch_flags);
smp_mb__after_clear_bit();
smp_mb__after_atomic();
wake_up_bit((void *)&eio_control->synch_flags, EIO_UPDATE_LIST);

eio_reboot_notified = EIO_REBOOT_HANDLING_DONE;
clear_bit(EIO_HANDLE_REBOOT, (void *)&eio_control->synch_flags);
smp_mb__after_clear_bit();
smp_mb__after_atomic();
wake_up_bit((void *)&eio_control->synch_flags, EIO_HANDLE_REBOOT);
return NOTIFY_DONE;
}
Expand Down
60 changes: 30 additions & 30 deletions Driver/enhanceio/eio_procfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ static struct sysctl_table_dir *sysctl_handle_dir;
* eio_zerostats_sysctl
*/
static int
eio_zerostats_sysctl(ctl_table *table, int write, void __user *buffer,
eio_zerostats_sysctl(struct ctl_table *table, int write, void __user *buffer,
size_t *length, loff_t *ppos)
{
struct cache_c *dmc = (struct cache_c *)table->extra1;
Expand Down Expand Up @@ -120,7 +120,7 @@ eio_zerostats_sysctl(ctl_table *table, int write, void __user *buffer,
* - sets the eio sysctl mem_limit_pct value
*/
static int
eio_mem_limit_pct_sysctl(ctl_table *table, int write, void __user *buffer,
eio_mem_limit_pct_sysctl(struct ctl_table *table, int write, void __user *buffer,
size_t *length, loff_t *ppos)
{
struct cache_c *dmc = (struct cache_c *)table->extra1;
Expand Down Expand Up @@ -167,7 +167,7 @@ eio_mem_limit_pct_sysctl(ctl_table *table, int write, void __user *buffer,
* eio_clean_sysctl
*/
static int
eio_clean_sysctl(ctl_table *table, int write, void __user *buffer,
eio_clean_sysctl(struct ctl_table *table, int write, void __user *buffer,
size_t *length, loff_t *ppos)
{
struct cache_c *dmc = (struct cache_c *)table->extra1;
Expand Down Expand Up @@ -249,7 +249,7 @@ eio_clean_sysctl(ctl_table *table, int write, void __user *buffer,
* eio_dirty_high_threshold_sysctl
*/
static int
eio_dirty_high_threshold_sysctl(ctl_table *table, int write,
eio_dirty_high_threshold_sysctl(struct ctl_table *table, int write,
void __user *buffer, size_t *length,
loff_t *ppos)
{
Expand Down Expand Up @@ -331,7 +331,7 @@ eio_dirty_high_threshold_sysctl(ctl_table *table, int write,
* eio_dirty_low_threshold_sysctl
*/
static int
eio_dirty_low_threshold_sysctl(ctl_table *table, int write,
eio_dirty_low_threshold_sysctl(struct ctl_table *table, int write,
void __user *buffer, size_t *length,
loff_t *ppos)
{
Expand Down Expand Up @@ -419,7 +419,7 @@ eio_dirty_low_threshold_sysctl(ctl_table *table, int write,
* eio_dirty_set_high_threshold_sysctl
*/
static int
eio_dirty_set_high_threshold_sysctl(ctl_table *table, int write,
eio_dirty_set_high_threshold_sysctl(struct ctl_table *table, int write,
void __user *buffer, size_t *length,
loff_t *ppos)
{
Expand Down Expand Up @@ -505,7 +505,7 @@ eio_dirty_set_high_threshold_sysctl(ctl_table *table, int write,
* eio_dirty_set_low_threshold_sysctl
*/
static int
eio_dirty_set_low_threshold_sysctl(ctl_table *table, int write,
eio_dirty_set_low_threshold_sysctl(struct ctl_table *table, int write,
void __user *buffer, size_t *length,
loff_t *ppos)
{
Expand Down Expand Up @@ -598,7 +598,7 @@ eio_dirty_set_low_threshold_sysctl(ctl_table *table, int write,
* eio_autoclean_threshold_sysctl
*/
static int
eio_autoclean_threshold_sysctl(ctl_table *table, int write,
eio_autoclean_threshold_sysctl(struct ctl_table *table, int write,
void __user *buffer, size_t *length,
loff_t *ppos)
{
Expand Down Expand Up @@ -674,7 +674,7 @@ eio_autoclean_threshold_sysctl(ctl_table *table, int write,
* eio_time_based_clean_interval_sysctl
*/
static int
eio_time_based_clean_interval_sysctl(ctl_table *table, int write,
eio_time_based_clean_interval_sysctl(struct ctl_table *table, int write,
void __user *buffer, size_t *length,
loff_t *ppos)
{
Expand Down Expand Up @@ -768,7 +768,7 @@ static void eio_sysctl_unregister_invalidate(struct cache_c *dmc);
* eio_control_sysctl
*/
int
eio_control_sysctl(ctl_table *table, int write, void __user *buffer,
eio_control_sysctl(struct ctl_table *table, int write, void __user *buffer,
size_t *length, loff_t *ppos)
{
int rv = 0;
Expand Down Expand Up @@ -929,10 +929,10 @@ eio_control_sysctl(ctl_table *table, int write, void __user *buffer,
#define PROC_IOSZ_HIST "io_hist"
#define PROC_CONFIG "config"

static int eio_invalidate_sysctl(ctl_table *table, int write,
static int eio_invalidate_sysctl(struct ctl_table *table, int write,
void __user *buffer, size_t *length,
loff_t *ppos);
static void *eio_find_sysctl_data(struct cache_c *dmc, ctl_table *vars);
static void *eio_find_sysctl_data(struct cache_c *dmc, struct ctl_table *vars);
static char *eio_cons_sysctl_devname(struct cache_c *dmc);
static char *eio_cons_procfs_cachename(struct cache_c *dmc,
char *path_component);
Expand Down Expand Up @@ -1011,10 +1011,10 @@ static const struct file_operations eio_config_operations = {
*/
static struct sysctl_table_dir {
struct ctl_table_header *sysctl_header;
ctl_table vars[0 + 1];
ctl_table dev[0 + 1];
ctl_table dir[1 + 1];
ctl_table root[1 + 1];
struct ctl_table vars[0 + 1];
struct ctl_table dev[0 + 1];
struct ctl_table dir[1 + 1];
struct ctl_table root[1 + 1];
} sysctl_template_dir = {
.vars = {
}, .dev = {
Expand All @@ -1039,10 +1039,10 @@ static struct sysctl_table_dir {

static struct sysctl_table_common {
struct ctl_table_header *sysctl_header;
ctl_table vars[NUM_COMMON_SYSCTLS + 1];
ctl_table dev[1 + 1];
ctl_table dir[1 + 1];
ctl_table root[1 + 1];
struct ctl_table vars[NUM_COMMON_SYSCTLS + 1];
struct ctl_table dev[1 + 1];
struct ctl_table dir[1 + 1];
struct ctl_table root[1 + 1];
} sysctl_template_common = {
.vars = {
{ /* 1 */
Expand Down Expand Up @@ -1089,10 +1089,10 @@ static struct sysctl_table_common {

static struct sysctl_table_writeback {
struct ctl_table_header *sysctl_header;
ctl_table vars[NUM_WRITEBACK_SYSCTLS + 1];
ctl_table dev[1 + 1];
ctl_table dir[1 + 1];
ctl_table root[1 + 1];
struct ctl_table vars[NUM_WRITEBACK_SYSCTLS + 1];
struct ctl_table dev[1 + 1];
struct ctl_table dir[1 + 1];
struct ctl_table root[1 + 1];
} sysctl_template_writeback = {
.vars = {
{ /* 1 */
Expand Down Expand Up @@ -1169,10 +1169,10 @@ static struct sysctl_table_writeback {
#define NUM_INVALIDATE_SYSCTLS (1)
static struct sysctl_table_invalidate {
struct ctl_table_header *sysctl_header;
ctl_table vars[NUM_INVALIDATE_SYSCTLS + 1];
ctl_table dev[1 + 1];
ctl_table dir[1 + 1];
ctl_table root[1 + 1];
struct ctl_table vars[NUM_INVALIDATE_SYSCTLS + 1];
struct ctl_table dev[1 + 1];
struct ctl_table dir[1 + 1];
struct ctl_table root[1 + 1];
} sysctl_template_invalidate = {
.vars = {
{ /* 1 */
Expand Down Expand Up @@ -1317,7 +1317,7 @@ static spinlock_t invalidate_spin_lock;
* eio_invalidate_sysctl
*/
static int
eio_invalidate_sysctl(ctl_table *table, int write, void __user *buffer,
eio_invalidate_sysctl(struct ctl_table *table, int write, void __user *buffer,
size_t *length, loff_t *ppos)
{
static int have_sector;
Expand Down Expand Up @@ -1389,7 +1389,7 @@ eio_invalidate_sysctl(ctl_table *table, int write, void __user *buffer,
/*
* eio_find_sysctl_data
*/
static void *eio_find_sysctl_data(struct cache_c *dmc, ctl_table *vars)
static void *eio_find_sysctl_data(struct cache_c *dmc, struct ctl_table *vars)
{

if (strcmp(vars->procname, "do_clean") == 0)
Expand Down
16 changes: 13 additions & 3 deletions Driver/enhanceio/eio_ttc.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@
#include <linux/miscdevice.h>
#include "eio.h"
#include "eio_ttc.h"

#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,17,0))
#define wait_on_bit_lock_action wait_on_bit_lock
#endif

#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,15,0))
#define smp_mb__after_atomic smp_mb__after_clear_bit
#endif


static struct rw_semaphore eio_ttc_lock[EIO_HASHTBL_SIZE];
static struct list_head eio_ttc_list[EIO_HASHTBL_SIZE];

Expand Down Expand Up @@ -1497,12 +1507,12 @@ int eio_reboot_handling(void)
if (eio_reboot_notified == EIO_REBOOT_HANDLING_DONE)
return 0;

(void)wait_on_bit_lock((void *)&eio_control->synch_flags,
(void)wait_on_bit_lock_action((void *)&eio_control->synch_flags,
EIO_HANDLE_REBOOT, eio_wait_schedule,
TASK_UNINTERRUPTIBLE);
if (eio_reboot_notified == EIO_REBOOT_HANDLING_DONE) {
clear_bit(EIO_HANDLE_REBOOT, (void *)&eio_control->synch_flags);
smp_mb__after_clear_bit();
smp_mb__after_atomic();
wake_up_bit((void *)&eio_control->synch_flags,
EIO_HANDLE_REBOOT);
return 0;
Expand Down Expand Up @@ -1604,7 +1614,7 @@ int eio_reboot_handling(void)

eio_reboot_notified = EIO_REBOOT_HANDLING_DONE;
clear_bit(EIO_HANDLE_REBOOT, (void *)&eio_control->synch_flags);
smp_mb__after_clear_bit();
smp_mb__after_atomic();
wake_up_bit((void *)&eio_control->synch_flags, EIO_HANDLE_REBOOT);
return 0;
}
Expand Down