mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-08-07 22:37:12 +02:00
289 lines
8.7 KiB
Diff
289 lines
8.7 KiB
Diff
From 387fce7bf2143b55147ce4822cd68f694c0bc49a Mon Sep 17 00:00:00 2001
|
|
From: Mohan Srinivasan <mohan@fb.com>
|
|
Date: Mon, 3 Nov 2014 11:57:38 -0800
|
|
Subject: [PATCH] 3.17. 3.18 compilation fixes.
|
|
|
|
Summary:
|
|
3.17. 3.18 compilation fixes.
|
|
|
|
Test Plan:
|
|
|
|
Reviewers:
|
|
|
|
CC:
|
|
|
|
Task ID: #
|
|
|
|
Blame Rev:
|
|
---
|
|
src/flashcache_conf.c | 32 ++++++++++++++++++++++++++++-
|
|
src/flashcache_procfs.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++++
|
|
2 files changed, 85 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/src/flashcache_conf.c b/src/flashcache_conf.c
|
|
index 36d1e25..ad20539 100644
|
|
--- a/src/flashcache_conf.c
|
|
+++ b/src/flashcache_conf.c
|
|
@@ -91,12 +91,14 @@ static void flashcache_sync_for_remove(struct cache_c *dmc);
|
|
|
|
extern char *flashcache_sw_version;
|
|
|
|
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,17,0)
|
|
static int
|
|
flashcache_wait_schedule(void *unused)
|
|
{
|
|
schedule();
|
|
return 0;
|
|
}
|
|
+#endif
|
|
|
|
static int
|
|
flashcache_jobs_init(void)
|
|
@@ -1222,13 +1224,21 @@ flashcache_ctr(struct dm_target *ti, unsigned int argc, char **argv)
|
|
seq_io_move_to_lruhead(dmc, &dmc->seq_recent_ios[i]);
|
|
}
|
|
dmc->seq_io_tail = &dmc->seq_recent_ios[0];
|
|
-
|
|
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,17,0)
|
|
(void)wait_on_bit_lock(&flashcache_control->synch_flags, FLASHCACHE_UPDATE_LIST,
|
|
flashcache_wait_schedule, TASK_UNINTERRUPTIBLE);
|
|
+#else
|
|
+ (void)wait_on_bit_lock(&flashcache_control->synch_flags, FLASHCACHE_UPDATE_LIST,
|
|
+ TASK_UNINTERRUPTIBLE);
|
|
+#endif
|
|
dmc->next_cache = cache_list_head;
|
|
cache_list_head = dmc;
|
|
clear_bit(FLASHCACHE_UPDATE_LIST, &flashcache_control->synch_flags);
|
|
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,17,0)
|
|
smp_mb__after_clear_bit();
|
|
+#else
|
|
+ smp_mb__after_atomic();
|
|
+#endif
|
|
wake_up_bit(&flashcache_control->synch_flags, FLASHCACHE_UPDATE_LIST);
|
|
|
|
for (i = 0 ; i < dmc->size ; i++) {
|
|
@@ -1438,10 +1448,16 @@ flashcache_dtr(struct dm_target *ti)
|
|
VERIFY(dmc->num_blacklist_pids == 0);
|
|
dm_put_device(ti, dmc->disk_dev);
|
|
dm_put_device(ti, dmc->cache_dev);
|
|
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,17,0)
|
|
(void)wait_on_bit_lock(&flashcache_control->synch_flags,
|
|
FLASHCACHE_UPDATE_LIST,
|
|
flashcache_wait_schedule,
|
|
TASK_UNINTERRUPTIBLE);
|
|
+#else
|
|
+ (void)wait_on_bit_lock(&flashcache_control->synch_flags,
|
|
+ FLASHCACHE_UPDATE_LIST,
|
|
+ TASK_UNINTERRUPTIBLE);
|
|
+#endif
|
|
nodepp = &cache_list_head;
|
|
while (*nodepp != NULL) {
|
|
if (*nodepp == dmc) {
|
|
@@ -1451,7 +1467,11 @@ flashcache_dtr(struct dm_target *ti)
|
|
nodepp = &((*nodepp)->next_cache);
|
|
}
|
|
clear_bit(FLASHCACHE_UPDATE_LIST, &flashcache_control->synch_flags);
|
|
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,17,0)
|
|
smp_mb__after_clear_bit();
|
|
+#else
|
|
+ smp_mb__after_atomic();
|
|
+#endif
|
|
wake_up_bit(&flashcache_control->synch_flags, FLASHCACHE_UPDATE_LIST);
|
|
kfree(dmc);
|
|
}
|
|
@@ -1735,10 +1755,16 @@ flashcache_notify_reboot(struct notifier_block *this,
|
|
{
|
|
struct cache_c *dmc;
|
|
|
|
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,17,0)
|
|
(void)wait_on_bit_lock(&flashcache_control->synch_flags,
|
|
FLASHCACHE_UPDATE_LIST,
|
|
flashcache_wait_schedule,
|
|
TASK_UNINTERRUPTIBLE);
|
|
+#else
|
|
+ (void)wait_on_bit_lock(&flashcache_control->synch_flags,
|
|
+ FLASHCACHE_UPDATE_LIST,
|
|
+ TASK_UNINTERRUPTIBLE);
|
|
+#endif
|
|
for (dmc = cache_list_head ;
|
|
dmc != NULL ;
|
|
dmc = dmc->next_cache) {
|
|
@@ -1750,7 +1776,11 @@ flashcache_notify_reboot(struct notifier_block *this,
|
|
}
|
|
}
|
|
clear_bit(FLASHCACHE_UPDATE_LIST, &flashcache_control->synch_flags);
|
|
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,17,0)
|
|
smp_mb__after_clear_bit();
|
|
+#else
|
|
+ smp_mb__after_atomic();
|
|
+#endif
|
|
wake_up_bit(&flashcache_control->synch_flags, FLASHCACHE_UPDATE_LIST);
|
|
return NOTIFY_DONE;
|
|
}
|
|
diff --git a/src/flashcache_procfs.c b/src/flashcache_procfs.c
|
|
index 2ff33c0..23c5a81 100644
|
|
--- a/src/flashcache_procfs.c
|
|
+++ b/src/flashcache_procfs.c
|
|
@@ -70,12 +70,18 @@ static char *flashcache_cons_sysctl_devname(struct cache_c *dmc);
|
|
#define FLASHCACHE_PROC_ROOTDIR_NAME "flashcache"
|
|
|
|
static int
|
|
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0)
|
|
+flashcache_io_latency_init(struct ctl_table *table, int write,
|
|
+ void __user *buffer,
|
|
+ size_t *length, loff_t *ppos)
|
|
+#else
|
|
flashcache_io_latency_init(ctl_table *table, int write,
|
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)
|
|
struct file *file,
|
|
#endif
|
|
void __user *buffer,
|
|
size_t *length, loff_t *ppos)
|
|
+#endif
|
|
{
|
|
struct cache_c *dmc = (struct cache_c *)table->extra1;
|
|
|
|
@@ -97,12 +103,18 @@ flashcache_io_latency_init(ctl_table *table, int write,
|
|
}
|
|
|
|
static int
|
|
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0)
|
|
+flashcache_sync_sysctl(struct ctl_table *table, int write,
|
|
+ void __user *buffer,
|
|
+ size_t *length, loff_t *ppos)
|
|
+#else
|
|
flashcache_sync_sysctl(ctl_table *table, int write,
|
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)
|
|
struct file *file,
|
|
#endif
|
|
void __user *buffer,
|
|
size_t *length, loff_t *ppos)
|
|
+#endif
|
|
{
|
|
struct cache_c *dmc = (struct cache_c *)table->extra1;
|
|
|
|
@@ -123,12 +135,18 @@ flashcache_sync_sysctl(ctl_table *table, int write,
|
|
}
|
|
|
|
static int
|
|
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0)
|
|
+flashcache_zerostats_sysctl(struct ctl_table *table, int write,
|
|
+ void __user *buffer,
|
|
+ size_t *length, loff_t *ppos)
|
|
+#else
|
|
flashcache_zerostats_sysctl(ctl_table *table, int write,
|
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)
|
|
struct file *file,
|
|
#endif
|
|
void __user *buffer,
|
|
size_t *length, loff_t *ppos)
|
|
+#endif
|
|
{
|
|
struct cache_c *dmc = (struct cache_c *)table->extra1;
|
|
|
|
@@ -151,12 +169,18 @@ flashcache_zerostats_sysctl(ctl_table *table, int write,
|
|
}
|
|
|
|
static int
|
|
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0)
|
|
+flashcache_fallow_clean_speed_sysctl(struct ctl_table *table, int write,
|
|
+ void __user *buffer,
|
|
+ size_t *length, loff_t *ppos)
|
|
+#else
|
|
flashcache_fallow_clean_speed_sysctl(ctl_table *table, int write,
|
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)
|
|
struct file *file,
|
|
#endif
|
|
void __user *buffer,
|
|
size_t *length, loff_t *ppos)
|
|
+#endif
|
|
{
|
|
struct cache_c *dmc = (struct cache_c *)table->extra1;
|
|
|
|
@@ -176,12 +200,18 @@ flashcache_fallow_clean_speed_sysctl(ctl_table *table, int write,
|
|
}
|
|
|
|
static int
|
|
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0)
|
|
+flashcache_dirty_thresh_sysctl(struct ctl_table *table, int write,
|
|
+ void __user *buffer,
|
|
+ size_t *length, loff_t *ppos)
|
|
+#else
|
|
flashcache_dirty_thresh_sysctl(ctl_table *table, int write,
|
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)
|
|
struct file *file,
|
|
#endif
|
|
void __user *buffer,
|
|
size_t *length, loff_t *ppos)
|
|
+#endif
|
|
{
|
|
struct cache_c *dmc = (struct cache_c *)table->extra1;
|
|
|
|
@@ -204,12 +234,18 @@ flashcache_dirty_thresh_sysctl(ctl_table *table, int write,
|
|
}
|
|
|
|
static int
|
|
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0)
|
|
+flashcache_lru_hot_pct_sysctl(struct ctl_table *table, int write,
|
|
+ void __user *buffer,
|
|
+ size_t *length, loff_t *ppos)
|
|
+#else
|
|
flashcache_lru_hot_pct_sysctl(ctl_table *table, int write,
|
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)
|
|
struct file *file,
|
|
#endif
|
|
void __user *buffer,
|
|
size_t *length, loff_t *ppos)
|
|
+#endif
|
|
{
|
|
struct cache_c *dmc = (struct cache_c *)table->extra1;
|
|
|
|
@@ -236,10 +272,17 @@ flashcache_lru_hot_pct_sysctl(ctl_table *table, int write,
|
|
|
|
static struct flashcache_writeback_sysctl_table {
|
|
struct ctl_table_header *sysctl_header;
|
|
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0)
|
|
+ struct ctl_table vars[FLASHCACHE_NUM_WRITEBACK_SYSCTLS];
|
|
+ struct ctl_table dev[2];
|
|
+ struct ctl_table dir[2];
|
|
+ struct ctl_table root[2];
|
|
+#else
|
|
ctl_table vars[FLASHCACHE_NUM_WRITEBACK_SYSCTLS];
|
|
ctl_table dev[2];
|
|
ctl_table dir[2];
|
|
ctl_table root[2];
|
|
+#endif
|
|
} flashcache_writeback_sysctl = {
|
|
.vars = {
|
|
{
|
|
@@ -510,10 +553,17 @@ static struct flashcache_writeback_sysctl_table {
|
|
|
|
static struct flashcache_writethrough_sysctl_table {
|
|
struct ctl_table_header *sysctl_header;
|
|
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0)
|
|
+ struct ctl_table vars[FLASHCACHE_NUM_WRITETHROUGH_SYSCTLS];
|
|
+ struct ctl_table dev[2];
|
|
+ struct ctl_table dir[2];
|
|
+ struct ctl_table root[2];
|
|
+#else
|
|
ctl_table vars[FLASHCACHE_NUM_WRITETHROUGH_SYSCTLS];
|
|
ctl_table dev[2];
|
|
ctl_table dir[2];
|
|
ctl_table root[2];
|
|
+#endif
|
|
} flashcache_writethrough_sysctl = {
|
|
.vars = {
|
|
{
|
|
@@ -668,7 +718,11 @@ static struct flashcache_writethrough_sysctl_table {
|
|
};
|
|
|
|
int *
|
|
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0)
|
|
+flashcache_find_sysctl_data(struct cache_c *dmc, struct ctl_table *vars)
|
|
+#else
|
|
flashcache_find_sysctl_data(struct cache_c *dmc, ctl_table *vars)
|
|
+#endif
|
|
{
|
|
if (strcmp(vars->procname, "io_latency_hist") == 0)
|
|
return &dmc->sysctl_io_latency_hist;
|