Skip to content

Commit

Permalink
fix compilation on Linux 3.18
Browse files Browse the repository at this point in the history
The function smp_mb__after_clear_bit is finally gone after being
deprecated for some time. It is replaced by smp_mb__after_atomic, which
was available since Linux 3.15.
  • Loading branch information
Philipp Edelmann committed Dec 15, 2014
1 parent 32acf9b commit 4d0750e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
16 changes: 10 additions & 6 deletions Driver/enhanceio/eio_conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ int eio_wait_schedule(void *unused)
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 @@ -1853,7 +1857,7 @@ int eio_cache_create(struct cache_rec_short *cache)
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 @@ -1918,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 @@ -2072,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 @@ -2397,7 +2401,7 @@ eio_notify_reboot(struct notifier_block *this, unsigned long code, void *x)
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;
Expand Down Expand Up @@ -2425,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
9 changes: 7 additions & 2 deletions Driver/enhanceio/eio_ttc.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@
#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 @@ -1507,7 +1512,7 @@ int eio_reboot_handling(void)
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 @@ -1609,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

0 comments on commit 4d0750e

Please sign in to comment.